Summary: | Deno LSP works but doesn't highlight errors | ||
---|---|---|---|
Product: | [Applications] kate | Reporter: | witold |
Component: | application | Assignee: | KWrite Developers <kwrite-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | waqar.17a, witold |
Priority: | NOR | ||
Version First Reported In: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Microsoft Windows | ||
OS: | Microsoft Windows | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: |
Screenshot
LSP debug output cant_reproduce |
Kate: 25.11.70 KDE Frameworks: 6.17.0 Qt: Using 6.9.1 and built against 6.9.1 Windows 11 Version 24H2 Build ABI: x86_64-little_endian-llp64 Kernel: winnt 10.0.26100 can you collect some logs from deno lsp? status change (In reply to Waqar Ahmed from comment #2) > can you collect some logs from deno lsp? This is lsp log for main.ts file with just "aaa" (which gives "Cannot find name 'aaa'" in Diagnostics tab but do not any error highlighting in the editor): [18:13:22  LSP Server Log] typescript@C:/Users/admin/test_project TRACE RS - deno_tower_lsp::codec:157 - <- { "jsonrpc": "2.0", "method": "textDocument/didChange", "params": { "contentChanges": [ { "text": "aaa" } ], "textDocument": { "uri": "file:///C:/Users/admin/test_project/main.ts", "version": 29 } } } [18:13:22  LSP Server Log] typescript@C:/Users/admin/test_project TRACE RS - deno_tower_lsp::codec:157 - <- { "id": 33, "jsonrpc": "2.0", "method": "textDocument/documentSymbol", "params": { "textDocument": { "uri": "file:///C:/Users/admin/test_project/main.ts" } } } DEBUG RS - deno_resolver::workspace:931 - Workspace config generated this import map { "imports": { "@std/assert": "jsr:@std/assert@1", "@std/assert/": "jsr:/@std/assert@1/" } } DEBUG RS - deno_resolver::workspace:931 - Workspace config generated this import map { "imports": { "@std/assert": "jsr:@std/assert@1", "@std/assert/": "jsr:/@std/assert@1/" } } DEBUG RS - deno_resolver::workspace:931 - Workspace config generated this import map { "imports": { "@std/assert": "jsr:@std/assert@1", "@std/assert/": "jsr:/@std/assert@1/" } } DEBUG RS - deno_lint::performance_mark:30 - Linter::collect_diagnostics took 25µs DEBUG RS - deno_lint::performance_mark:30 - Linter::lint_inner took 135.1µs DEBUG RS - deno_lint::performance_mark:30 - Linter::lint_with_ast took 145.6µs [18:13:22  LSP Server Log] typescript@C:/Users/admin/test_project TRACE RS - deno_tower_lsp::codec:117 - -> {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///c%3A/Users/admin/test_project/main.ts","diagnostics":[{"range":{"start":{"line":0,"character":0},"end":{"line":0,"character":3}},"severity":1,"code":2304,"source":"deno-ts","message":"Cannot find name 'aaa'."}],"version":29}} TRACE RS - deno_tower_lsp::codec:117 - -> {"jsonrpc":"2.0","result":null,"id":33} [18:13:23  LSP Server Log] typescript@C:/Users/admin/test_project TRACE RS - deno_tower_lsp::codec:157 - <- { "id": 34, "jsonrpc": "2.0", "method": "textDocument/semanticTokens/range", "params": { "range": { "end": { "character": 3, "line": 0 }, "start": { "character": 0, "line": 0 } }, "textDocument": { "uri": "file:///C:/Users/admin/test_project/main.ts" } } } [18:13:23  LSP Server Log] typescript@C:/Users/admin/test_project DEBUG RS - deno_resolver::workspace:931 - Workspace config generated this import map { "imports": { "@std/assert": "jsr:@std/assert@1", "@std/assert/": "jsr:/@std/assert@1/" } } TRACE RS - deno_tower_lsp::codec:117 - -> {"jsonrpc":"2.0","result":null,"id":34} [18:13:41  LSP Server Log] typescript@C:/Users/admin/test_project TRACE RS - hyper_util::client::legacy::pool:799 - idle interval checking for expired TRACE RS - hyper_util::client::legacy::pool:492 - idle interval evicting expired for ("https", dl.deno.land) TRACE RS - h2::proto::connection:268 - connection.state=Open TRACE RS - h2::codec::framed_write:210 - FramedWrite::buffer; frame=GoAway { error_code: NO_ERROR, last_stream_id: StreamId(0) } DEBUG RS - h2::codec::framed_write:213 - send frame=GoAway { error_code: NO_ERROR, last_stream_id: StreamId(0) } TRACE RS - h2::frame::go_away:60 - encoding GO_AWAY; code=NO_ERROR [18:13:41  LSP Server Log] typescript@C:/Users/admin/test_project TRACE RS - h2::codec::framed_write:266 - encoded go_away rem=17 DEBUG RS - h2::proto::connection:435 - Connection::poll; connection error error=GoAway(b"", NO_ERROR, Library) TRACE RS - h2::proto::connection:444 - -> already going away TRACE RS - h2::proto::connection:268 - connection.state=Closing(NO_ERROR, Library) TRACE RS - h2::proto::connection:297 - connection closing after flush TRACE RS - h2::codec::framed_write:143 - queued_data_frame=false TRACE RS - h2::codec::framed_write:159 - flushing buffer TRACE RS - h2::proto::connection:268 - connection.state=Closed(NO_ERROR, Library) TRACE RS - h2::proto::streams::streams:854 - Streams::recv_eof Created attachment 185370 [details]
LSP debug output
I figured out how to extend the output buffer so I'm attaching the full LSP log of this behavior.
This looks good:
> {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///c%3A/Users/admin/test_project/main.ts","diagnostics":[{"range":{"start":{"line":0,"character":0},"end":{"line":0,"character":3}},"severity":1,"code":2304,"source":"deno-ts","message":"Cannot find name 'aaa'."}],"version":29}}
So the server seems to be okay. Does Kate print any warnings on the terminal?
I would have suggested changing color themes, but seems like python lsp is working for you.
Created attachment 185385 [details]
cant_reproduce
Can't reproduce with a newly set up deno project.
Used the following config for the lsp:
"javascript": {
"command": ["deno", "lsp"],
"rootIndicationFileNames": ["deno.json"],
"highlightingModeRegex": "^JavaScript$"
},
"typescript": {
"use": "javascript",
"highlightingModeRegex": "^TypeScript$"
},
Thank you very much for checking. It doesn't work for me on two different systems (both Windows). I'll investigate this from the OS side. Just confirm you tested it on Linux, right? OK, I see from the screenshot that you tested on Linux. This must be some subtle issue with Deno LSP. I've tested various older versions of Deno, and version 2.2.0, for example, works fine. It doesn't help that Windows isn't the primary platform for both Deno and Kate. Here's an example report from three days ago that Deno LSP stopped working in JetBrain IDE on Windows: https://github.com/denoland/deno/issues/30859. Thanks again for your help, it did help us come to some sort of conclusion :) I'll post an update here if the problem resolves itself in the future (I assume so). > Just confirm you tested it on Linux, right? Yes. And I installed deno lsp using the shell helper they provide on their website. Looking at the logs again, there is: > "uri": "file:///C:/Users/admin/test_project/main.ts" and when sending diagnostics its percent encoded: > {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///c%3A/Users/admin/test_project/main.ts","diagnostics":[{"range":{"start":{"line":0,"character":0},"end":{"line":0,"character":3}},"severity":1,"code":2304,"source":"deno-ts","message":"Cannot find name 'aaa'."}],"version":29}} Is it possible for you to compare the log of working deno lsp and not working deno lsp? In the version that works, all URIs are encoded like this: "file:///C:/Users/admin/test_project/test.ts" e.g.: TRACE RS - deno_tower_lsp::codec:141 - -> {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///C:/Users/admin/test_project/test.ts","diagnostics":[{"range":{"start":{"line":0,"character":0},"end":{"line":0,"character":3}},"severity":1,"code":2304,"source":"deno-ts","message":"Cannot find name 'aaa'."}],"version":2}} In the new version, which doesn't work, it changed to "file:///c%3A/Users/admin/test_project/test.ts" e.g.: TRACE RS - deno_tower_lsp::codec:117 - -> {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///c%3A/Users/admin/test_project/test.ts","diagnostics" :[{"range":{"start":{"line":0,"character":0},"end":{"line":0,"character":3}},"severity":1,"code":2304,"source":"deno-ts","message":"Cannot find name 'aaa'."}],"version":2}} And this stopped working since Deno version 2.2.7, which had this change: "fix(lsp): url_to_uri() encoding on windows" (https://github.com/denoland/deno/pull/28737). After reviewing the LSP documentation (https://microsoft.github.io/language-server-protocol/specifications/specification-3-14/) and rfc3986, it appears this is a bug on Deno's end. However, VS Code and many others seem to handle this. |
Created attachment 184688 [details] Screenshot SUMMARY Deno LSP works (Diagnostics tab display errors and warnings from LSP) but errors are not highlighted in the editor. STEPS TO REPRODUCE 1. Install Deno executable 2. Configure Deno LSP: "lspclient": { "servers": { "javascript": { "command": ["deno", "lsp", "-L", "info"], "rootIndicationFileNames": ["deno.json"], "highlightingModeRegex": "^JavaScript.*$" } } } OBSERVED RESULT See summary and the attached screenshot. EXPECTED RESULT Errors reported by LSP shoud be highlighted in the editor. For example this works for LSP Python. SOFTWARE/OS VERSIONS Windows: Windows 11 ADDITIONAL INFORMATION I use latest Kate version (nightly).