Skip to content

Commit fb6c758

Browse files
committed
feat(lsp): clear hints on refresh
1 parent 9e5bf54 commit fb6c758

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

sqlmesh/lsp/main.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ def _create_lsp_context(self, paths: t.List[Path]) -> t.Optional[LSPContext]:
100100
context = self.context_class(paths=paths)
101101
lsp_context = LSPContext(context)
102102
self.lsp_context = lsp_context
103+
104+
# Clear inlay hints by requesting a refresh from the client
105+
self.server.send_notification(types.WORKSPACE_INLAY_HINT_REFRESH)
106+
103107
return lsp_context
104108
except Exception as e:
105109
self.server.log_trace(f"Error creating context: {e}")
@@ -694,15 +698,15 @@ def _ensure_context_for_document(
694698
for a config.py or config.yml file in the parent directories.
695699
"""
696700
if self.lsp_context is not None:
697-
context = self.lsp_context
698-
context.context.load() # Reload or refresh context
699-
self.lsp_context = LSPContext(context.context)
700-
return
701+
# If we already have a context, refresh it
702+
paths = list(self.lsp_context.context.configs)
703+
self._create_lsp_context(paths)
704+
return None
701705

702706
# No context yet: try to find config and load it
703707
path = document_uri.to_path()
704708
if path.suffix not in (".sql", ".py"):
705-
return
709+
return None
706710

707711
loaded = False
708712
# Ascend directories to look for config

0 commit comments

Comments
 (0)