completion works now also in docstrings

This commit is contained in:
David Halter
2012-08-31 00:27:05 +02:00
parent 9a5537d3c1
commit 39ce26eb1e
2 changed files with 15 additions and 1 deletions

View File

@@ -1026,6 +1026,7 @@ class PyFuzzyParser(object):
def __init__(self, code, module_path=None, user_position=None,
no_docstr=False):
self.user_position = user_position
self.user_scope = None
self.user_stmt = None
self.code = code + '\n' # end with \n, because the parser needs it
self.no_docstr = no_docstr
@@ -1413,7 +1414,9 @@ class PyFuzzyParser(object):
self._current_full = next(self.gen)
type, tok, self._tokenize_start_pos, self._tokenize_end_pos, \
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' % \
(self.parserline.replace('\n', ''), repr(self.scope)))
self.user_scope = self.scope

View File

@@ -165,3 +165,14 @@ def global_define():
#? int()
global_var_in_func
# -----------------
# within docstrs
# -----------------
def a():
"""
#? ['global_define']
global_define
"""
pass