nix-community / vscode-nix-ide

Nix language support for VSCode editor [maintainer: @jnoortheen]
https://marketplace.visualstudio.com/items?itemName=jnoortheen.nix-ide
MIT License
310 stars 23 forks source link

Frequently getting `Request textDocument/documentSymbol failed` #387

Closed musjj closed 2 months ago

musjj commented 7 months ago

I'm frequently getting this error while typing. Not really sure why.

[Error - 8:49:21 PM] Request textDocument/documentSymbol failed.
Error: name must not be falsy
    at d.validate (/nix/store/s7accqb6id4p71p56mr5hb4vay0cnj1c-vscode-1.88.1/lib/vscode/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:150:17471)
    at new d (/nix/store/s7accqb6id4p71p56mr5hb4vay0cnj1c-vscode-1.88.1/lib/vscode/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:150:17766)
    at Qt (/nix/store/qqgl0yg1c5j0dawqm3xzzvjg72bl5c6q-vscode-extension-jnoortheen-nix-ide-0.3.1/share/vscode/extensions/jnoortheen.nix-ide/dist/extension.js:35:72226)
    at Qt (/nix/store/qqgl0yg1c5j0dawqm3xzzvjg72bl5c6q-vscode-extension-jnoortheen-nix-ide-0.3.1/share/vscode/extensions/jnoortheen.nix-ide/dist/extension.js:35:72403)
    at Qt (/nix/store/qqgl0yg1c5j0dawqm3xzzvjg72bl5c6q-vscode-extension-jnoortheen-nix-ide-0.3.1/share/vscode/extensions/jnoortheen.nix-ide/dist/extension.js:35:72403)
    at Qt (/nix/store/qqgl0yg1c5j0dawqm3xzzvjg72bl5c6q-vscode-extension-jnoortheen-nix-ide-0.3.1/share/vscode/extensions/jnoortheen.nix-ide/dist/extension.js:35:72403)
    at Qt (/nix/store/qqgl0yg1c5j0dawqm3xzzvjg72bl5c6q-vscode-extension-jnoortheen-nix-ide-0.3.1/share/vscode/extensions/jnoortheen.nix-ide/dist/extension.js:35:72403)
    at o (/nix/store/qqgl0yg1c5j0dawqm3xzzvjg72bl5c6q-vscode-extension-jnoortheen-nix-ide-0.3.1/share/vscode/extensions/jnoortheen.nix-ide/dist/extension.js:35:46654)
    at Object.GC [as map] (/nix/store/qqgl0yg1c5j0dawqm3xzzvjg72bl5c6q-vscode-extension-jnoortheen-nix-ide-0.3.1/share/vscode/extensions/jnoortheen.nix-ide/dist/extension.js:35:46740)
    at Object.Bn [as asDocumentSymbols] (/nix/store/qqgl0yg1c5j0dawqm3xzzvjg72bl5c6q-vscode-extension-jnoortheen-nix-ide-0.3.1/share/vscode/extensions/jnoortheen.nix-ide/dist/extension.js:35:72193)
    at u (/nix/store/qqgl0yg1c5j0dawqm3xzzvjg72bl5c6q-vscode-extension-jnoortheen-nix-ide-0.3.1/share/vscode/extensions/jnoortheen.nix-ide/dist/extension.js:39:56050)
    at async d.provideDocumentSymbols (/nix/store/s7accqb6id4p71p56mr5hb4vay0cnj1c-vscode-1.88.1/lib/vscode/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:152:90504)
sofiedotcafe commented 7 months ago

Same

I get these only with the nil language server, not with nixd

nklsfrt commented 6 months ago

I also get these regularly using the nil language server.

ToasterUwU commented 6 months ago

Same here, using this with nil and getting that error a lot. Formatting straight up never works for me, but the error popup is not always there.

TuggyNE commented 3 months ago

It's especially frustrating since somehow or other the extension is bypassing VS Code's do not disturb mechanisms to suppress notifications. I had to uninstall because I can't stand a wrong and pointless error message popping up every five minutes.

Zocker1999NET commented 3 months ago

It's especially frustrating since somehow or other the extension is bypassing VS Code's do not disturb mechanism

According to this this is not special to this extension but all error notifications in VSCode by-pass do-not-disturb.

I had to uninstall because I can't stand a wrong and pointless error message popping up every five minutes.

I happen to have it now on every tenth keystroke :grimacing: (at least on new files, probably it was never in a compile-able state yet).

ian-h-chamberlain commented 2 months ago

I've also seen this a lot using nixd:

2024-09-07 21:32:41.015 [error] [jnoortheen.nix-ide] provider FAILED
2024-09-07 21:32:41.015 [error] Error: unknown node type for definition
    at rn (/Users/ianchamberlain/.vscode/extensions/jnoortheen.nix-ide-0.3.3/dist/extension.js:6:228)
    at yn (/Users/ianchamberlain/.vscode/extensions/jnoortheen.nix-ide-0.3.3/dist/extension.js:5:6240)
    at kn (/Users/ianchamberlain/.vscode/extensions/jnoortheen.nix-ide-0.3.3/dist/extension.js:5:6363)
    at Immediate.<anonymous> (/Users/ianchamberlain/.vscode/extensions/jnoortheen.nix-ide-0.3.3/dist/extension.js:5:6130)
    at process.processImmediate (node:internal/timers:478:21)

It seems like given that both nixd and nil seem prone to failed requests, maybe it would make sense to install a middleware that catches errors (or a certain subset of errors) and swallows them (or make it configurable which types of errors can be swallowed, or something, idk)?

See also https://github.com/microsoft/vscode-languageserver-node/issues/517 which is a really old issue about how this was handled in the client.

I guess longer-term it would be better to fix the language server implementations, but since this is a common problem for multiple implementations a short-term workaround on the client might make sense...

Brawl345 commented 2 months ago

Also getting this very often with nixd:

  ERR unknown node type for definition: Error: unknown node type for definition
    at handleResponse (/Users/abc/.vscode/extensions/jnoortheen.nix-ide-0.3.3/node_modules/vscode-jsonrpc/lib/common/connection.js:565:48)
    at handleMessage (/Users/abc/.vscode/extensions/jnoortheen.nix-ide-0.3.3/node_modules/vscode-jsonrpc/lib/common/connection.js:345:13)
    at processMessageQueue (/Users/abc/.vscode/extensions/jnoortheen.nix-ide-0.3.3/node_modules/vscode-jsonrpc/lib/common/connection.js:362:17)
    at Immediate.<anonymous> (/Users/abc/.vscode/extensions/jnoortheen.nix-ide-0.3.3/node_modules/vscode-jsonrpc/lib/common/connection.js:334:13)
    at processImmediate (node:internal/timers:478:21)
    at process.topLevelDomainCallback (node:domain:160:15)
    at process.callbackTrampoline (node:internal/async_hooks:128:24)
jnoortheen commented 2 months ago

Closing this with reference to #417

eclairevoyant commented 2 months ago

Is it really a fix? Why is the error happening so frequently in the first place?

jnoortheen commented 2 months ago

It is a workaround. The real fix has to come from the language servers.