Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions sqlmesh/lsp/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ def _create_lsp_context(self, paths: t.List[Path]) -> t.Optional[LSPContext]:
context = self.context_class(paths=paths)
lsp_context = LSPContext(context)
self.lsp_context = lsp_context

# Clear inlay hints by requesting a refresh from the client
self.server.send_notification(types.WORKSPACE_INLAY_HINT_REFRESH)

return lsp_context
except Exception as e:
self.server.log_trace(f"Error creating context: {e}")
Expand Down Expand Up @@ -694,15 +698,15 @@ def _ensure_context_for_document(
for a config.py or config.yml file in the parent directories.
"""
if self.lsp_context is not None:
context = self.lsp_context
context.context.load() # Reload or refresh context
self.lsp_context = LSPContext(context.context)
return
# If we already have a context, refresh it
paths = list(self.lsp_context.context.configs)
self._create_lsp_context(paths)
return None

# No context yet: try to find config and load it
path = document_uri.to_path()
if path.suffix not in (".sql", ".py"):
return
return None

loaded = False
# Ascend directories to look for config
Expand Down