Skip to content
Merged
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
4 changes: 2 additions & 2 deletions sqlmesh/lsp/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,7 @@ def _ensure_context_in_folder(self, folder_path: t.Optional[Path] = None) -> Non
config_path = workspace_folder / f"config.{ext}"
if config_path.exists():
if self._create_lsp_context([workspace_folder]):
loaded_sqlmesh_message(self.server)
return

# Then , check the provided folder recursively
Expand All @@ -835,6 +836,7 @@ def _ensure_context_in_folder(self, folder_path: t.Optional[Path] = None) -> Non
config_path = path / f"config.{ext}"
if config_path.exists():
if self._create_lsp_context([path]):
loaded_sqlmesh_message(self.server)
return

path = path.parent
Expand All @@ -860,15 +862,13 @@ def _create_lsp_context(self, paths: t.List[Path]) -> t.Optional[LSPContext]:
try:
if isinstance(self.context_state, NoContext):
context = self.context_class(paths=paths)
loaded_sqlmesh_message(self.server)
elif isinstance(self.context_state, ContextFailed):
if self.context_state.context:
context = self.context_state.context
context.load()
else:
# If there's no context (initial creation failed), try creating again
context = self.context_class(paths=paths)
loaded_sqlmesh_message(self.server)
else:
context = self.context_state.lsp_context.context
context.load()
Expand Down