nim-lang / vscode-nim

A VS Code plugin for the Nim language
Other
72 stars 8 forks source link

Frequent "Request textDocument failed." popups #91

Open tomazf1 opened 1 month ago

tomazf1 commented 1 month ago

When I'm editing nim source file in vs code, I'm getting frequent "Request textDocument/codeAction failed.", "Request textDocument/inlayHint failed." or "Request textDocument/documentSymbol failed." popups. This is very annoying.

Versions: OS: linux debian sid nim: 2.0.8 nimlangserver: 1.4.0 vscode-nim: 1.0.2

lewisl commented 3 weeks ago

I have a version of this problem, too.

Versions: OS: macosx 14.6.1 (23G93) nim: 2.0.8 nimlangserver: 1.4.0 vscode-nim: 1.0.2

I can send the problem message, but it is about 2 pages every time it fails. let me know if you need the log.

My config looks like this:

within settings:

 ...
"[nim]": {
      "editor.tabSize": 2,
     "editor.indentSize": 2,
    "editor.autoIndent": "full",
},
"nim.nimprettyIndent": 2,
"nim.nimprettyMaxLineLen": 100,
"nimlangserver.trace.server": "messages",
"nim.buildOnSave": false,
"nim.buildCommand": "c -d:release --mm:orc --opt:speed --outdir:bin",
"nim.lintOnSave": true,
"nim.project": [],
...

Note: I am not using nim.projectMapping because it seems like I shouldn't have to.

Since the problem I have added: "nim.provider": "lsp" -> but this is deprecated with the message "Deprecated. Please use the lsp backend.: But, this appears to be exactly what I am requesting. Note that this setting is still documented and there appears to be no other way to request the lsp. Ah, that is the default so I removed this setting. Note also that I have NOT installed any of the lsp plugins for nim as that appears to be unnecessary and a duplication of what this plugin does. I also removed "nim.project": [] as this is the default and should be unnecessary.

I also set nimlangserver.trace.server to "off", which might just suppress all the nasty messages.

After this I got the status message: Restarting nimsuggest for . This went on forever and it never started.

So, let me know if I have done the setup correctly as there still seems to be a problem.

lsp was supposed to improve the nimsuggest restart problem but it seems to have made it far worse. I never had a problem with Saem's plugin. The new fork seems to be a step in the wrong direction (YMMV)

lewisl commented 3 weeks ago

I think restarting vs code after all of the above changes may have solved the problem.

New problem nimsuggest is finding problems with: math.nim typedthreads.nim gc.nim

Nothing I can do about this...

ursetto commented 3 weeks ago

I'm getting this too, along with duplicated errors (i.e. each error message in "Problems" occurs twice). The only difference between the errors is one shows nim(nimsuggest chk) and the other does not show this.

I solved this by turning on "Use Nimsuggest Check", causing only the nim(nimsuggest chk) error variant to show up. I'm not sure what this does, or if this is a bug where both variants are accidentally enabled when this box is not checked, but it stops the problem for me.

edit: It did not solve the popup problem. The errors are no longer duplicated, but it's still crashing most (but not all) of the time with

[Error - 12:40:02 AM] Request textDocument/codeAction failed.
  Message: textDocument/codeAction raised an exception: Server crashed/socket closed.
  Code: -32000 

nimlangserver: 1.4.0 nim: 2.0.8 OS: macOS Sonoma 14.4.1

lewisl commented 3 weeks ago

I am going back to nimsaem's plugin: it works. Until this gets resolved.

Or can I not use the lsp at all and just use the nimsuggest that the compiler provides?