Home Download Buy Blog Forum Support

Need help with a new plugin

Need help with a new plugin

Postby PaulK on Tue Jul 02, 2013 3:27 pm

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
PaulK
 
Posts: 4
Joined: Tue Jul 02, 2013 3:19 pm

Re: Need help with a new plugin

Postby skuroda on Wed Jul 03, 2013 3:12 am

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.
skuroda
 
Posts: 687
Joined: Fri Oct 05, 2012 8:11 am

Re: Need help with a new plugin

Postby layne on Wed Jul 03, 2013 7:24 am

// my Blog //
layne
 
Posts: 39
Joined: Tue Jan 04, 2011 3:00 pm
Location: NRW // GER

Re: Need help with a new plugin

Postby PaulK on Wed Jul 03, 2013 2:12 pm

skuroda wrote: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.


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.

layne wrote:Here you can find the documentation: http://www.sublimetext.com/docs/3/ API Doc: http://www.sublimetext.com/docs/3/api_reference.html


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

Thanks for the replies.

/Paul
PaulK
 
Posts: 4
Joined: Tue Jul 02, 2013 3:19 pm

Re: Need help with a new plugin

Postby layne on Wed Jul 03, 2013 5:17 pm

Yes they are, I just wanted to post if you didn't know them.
// my Blog //
layne
 
Posts: 39
Joined: Tue Jan 04, 2011 3:00 pm
Location: NRW // GER


Return to Plugin Development

Who is online

Users browsing this forum: Yahoo [Bot] and 4 guests