The open source coding agent.
TypeScript
Add support for LSP workspace/didChangeWatchedFiles (#6524)
Marcel de Vriesf3db96631704
diff --git a/packages/opencode/src/lsp/client.ts b/packages/opencode/src/lsp/client.tsindex 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 + 1files[input.path] = nextlog.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", {