Reputation: 6166
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.
Upvotes: 12
Views: 9267
Reputation: 4720
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!
Upvotes: 5
Reputation: 5092
By tweaking SublimeCodeIntel, you can disable the "jump" to the file where the function is defined -- this will allow you to see the function definition in the status bar upon alt-clicking.
To do this, select Preferences > Browse Packages and then open SublimeCodeIntel/SublimeCodeIntel.py.
Go to class GotoPythonDefinition(sublime_plugin.TextCommand):
and add a return
at line 890 so that the first lines of _trigger
read:
def _trigger(defns):
if defns is not None:
defn = defns[0]
if defn.name and defn.doc:
msg = "%s: %s" % (defn.name, defn.doc)
logger(view, 'info', msg, timeout=3000)
return
(you can also tweak the msg
string formatting and remove the defn.name
to save a bit of status bar space).
It's a bit disorienting to have to look down at the status bar to see the definition... also, the status bar won't be able to display long definitions. However, it's a start. Hopefully, tooltip/popup control will be made available through the API so that definitions can appear in the view next to alt-clicked functions.
Upvotes: 1