Skip to content

Commit 079f2a5

Browse files
authored
chore(vscode): reload project on save (#4602)
1 parent 9a1ee1f commit 079f2a5

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

sqlmesh/lsp/main.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,17 @@ 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+
try:
206+
new_context = Context(paths=list(self.lsp_context.context.configs))
207+
new_full_context = LSPContext(new_context)
208+
self.lsp_context = new_full_context
209+
return
210+
except Exception as e:
211+
pass
212+
202213
context = self._context_get_or_load(uri)
203214
models = context.map[uri.to_path()]
204215
if models is None or not isinstance(models, ModelTarget):

0 commit comments

Comments
 (0)