forked from VimPlug/jedi
Merge pull request #1923 from dimbleby/help-after-newline
fix help when in column zero
This commit is contained in:
@@ -369,6 +369,12 @@ class Script:
|
|||||||
if definitions:
|
if definitions:
|
||||||
return definitions
|
return definitions
|
||||||
leaf = self._module_node.get_leaf_for_position((line, column))
|
leaf = self._module_node.get_leaf_for_position((line, column))
|
||||||
|
|
||||||
|
if leaf is not None and leaf.end_pos == (line, column) and leaf.type == 'newline':
|
||||||
|
next_ = leaf.get_next_leaf()
|
||||||
|
if next_ is not None and next_.start_pos == leaf.end_pos:
|
||||||
|
leaf = next_
|
||||||
|
|
||||||
if leaf is not None and leaf.type in ('keyword', 'operator', 'error_leaf'):
|
if leaf is not None and leaf.type in ('keyword', 'operator', 'error_leaf'):
|
||||||
def need_pydoc():
|
def need_pydoc():
|
||||||
if leaf.value in ('(', ')', '[', ']'):
|
if leaf.value in ('(', ')', '[', ']'):
|
||||||
|
|||||||
@@ -28,6 +28,11 @@ def test_import_keyword(Script):
|
|||||||
# unrelated to #44
|
# unrelated to #44
|
||||||
|
|
||||||
|
|
||||||
|
def test_import_keyword_after_newline(Script):
|
||||||
|
d, = Script("import x\nimport y").help(line=2, column=0)
|
||||||
|
assert d.docstring().startswith('The "import" statement')
|
||||||
|
|
||||||
|
|
||||||
def test_import_keyword_with_gotos(goto_or_infer):
|
def test_import_keyword_with_gotos(goto_or_infer):
|
||||||
assert not goto_or_infer("import x", column=0)
|
assert not goto_or_infer("import x", column=0)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user