diff --git a/packages/opencode/src/lsp/client.ts b/packages/opencode/src/lsp/client.ts index b66bb9933d4..8704b65acb5 100644 --- a/packages/opencode/src/lsp/client.ts +++ b/packages/opencode/src/lsp/client.ts @@ -98,6 +98,9 @@ export namespace LSPClient { }, workspace: { configuration: true, + didChangeWatchedFiles: { + dynamicRegistration: true, + }, }, textDocument: { synchronization: { @@ -151,6 +154,16 @@ export namespace LSPClient { const version = files[input.path] if (version !== undefined) { + log.info("workspace/didChangeWatchedFiles", input) + await connection.sendNotification("workspace/didChangeWatchedFiles", { + changes: [ + { + uri: pathToFileURL(input.path).href, + type: 2, // Changed + }, + ], + }) + const next = version + 1 files[input.path] = next log.info("textDocument/didChange", { @@ -167,6 +180,16 @@ export namespace LSPClient { return } + log.info("workspace/didChangeWatchedFiles", input) + await connection.sendNotification("workspace/didChangeWatchedFiles", { + changes: [ + { + uri: pathToFileURL(input.path).href, + type: 1, // Created + }, + ], + }) + log.info("textDocument/didOpen", input) diagnostics.delete(input.path) await connection.sendNotification("textDocument/didOpen", {