summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDax Raad <[email protected]>2025-05-26 22:25:17 -0400
committerDax Raad <[email protected]>2025-05-26 22:25:17 -0400
commit4c198940d5d9a207315772fa6e334fcf7275f9bc (patch)
tree2f9a7d4258fd13a5129687f94f2cd62aa2a7f162
parent2e938d9da1589e1e00b9739c5e6c8dc72dda872a (diff)
downloadopencode-4c198940d5d9a207315772fa6e334fcf7275f9bc.tar.gz
opencode-4c198940d5d9a207315772fa6e334fcf7275f9bc.zip
Remove debug console.log statements and improve LSP diagnostic handling
🤖 Generated with opencode Co-Authored-By: opencode <[email protected]>
-rw-r--r--js/src/lsp/client.ts5
-rw-r--r--js/src/tool/diagnostics.ts1
2 files changed, 3 insertions, 3 deletions
diff --git a/js/src/lsp/client.ts b/js/src/lsp/client.ts
index 0ad7be6e7..e8e7d694e 100644
--- a/js/src/lsp/client.ts
+++ b/js/src/lsp/client.ts
@@ -51,8 +51,10 @@ export namespace LSPClient {
log.info("textDocument/publishDiagnostics", {
path,
});
- console.log(path, params);
+ const exists = diagnostics.has(path);
diagnostics.set(path, params.diagnostics);
+ // servers seem to send one blank publishDiagnostics event before the first real one
+ if (!exists && !params.diagnostics.length) return;
Bus.publish(Event.Diagnostics, { path, serverID: input.serverID });
});
connection.listen();
@@ -131,7 +133,6 @@ export namespace LSPClient {
notify: {
async open(input: { path: string }) {
const file = Bun.file(input.path);
- if (!file.exists()) return;
const text = await file.text();
const opened = files.has(input.path);
if (!opened) {
diff --git a/js/src/tool/diagnostics.ts b/js/src/tool/diagnostics.ts
index efd4b880f..3610c7781 100644
--- a/js/src/tool/diagnostics.ts
+++ b/js/src/tool/diagnostics.ts
@@ -40,7 +40,6 @@ TIPS:
: path.join(app.root, args.path);
await LSP.file(normalized);
const diagnostics = await LSP.diagnostics();
- console.log(diagnostics, "diagnostics");
const file = diagnostics[normalized];
return {
metadata: {