forked from VimPlug/jedi
Dedent some code to avoid issues with parso.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
from parso import token
|
from parso.python import token
|
||||||
from parso.python import tree
|
from parso.python import tree
|
||||||
from jedi import debug
|
from jedi import debug
|
||||||
from jedi import settings
|
from jedi import settings
|
||||||
|
|||||||
@@ -3,10 +3,11 @@ Helpers for the API
|
|||||||
"""
|
"""
|
||||||
import re
|
import re
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
from textwrap import dedent
|
||||||
|
|
||||||
from parso.python.parser import Parser
|
from parso.python.parser import Parser
|
||||||
from parso.python import tree
|
from parso.python import tree
|
||||||
from parso.tokenize import tokenize
|
from parso.python.tokenize import tokenize
|
||||||
from parso.utils import splitlines
|
from parso.utils import splitlines
|
||||||
|
|
||||||
from jedi._compatibility import u
|
from jedi._compatibility import u
|
||||||
@@ -127,7 +128,8 @@ def get_stack_at_position(grammar, code_lines, module_node, pos):
|
|||||||
else:
|
else:
|
||||||
yield token_
|
yield token_
|
||||||
|
|
||||||
code = _get_code_for_stack(code_lines, module_node, pos)
|
# The code might be indedented, just remove it.
|
||||||
|
code = dedent(_get_code_for_stack(code_lines, module_node, pos))
|
||||||
# We use a word to tell Jedi when we have reached the start of the
|
# We use a word to tell Jedi when we have reached the start of the
|
||||||
# completion.
|
# completion.
|
||||||
# Use Z as a prefix because it's not part of a number suffix.
|
# Use Z as a prefix because it's not part of a number suffix.
|
||||||
|
|||||||
Reference in New Issue
Block a user