forked from VimPlug/jedi
moved using setting.fast_parser to fast_parser
This commit is contained in:
@@ -9,7 +9,6 @@ if is_py3k:
|
|||||||
import types
|
import types
|
||||||
import inspect
|
import inspect
|
||||||
|
|
||||||
import settings
|
|
||||||
import common
|
import common
|
||||||
import debug
|
import debug
|
||||||
import parsing
|
import parsing
|
||||||
@@ -70,10 +69,7 @@ class CachedModule(object):
|
|||||||
def _load_module(self):
|
def _load_module(self):
|
||||||
source = self._get_source()
|
source = self._get_source()
|
||||||
p = self.path or self.name
|
p = self.path or self.name
|
||||||
if settings.fast_parser:
|
self._parser = fast_parser.FastParser(source, p)
|
||||||
self._parser = fast_parser.FastParser(source, p)
|
|
||||||
else:
|
|
||||||
self._parser = parsing.PyFuzzyParser(source, p)
|
|
||||||
p_time = None if not self.path else os.path.getmtime(self.path)
|
p_time = None if not self.path else os.path.getmtime(self.path)
|
||||||
|
|
||||||
if self.path or self.name:
|
if self.path or self.name:
|
||||||
|
|||||||
@@ -138,6 +138,8 @@ class Module(parsing.Simple, parsing.Module):
|
|||||||
class CachedFastParser(type):
|
class CachedFastParser(type):
|
||||||
""" This is a metaclass for caching `FastParser`. """
|
""" This is a metaclass for caching `FastParser`. """
|
||||||
def __call__(self, code, module_path=None, user_position=None):
|
def __call__(self, code, module_path=None, user_position=None):
|
||||||
|
if not settings.fast_parser:
|
||||||
|
return parsing.PyFuzzyParser(code, module_path, user_position)
|
||||||
if module_path is None or module_path not in parser_cache:
|
if module_path is None or module_path not in parser_cache:
|
||||||
p = super(CachedFastParser, self).__call__(code, module_path,
|
p = super(CachedFastParser, self).__call__(code, module_path,
|
||||||
user_position)
|
user_position)
|
||||||
|
|||||||
@@ -72,12 +72,8 @@ class ModuleWithCursor(Module):
|
|||||||
# Call the parser already here, because it will be used anyways.
|
# Call the parser already here, because it will be used anyways.
|
||||||
# Also, the position is here important (which will not be used by
|
# Also, the position is here important (which will not be used by
|
||||||
# default), therefore fill the cache here.
|
# default), therefore fill the cache here.
|
||||||
if settings.fast_parser:
|
self._parser = fast_parser.FastParser(self.source, self.path,
|
||||||
self._parser = fast_parser.FastParser(self.source, self.path,
|
self.position)
|
||||||
self.position)
|
|
||||||
else:
|
|
||||||
self._parser = parsing.PyFuzzyParser(self.source, self.path,
|
|
||||||
self.position)
|
|
||||||
if self.path is not None:
|
if self.path is not None:
|
||||||
builtin.CachedModule.cache[self.path] = time.time(), \
|
builtin.CachedModule.cache[self.path] = time.time(), \
|
||||||
self._parser
|
self._parser
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ add_bracket_after_function = False
|
|||||||
# Use the fast parser. This means that reparsing is only being done if
|
# Use the fast parser. This means that reparsing is only being done if
|
||||||
# something has been changed e.g. to a function. If this happens, only the
|
# something has been changed e.g. to a function. If this happens, only the
|
||||||
# function is being reparsed.
|
# function is being reparsed.
|
||||||
fast_parser = True
|
fast_parser = False
|
||||||
|
|
||||||
# This is just a debugging option. Always reparsing means that the fast parser
|
# This is just a debugging option. Always reparsing means that the fast parser
|
||||||
# is basically useless. So don't use it.
|
# is basically useless. So don't use it.
|
||||||
|
|||||||
Reference in New Issue
Block a user