Sublime Forum

Need help with a new plugin

#1

Hi,

I’m trying to create a new plugin that will replicate the functionality of a RDF Translator web application (http://rdf-translator.appspot.com/) in my editor.

In a nutshell, I want to:

  1. take the content of the current tab or selection
  2. create a new tab/buffer
  3. execute a converter on the current tab or selection
  4. place contents in new tab

Are there any existing open source plugins that do most of what I want? It seems like it would be a solved issue, just dropping in my converter logic.

In addition, what is the process for including additional libraries into a plugin? Is it just copy/paste the files into the plugin directory, or is there a registration process to get the libraries linked in and available for use?

I am only targeting ST3 at the moment.

Thanks for any assistance.

/Paul

0 Likes

#2

As for using third party libraries, just ensure you are allowed to distribute their work. But yes, you will end up bundling it with the plugin, or creating some dependency the user must fulfill through installation of the third party libraries.

There’s probably a plugin that does a lot of what you want, but it’s pretty straight forward to do yourself. Note I’m assuming you’ve looked (or no where to find) the API documentation.

  1. Use view.sel() to get a selection. If this is empty, you will use a region with the following bounds (0, view.size()).
  2. Use window.new_file() to create a new tab
  3. From 1.) you should have the content you need, so run it through the converter.
  4. You can use view.insert to insert text into the new tab.
0 Likes

#3

Here you can find the documentation: sublimetext.com/docs/3/api_reference.html

0 Likes

#4

[quote=“skuroda”]As for using third party libraries, just ensure you are allowed to distribute their work. But yes, you will end up bundling it with the plugin, or creating some dependency the user must fulfill through installation of the third party libraries.

There’s probably a plugin that does a lot of what you want, but it’s pretty straight forward to do yourself. Note I’m assuming you’ve looked (or no where to find) the API documentation.
[/quote]

Yes, the 3p library is open source. I looked and didn’t find many semantic web related plugins already existing, only a SPARQL highlighter and query runner.

I posted in another topic about a specific problem I’m having with the library import. Any assistance with decoding what is going on there would be helpful.

I have read the docs, though you must admit they’re pretty thin. :neutral_face:

Thanks for the replies.

/Paul

0 Likes

#5

Yes they are, I just wanted to post if you didn’t know them.

0 Likes