mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 14:04:26 +08:00
Keyword completion after ... should not work, fixes davidhalter/jedi-vim#506
This commit is contained in:
@@ -183,7 +183,8 @@ class Completion:
|
|||||||
|
|
||||||
completion_names = []
|
completion_names = []
|
||||||
current_line = self._code_lines[self._position[0] - 1][:self._position[1]]
|
current_line = self._code_lines[self._position[0] - 1][:self._position[1]]
|
||||||
if not current_line or current_line[-1] in ' \t.;':
|
if not current_line or current_line[-1] in ' \t.;' \
|
||||||
|
and current_line[-3:] != '...':
|
||||||
completion_names += self._complete_keywords(allowed_transitions)
|
completion_names += self._complete_keywords(allowed_transitions)
|
||||||
|
|
||||||
if any(t in allowed_transitions for t in (PythonTokenTypes.NAME,
|
if any(t in allowed_transitions for t in (PythonTokenTypes.NAME,
|
||||||
|
|||||||
@@ -283,3 +283,7 @@ def test_fuzzy_match():
|
|||||||
assert fuzzy_match('Condition', 'ii')
|
assert fuzzy_match('Condition', 'ii')
|
||||||
assert not fuzzy_match('Condition', 'Ciito')
|
assert not fuzzy_match('Condition', 'Ciito')
|
||||||
assert fuzzy_match('Condition', 'Cdiio')
|
assert fuzzy_match('Condition', 'Cdiio')
|
||||||
|
|
||||||
|
|
||||||
|
def test_ellipsis_completion(Script):
|
||||||
|
assert Script('...').completions() == []
|
||||||
|
|||||||
@@ -374,7 +374,7 @@ def test_relative_imports_with_outside_paths(Script):
|
|||||||
path=os.path.join(dir, 'api/whatever/test_this.py'),
|
path=os.path.join(dir, 'api/whatever/test_this.py'),
|
||||||
_project=project,
|
_project=project,
|
||||||
)
|
)
|
||||||
assert [c.name for c in script.complete()] == ['api', 'import', 'whatever']
|
assert [c.name for c in script.complete()] == ['api', 'whatever']
|
||||||
|
|
||||||
script = Script(
|
script = Script(
|
||||||
"from " + '.' * 100,
|
"from " + '.' * 100,
|
||||||
@@ -398,7 +398,9 @@ def test_relative_imports_without_path(Script):
|
|||||||
|
|
||||||
|
|
||||||
def test_relative_import_out_of_file_system(Script):
|
def test_relative_import_out_of_file_system(Script):
|
||||||
script = Script("from " + '.' * 100)
|
code = "from " + '.' * 100
|
||||||
|
assert not Script(code).complete()
|
||||||
|
script = Script(code + ' ')
|
||||||
import_, = script.complete()
|
import_, = script.complete()
|
||||||
assert import_.name == 'import'
|
assert import_.name == 'import'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user