mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 14:34:31 +08:00
If an INDENT is the next supposed token, we should still be able to complete.
This commit is contained in:
@@ -130,7 +130,7 @@ class Completion:
|
|||||||
|
|
||||||
completion_names = list(self._get_keyword_completion_names(allowed_keywords))
|
completion_names = list(self._get_keyword_completion_names(allowed_keywords))
|
||||||
|
|
||||||
if token.NAME in allowed_tokens:
|
if token.NAME in allowed_tokens or token.INDENT in allowed_tokens:
|
||||||
# This means that we actually have to do type inference.
|
# This means that we actually have to do type inference.
|
||||||
|
|
||||||
symbol_names = list(self.stack.get_node_names(grammar))
|
symbol_names = list(self.stack.get_node_names(grammar))
|
||||||
|
|||||||
@@ -28,3 +28,13 @@ def test_in_empty_space():
|
|||||||
assert self.name == 'self'
|
assert self.name == 'self'
|
||||||
def_, = self._goto_definitions()
|
def_, = self._goto_definitions()
|
||||||
assert def_.name == 'X'
|
assert def_.name == 'X'
|
||||||
|
|
||||||
|
|
||||||
|
def test_indent_context():
|
||||||
|
"""
|
||||||
|
If an INDENT is the next supposed token, we should still be able to
|
||||||
|
complete.
|
||||||
|
"""
|
||||||
|
code = 'if 1:\nisinstanc'
|
||||||
|
comp, = Script(code).completions()
|
||||||
|
assert comp.name == 'isinstance'
|
||||||
|
|||||||
Reference in New Issue
Block a user