forked from VimPlug/jedi
All modules now have a code_lines attribute, see #1062
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
import textwrap
|
||||
from inspect import cleandoc
|
||||
|
||||
from jedi._compatibility import literal_eval, force_unicode
|
||||
from parso.python import tree
|
||||
from parso.cache import parser_cache
|
||||
|
||||
from jedi._compatibility import literal_eval, force_unicode
|
||||
|
||||
_EXECUTE_NODES = {'funcdef', 'classdef', 'import_from', 'import_name', 'test',
|
||||
'or_test', 'and_test', 'not_test', 'comparison', 'expr',
|
||||
@@ -238,3 +240,11 @@ def get_parent_scope(node, include_flows=False):
|
||||
break
|
||||
scope = scope.parent
|
||||
return scope
|
||||
|
||||
|
||||
def get_cached_code_lines(grammar, path):
|
||||
"""
|
||||
Basically access the cached code lines in parso. This is not the nicest way
|
||||
to do this, but we avoid splitting all the lines again.
|
||||
"""
|
||||
return parser_cache[grammar._hashed][path].lines
|
||||
|
||||
Reference in New Issue
Block a user