Skip to content

Commit f0d2216

Browse files
committed
chore(vscode): reworking lsp and reloading on save
[ci skip]
1 parent 1da137a commit f0d2216

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

sqlmesh/lsp/main.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,13 @@ def did_change(ls: LanguageServer, params: types.DidChangeTextDocumentParams) ->
199199
@self.server.feature(types.TEXT_DOCUMENT_DID_SAVE)
200200
def did_save(ls: LanguageServer, params: types.DidSaveTextDocumentParams) -> None:
201201
uri = URI(params.text_document.uri)
202+
203+
# Reload the entire context and create a new LSPContext
204+
if self.lsp_context is not None:
205+
old_context = self.lsp_context.context
206+
old_context.load() # Reload the context
207+
self.lsp_context = LSPContext(old_context)
208+
202209
context = self._context_get_or_load(uri)
203210
models = context.map[uri.to_path()]
204211
if models is None or not isinstance(models, ModelTarget):

0 commit comments

Comments
 (0)