File tree 2 files changed +7
-7
lines changed
2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change 16
16
UNRES_RE = re .compile (r"Unresolved import '(?P<unresolved>[\w.]+)'" )
17
17
UNREF_RE = re .compile (r"Unreferenced import '(?P<unreferenced>[\w.]+)'" )
18
18
19
- _index_cache = None
19
+ _index_cache = {}
20
20
21
21
22
22
def _build_index (paths ):
@@ -30,23 +30,23 @@ def _build_index(paths):
30
30
31
31
32
32
def _cache_index_callback (future ):
33
- global _index_cache
34
33
# Cache the index
35
- _index_cache = future .result ()
34
+ _index_cache [ 'default' ] = future .result ()
36
35
37
36
38
37
def _get_index ():
39
38
"""Get the cached index if built and index project files on each call.
40
39
Return an empty index if not built yet.
41
40
"""
42
41
# Index haven't been built yet
43
- if _index_cache is None :
42
+ index = _index_cache .get ('default' )
43
+ if index is None :
44
44
return importmagic .SymbolIndex ()
45
45
46
46
# Index project files
47
47
# TODO(youben) index project files
48
- #index.build_index(paths=[])
49
- return _index_cache
48
+ # index.build_index(paths=[])
49
+ return _index_cache [ 'default' ]
50
50
51
51
52
52
def _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):
42
42
try :
43
43
importmagic_lint .pyls_initialize ()
44
44
name , doc = temp_document (DOC )
45
- while importmagic_lint ._index_cache is None :
45
+ while importmagic_lint ._index_cache . get ( 'default' ) is None :
46
46
# wait for the index to be ready
47
47
sleep (1 )
48
48
actions = importmagic_lint .pyls_code_actions (config , doc )
You can’t perform that action at this time.
0 commit comments