mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-15 18:17:07 +08:00
completion works now also in docstrings
This commit is contained in:
@@ -1026,6 +1026,7 @@ class PyFuzzyParser(object):
|
|||||||
def __init__(self, code, module_path=None, user_position=None,
|
def __init__(self, code, module_path=None, user_position=None,
|
||||||
no_docstr=False):
|
no_docstr=False):
|
||||||
self.user_position = user_position
|
self.user_position = user_position
|
||||||
|
self.user_scope = None
|
||||||
self.user_stmt = None
|
self.user_stmt = None
|
||||||
self.code = code + '\n' # end with \n, because the parser needs it
|
self.code = code + '\n' # end with \n, because the parser needs it
|
||||||
self.no_docstr = no_docstr
|
self.no_docstr = no_docstr
|
||||||
@@ -1413,7 +1414,9 @@ class PyFuzzyParser(object):
|
|||||||
self._current_full = next(self.gen)
|
self._current_full = next(self.gen)
|
||||||
type, tok, self._tokenize_start_pos, self._tokenize_end_pos, \
|
type, tok, self._tokenize_start_pos, self._tokenize_end_pos, \
|
||||||
self.parserline = self._current_full
|
self.parserline = self._current_full
|
||||||
if self.user_position and self.start_pos[0] == self.user_position[0]:
|
if self.user_position and (self.start_pos[0] == self.user_position[0]
|
||||||
|
or self.user_scope is None
|
||||||
|
and self.start_pos[0] >= self.user_position[0]):
|
||||||
debug.dbg('user scope found [%s] = %s' % \
|
debug.dbg('user scope found [%s] = %s' % \
|
||||||
(self.parserline.replace('\n', ''), repr(self.scope)))
|
(self.parserline.replace('\n', ''), repr(self.scope)))
|
||||||
self.user_scope = self.scope
|
self.user_scope = self.scope
|
||||||
|
|||||||
@@ -165,3 +165,14 @@ def global_define():
|
|||||||
|
|
||||||
#? int()
|
#? int()
|
||||||
global_var_in_func
|
global_var_in_func
|
||||||
|
|
||||||
|
# -----------------
|
||||||
|
# within docstrs
|
||||||
|
# -----------------
|
||||||
|
|
||||||
|
def a():
|
||||||
|
"""
|
||||||
|
#? ['global_define']
|
||||||
|
global_define
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|||||||
Reference in New Issue
Block a user