diff --git a/sqlmesh/lsp/main.py b/sqlmesh/lsp/main.py index b02e810997..b9d0213898 100755 --- a/sqlmesh/lsp/main.py +++ b/sqlmesh/lsp/main.py @@ -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 @@ -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 @@ -860,7 +862,6 @@ 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 @@ -868,7 +869,6 @@ def _create_lsp_context(self, paths: t.List[Path]) -> t.Optional[LSPContext]: 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()