Skip to content

Commit fdc261d

Browse files
committed
Populate Workspace.PRELOADED_MODULES lazily
Otherwise we spend time populating PRELOADED_MODULES regardless if we use Rope or not.
1 parent aaa362c commit fdc261d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pyls/workspace.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class Workspace(object):
7070
M_PUBLISH_DIAGNOSTICS = 'textDocument/publishDiagnostics'
7171
M_APPLY_EDIT = 'workspace/applyEdit'
7272
M_SHOW_MESSAGE = 'window/showMessage'
73-
PRELOADED_MODULES = get_preferred_submodules()
73+
PRELOADED_MODULES = None
7474

7575
def __init__(self, root_uri, endpoint):
7676
self._root_uri = root_uri
@@ -86,6 +86,9 @@ def __init__(self, root_uri, endpoint):
8686
def _rope_project_builder(self, rope_config):
8787
from rope.base.project import Project
8888

89+
if self.PRELOADED_MODULES is None:
90+
self.__class__.PRELOADED_MODULES = get_preferred_submodules()
91+
8992
# TODO: we could keep track of dirty files and validate only those
9093
if self.__rope is None or self.__rope_config != rope_config:
9194
rope_folder = rope_config.get('ropeFolder')

0 commit comments

Comments
 (0)