denoland / vscode_deno

Visual Studio Code plugin for Deno
https://marketplace.visualstudio.com/items?itemName=denoland.vscode-deno
MIT License
1.5k stars 146 forks source link

Getting error: Request textDocument/codeAction failed. #1196

Closed dgreensp closed 1 month ago

dgreensp commented 1 month ago

Describe the bug

I frequently get an error pop-up while writing Deno in VS Code, for example when pressing Command-Period, but also at other times (I think). It says: "Request textDocument/codeAction failed." This prevents any code actions from working.

If I look in the Deno LSP output, I see a bunch of these:

Unable to convert fix: Missing capture.
[Error - 6:57:00 AM] Request textDocument/codeAction failed.
  Message: Internal error
  Code: -32603

This error message is not hard to find in the LSP codebase: https://github.com/denoland/deno/blob/cead8af104af693558db07675a423761f174d260/cli/lsp/analysis.rs#L622

It seems that an assumption that the LSP is making when running a regex on a code action is not holding.

To Reproduce

I don't know steps for someone to reproduce it, but if there's some way to get debugging information about what's happening (like what are the code actions that can't be parsed?) I'd be happy to try it.

Expected behavior

No error pop-up, code actions work.

Versions

vscode: 1.94.0 deno: 2.0.2 extension: v3.42.0

dgreensp commented 1 month ago

Wow, that was fast!! I should have reported this sooner!

Can you give me some context about what is being rewritten here? In case that could lead to some insight and a better fix in the long term.