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:
2828
2929 parent .code_lens .collect .add (self .collect )
3030 parent .code_lens .resolve .add (self .resolve )
31+ parent .robot_references .cache_cleared .add (self .robot_references_cache_cleared )
3132
3233 self ._running_task : Set [Tuple [TextDocument , KeywordDoc ]] = set ()
3334
35+ async def robot_references_cache_cleared (self , sender : Any ) -> None : # NOSONAR
36+ await self .parent .code_lens .refresh ()
37+
3438 @language_id ("robotframework" )
3539 @threaded ()
3640 async def collect (self , sender : Any , document : TextDocument ) -> Optional [List [CodeLens ]]:
Original file line number Diff line number Diff line change 1515)
1616
1717from ....utils .async_cache import AsyncSimpleLRUCache
18- from ....utils .async_tools import threaded
18+ from ....utils .async_tools import async_tasking_event , threaded
1919from ....utils .logging import LoggingDescriptor
2020from ....utils .uri import Uri
2121from ...common .decorators import language_id
@@ -48,9 +48,17 @@ def __init__(self, parent: RobotLanguageServerProtocol) -> None:
4848 super ().__init__ (parent )
4949
5050 parent .references .collect .add (self .collect )
51-
51+ parent . documents . did_change . add ( self . document_did_change )
5252 self ._keyword_reference_cache = AsyncSimpleLRUCache (max_items = 128 )
5353
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+
5462 def _find_method (self , cls : Type [Any ]) -> Optional [_ReferencesMethod ]:
5563 if cls is ast .AST :
5664 return None
You can’t perform that action at this time.
0 commit comments