Skip to content

Commit be7fe73

Browse files
committed
did_open/close events are now raised from lsp request
1 parent 8947f40 commit be7fe73

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

robotcode/language_server/common/parts/documents.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,13 @@ async def _text_document_did_open(self, text_document: TextDocumentItem, *args:
114114
document = self._create_document(text_document)
115115

116116
self._documents[uri] = document
117-
await self.did_open(self, document)
118117
else:
119118
await document.apply_full_change(text_document.version, text_document.text)
120119

121120
document.references.add(self)
122121

122+
await self.did_open(self, document)
123+
123124
@rpc_method(name="textDocument/didClose", param_type=DidCloseTextDocumentParams)
124125
@_logger.call
125126
async def _text_document_did_close(self, text_document: TextDocumentIdentifier, *args: Any, **kwargs: Any) -> None:
@@ -129,14 +130,13 @@ async def _text_document_did_close(self, text_document: TextDocumentIdentifier,
129130
if document is not None:
130131
document.references.remove(self)
131132

133+
await self.did_close(self, document)
132134
await self.close_document(document)
133135

134136
async def close_document(self, document: TextDocument) -> None:
135137
if len(document.references) == 0:
136138
self._documents.pop(str(document.uri), None)
137139

138-
await self.did_close(self, document)
139-
140140
await document.clear()
141141
del document
142142
else:

robotcode/language_server/robotframework/parts/diagnostics.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ def __init__(self, parent: RobotLanguageServerProtocol) -> None:
3030

3131
parent.diagnostics.collect.add(self.collect_namespace_diagnostics)
3232

33+
parent.documents.did_open.add(self.namespace_invalidated)
3334
parent.documents_cache.namespace_invalidated.add(self.namespace_invalidated)
3435

3536
async def namespace_invalidated(self, sender: Any, document: TextDocument) -> None:

0 commit comments

Comments
 (0)