Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show Python doc strings for the current function in Sublime Text 2?

I just found Sublime Text 2 and it's awesome. The only thing I really miss is the ability to view the doc string of the function I'm dealing with. Are there any plugins that can do this?

for example:

def f(x):
    '''a doc string for f'''
    print x

f # << at this point, either automatically or with a keystroke,
  # I would like to be able to somehow view "a doc string for f"

Edit: I've already attempted to using SublimeCodeIntel and SublimeRope, neither have such support.

Edit2: It should also work for other modules in the open project.

like image 669
TorelTwiddler Avatar asked Jun 07 '12 17:06

TorelTwiddler


2 Answers

Something like this will point to the correct place in the documentation, but if you really need documentation integrated into your environment, I would consider using an IDE. However, I too am a fan of Sublime and just pop open a browser when needed.

like image 94
Fahd A. Avatar answered Nov 15 '22 16:11

Fahd A.


Install anaconda for sublime.

Then on Sublime3, navigate to Preferences > Package Settings > Anaconda > Settings-User and add the following lines to the text file just opened.

{
    "anaconda_linting" : false,
    "enable_signatures_tooltip" : true,
    "merge_signatures_and_doc" : true,
    "python_interpreter":"/home/miladiouss/anaconda3/bin/python"
}

Save, restart Sublime, and enjoy the best IDE for Python!

like image 41
Miladiouss Avatar answered Nov 15 '22 16:11

Miladiouss