Home Download Buy Blog Forum Support

SublimePeek - quick access to help for functions

SublimePeek - quick access to help for functions

Postby jlegewie on Fri Apr 13, 2012 12:15 pm

Hi,

I put together a small plugin with the intention to provide quick access to the documentation or help files for functions. A single key-stroke in ST2 will bring up the documentation for the currently selected function or the function at the current cursor position. The plugin can also show an overview of all available help topics based on the familiar ST2 quick select panel (the same as the command panel) so that the user can quickly browse the different help topics.

Supported Languages: HTML, CSS, JavaScript, PHP, Python, Ruby, R, and Stata
(The plugin can be extended to support other languages)

Supported Platforms
Currently, the plugin only runs on Mac OS but it can be extended to work on other unix systems using gloobus-preview as well as Windows using maComfort. I personally don't have a unix or windows system but it should be pretty easy to add support. Drop me a line and we can make it work.


How to install
https://github.com/jlegewie/SublimePeek

Illustration

'subprocess' is selected in ST2...
SublimePeek-Python-1b.png
SublimePeek-Python-1b.png (155.14 KiB) Viewed 9702 times


...simply pressing command+shift+h opens this window with the documentation for 'subprocess'
SublimePeek-Python-2b.png
SublimePeek-Python-2b.png (176.82 KiB) Viewed 9691 times



Selecting 'text-align' in a CSS file and pressing command+shift+h opens this window with the documentation for 'text-align'
SP-2.png
SP-2.png (109.95 KiB) Viewed 9507 times
Last edited by jlegewie on Fri Apr 27, 2012 6:26 pm, edited 4 times in total.
jlegewie
 
Posts: 16
Joined: Fri Apr 13, 2012 11:35 am

Re: SublimePeek - quick access to function documentation

Postby jlegewie on Sun Apr 15, 2012 12:51 pm

I have added support for HTML and CSS...
jlegewie
 
Posts: 16
Joined: Fri Apr 13, 2012 11:35 am

Re: SublimePeek - quick access to help for functions

Postby francois on Sun Apr 15, 2012 6:10 pm

Great plugin :)
Any chance to see it directly integrated in Sublime text pane/window ? :mrgreen:

Cheers
Francois
francois
 
Posts: 5
Joined: Mon Apr 02, 2012 8:13 am

Re: SublimePeek - quick access to help for functions

Postby jlegewie on Tue Apr 17, 2012 7:00 am

No, I don't think that is possible, Francois. The idea of the plugin (at least partly) is to circumvent ST2 limitations to display function tooltips. I think the only way to actually show the help file in ST2 would be to convert the html files to txt and put the content in a new tab. I think that is way to disruptive for the programming flow...
jlegewie
 
Posts: 16
Joined: Fri Apr 13, 2012 11:35 am

Re: SublimePeek - quick access to help for functions

Postby jlegewie on Thu Apr 19, 2012 10:10 am

SublimePeek is now available through Package Control...
jlegewie
 
Posts: 16
Joined: Fri Apr 13, 2012 11:35 am

Re: SublimePeek - quick access to help for functions

Postby nollo on Mon Apr 23, 2012 7:25 am

It would be very cool to have Ruby/RoR support ! :)

Very nice job ;)
nollo
 
Posts: 19
Joined: Sat Mar 03, 2012 10:47 am

Re: SublimePeek - quick access to help for functions

Postby francescob on Mon Apr 23, 2012 2:58 pm

i'm trying implementing support for Ruby docs, but for now i can have it working only for classes and not methods since rdoc is stored in html files named after the class ex: String.html.
Also it doesn't work for subclasses since docs for these are stored in subfolders ie: class Enumerable::Enumerator maps to enumerable\enumerator.html
francescob
 
Posts: 20
Joined: Mon Apr 23, 2012 2:52 pm

Re: SublimePeek - quick access to help for functions

Postby francescob on Mon Apr 23, 2012 3:21 pm

I'm also trying an approach similar to they python one generating doc on the fly using the ruby 'ri' command, but i keep getting no help file found for...
is there a way to debug the plugin to see what's going wrong?
francescob
 
Posts: 20
Joined: Mon Apr 23, 2012 2:52 pm

Re: SublimePeek - quick access to help for functions

Postby jlegewie on Tue Apr 24, 2012 8:03 am

Hi, I am not familiar with Ruby so can you give some concrete examples? What would be the selection and how are help files called?
Below are the three ways I currently use to access the help files. I think you can solve the subfolder problem using the mapping file. For ri, can you send me a syntax example? Just to generate a help file from the console in a certain location for some function.


Three ways to access the help files.
1) The help file is named like the function. E.g. round -> round.html
2) There is a mapping file called [LANG]-mapping.json with this structure:
Code: Select all
[
{"from": "SELECTION","to": "NAME OF HELP FILE"}
]

3) The help files are generated in Python e.g. using the command line tool pydoc for Python.


ps: I might face a similar problems with javascript. For javascript, I have a lot of methods like Array.length, and Array.split but also String.length. One problem is that ST2 does not know whether a certain for is a string or an array. So which help should I call for var.length?
jlegewie
 
Posts: 16
Joined: Fri Apr 13, 2012 11:35 am

Re: SublimePeek - quick access to help for functions

Postby kobzar on Tue Apr 24, 2012 8:07 am

Greatest plugun!! Awesome job!
kobzar
 
Posts: 19
Joined: Mon Apr 23, 2012 5:53 am

Next

Return to Plugin Announcements

Who is online

Users browsing this forum: No registered users and 15 guests