File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
robotcode/language_server/robotframework/parts Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -28,9 +28,13 @@ def __init__(self, parent: RobotLanguageServerProtocol) -> None:
28
28
29
29
parent .code_lens .collect .add (self .collect )
30
30
parent .code_lens .resolve .add (self .resolve )
31
+ parent .robot_references .cache_cleared .add (self .robot_references_cache_cleared )
31
32
32
33
self ._running_task : Set [Tuple [TextDocument , KeywordDoc ]] = set ()
33
34
35
+ async def robot_references_cache_cleared (self , sender : Any ) -> None : # NOSONAR
36
+ await self .parent .code_lens .refresh ()
37
+
34
38
@language_id ("robotframework" )
35
39
@threaded ()
36
40
async def collect (self , sender : Any , document : TextDocument ) -> Optional [List [CodeLens ]]:
Original file line number Diff line number Diff line change 15
15
)
16
16
17
17
from ....utils .async_cache import AsyncSimpleLRUCache
18
- from ....utils .async_tools import threaded
18
+ from ....utils .async_tools import async_tasking_event , threaded
19
19
from ....utils .logging import LoggingDescriptor
20
20
from ....utils .uri import Uri
21
21
from ...common .decorators import language_id
@@ -48,9 +48,17 @@ def __init__(self, parent: RobotLanguageServerProtocol) -> None:
48
48
super ().__init__ (parent )
49
49
50
50
parent .references .collect .add (self .collect )
51
-
51
+ parent . documents . did_change . add ( self . document_did_change )
52
52
self ._keyword_reference_cache = AsyncSimpleLRUCache (max_items = 128 )
53
53
54
+ @async_tasking_event
55
+ async def cache_cleared (sender ) -> None : # NOSONAR
56
+ ...
57
+
58
+ async def document_did_change (self , sender : Any , document : TextDocument ) -> None :
59
+ await self ._keyword_reference_cache .clear ()
60
+ await self .cache_cleared (self )
61
+
54
62
def _find_method (self , cls : Type [Any ]) -> Optional [_ReferencesMethod ]:
55
63
if cls is ast .AST :
56
64
return None
You can’t perform that action at this time.
0 commit comments