Skip to content

Commit

Permalink
Merge pull request #474 from birkenfeld/jedi_docstring
Browse files Browse the repository at this point in the history
Implement get_docstring for the Jedi backend.
  • Loading branch information
jorgenschaefer committed Feb 5, 2015
2 parents 4c6b745 + 953f5e4 commit 9db4d3b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions elpy/jedibackend.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,17 @@ def rpc_get_completion_location(self, completion):
else:
return (proposal.module_path, proposal.line)

def rpc_get_docstring(self, filename, source, offset):
line, column = pos_to_linecol(source, offset)
try:
locations = run_with_debug(jedi, 'goto_definitions',
source=source, line=line, column=column,
path=filename, encoding='utf-8',
re_raise=jedi.NotFoundError)
except jedi.NotFoundError:
return ''
return locations[-1].docstring()

def rpc_get_definition(self, filename, source, offset):
line, column = pos_to_linecol(source, offset)
try:
Expand Down

0 comments on commit 9db4d3b

Please sign in to comment.