File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change 1616UNRES_RE = re .compile (r"Unresolved import '(?P<unresolved>[\w.]+)'" )
1717UNREF_RE = re .compile (r"Unreferenced import '(?P<unreferenced>[\w.]+)'" )
1818
19- _index_cache = None
19+ _index_cache = {}
2020
2121
2222def _build_index (paths ):
@@ -30,23 +30,23 @@ def _build_index(paths):
3030
3131
3232def _cache_index_callback (future ):
33- global _index_cache
3433 # Cache the index
35- _index_cache = future .result ()
34+ _index_cache [ 'default' ] = future .result ()
3635
3736
3837def _get_index ():
3938 """Get the cached index if built and index project files on each call.
4039 Return an empty index if not built yet.
4140 """
4241 # Index haven't been built yet
43- if _index_cache is None :
42+ index = _index_cache .get ('default' )
43+ if index is None :
4444 return importmagic .SymbolIndex ()
4545
4646 # Index project files
4747 # TODO(youben) index project files
48- #index.build_index(paths=[])
49- return _index_cache
48+ # index.build_index(paths=[])
49+ return _index_cache [ 'default' ]
5050
5151
5252def _get_imports_list (source , index = None ):
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ def test_importmagic_actions(config):
4242 try :
4343 importmagic_lint .pyls_initialize ()
4444 name , doc = temp_document (DOC )
45- while importmagic_lint ._index_cache is None :
45+ while importmagic_lint ._index_cache [ 'default' ] is None :
4646 # wait for the index to be ready
4747 sleep (1 )
4848 actions = importmagic_lint .pyls_code_actions (config , doc )
You can’t perform that action at this time.
0 commit comments