summaryrefslogtreecommitdiffhomepage
path: root/internal/lsp/watcher
diff options
context:
space:
mode:
authorKujtim Hoxha <[email protected]>2025-04-28 19:37:42 +0200
committerKujtim Hoxha <[email protected]>2025-04-28 19:37:42 +0200
commit294113741641cb7f6fe5c9aa114328b5bf8814ec (patch)
treeaf63e160a9606953bd886cdc5bd78d9ce2e98c80 /internal/lsp/watcher
parentb3c0285db3dd5d5140481bf5118812e8dbc89795 (diff)
downloadopencode-294113741641cb7f6fe5c9aa114328b5bf8814ec.tar.gz
opencode-294113741641cb7f6fe5c9aa114328b5bf8814ec.zip
fix diagnostics for deleted files
Diffstat (limited to 'internal/lsp/watcher')
-rw-r--r--internal/lsp/watcher/watcher.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/internal/lsp/watcher/watcher.go b/internal/lsp/watcher/watcher.go
index 69d341212..fd7e04837 100644
--- a/internal/lsp/watcher/watcher.go
+++ b/internal/lsp/watcher/watcher.go
@@ -643,7 +643,9 @@ func (w *WorkspaceWatcher) debounceHandleFileEvent(ctx context.Context, uri stri
func (w *WorkspaceWatcher) handleFileEvent(ctx context.Context, uri string, changeType protocol.FileChangeType) {
// If the file is open and it's a change event, use didChange notification
filePath := uri[7:] // Remove "file://" prefix
- if changeType == protocol.FileChangeType(protocol.Changed) && w.client.IsFileOpen(filePath) {
+ if changeType == protocol.FileChangeType(protocol.Deleted) {
+ w.client.ClearDiagnosticsForURI(protocol.DocumentUri(uri))
+ } else if changeType == protocol.FileChangeType(protocol.Changed) && w.client.IsFileOpen(filePath) {
err := w.client.NotifyChange(ctx, filePath)
if err != nil {
logging.Error("Error notifying change", "error", err)