mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 06:24:27 +08:00
Fix an issue with whitespace after a dot at the end of a file, also part of #1748
This commit is contained in:
@@ -195,7 +195,6 @@ class Completion:
|
||||
- In args: */**: no completion
|
||||
- In params (also lambda): no completion before =
|
||||
"""
|
||||
|
||||
grammar = self._inference_state.grammar
|
||||
self.stack = stack = None
|
||||
self._position = (
|
||||
@@ -278,6 +277,10 @@ class Completion:
|
||||
)
|
||||
elif nonterminals[-1] in ('trailer', 'dotted_name') and nodes[-1] == '.':
|
||||
dot = self._module_node.get_leaf_for_position(self._position)
|
||||
if dot.type == "endmarker":
|
||||
# This is a bit of a weird edge case, maybe we can somehow
|
||||
# generalize this.
|
||||
dot = leaf.get_previous_leaf()
|
||||
cached_name, n = self._complete_trailer(dot.get_previous_leaf())
|
||||
completion_names += n
|
||||
elif self._is_parameter_completion():
|
||||
|
||||
@@ -284,6 +284,13 @@ def doctest_with_space():
|
||||
import_issu
|
||||
"""
|
||||
|
||||
def doctest_issue_github_1748():
|
||||
"""From GitHub #1748
|
||||
#? 10 []
|
||||
This. Al
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
def docstring_rst_identifiers():
|
||||
"""
|
||||
|
||||
@@ -457,3 +457,7 @@ def test_module_completions(Script, module):
|
||||
# Just make sure that there are no errors
|
||||
c.type
|
||||
c.docstring()
|
||||
|
||||
|
||||
def test_whitespace_at_end_after_dot(Script):
|
||||
assert 'strip' in [c.name for c in Script('str. ').complete()]
|
||||
|
||||
Reference in New Issue
Block a user