zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
47.77k stars 2.79k forks source link

Occasional undefined error when formatting a TypeScript file #11189

Open micthiesen opened 5 months ago

micthiesen commented 5 months ago

Check for existing issues

Describe the bug / provide steps to reproduce it

When saving a file the following error is logged but only sometimes (error seems intermittent):

Request textDocument/codeAction failed with message: Cannot read properties of undefined (reading 'disableRuleComment')

And formatting doesn't happen.

These are my TS-specific settings, but I've had different settings too and it still happens:

    "TypeScript": {
      "formatter": "prettier",
      "code_actions_on_format": {
        "source.organizeImports": true,
        "source.fixAll.eslint": true
      }
    },

Environment

Zed: v0.132.4 (Zed) OS: macOS 14.1.2 Memory: 32 GiB Architecture: aarch64

"typescript": "^5.3.3",
"prettier": "^3.1.1",
"eslint": "^8.56.0",

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

2024-04-29T13:26:43-07:00 [WARN] Generic lsp request to node failed: Request textDocument/codeAction failed with message: Cannot read properties of undefined (reading 'disableRuleComment')
2024-04-29T13:26:43-07:00 [ERROR] crates/project/src/project.rs:6892: Request textDocument/codeAction failed with message: Cannot read properties of undefined (reading 'disableRuleComment')
micthiesen commented 5 months ago

I think maybe this is because I'm using a version of ESLint that's <9? Unfortunately I can't update it as some other packages don't support newer versions of ESLint.

chrisvariety commented 5 months ago

I'm seeing this as well. Reverting back to Zed 0.130.7 resolves, so I think this was introduced in v0.131.6 if that's helpful.

choco-green commented 5 months ago

Getting a difference on a different line number on editor.rs 2024-05-01T19:48:00+01:00 [WARN] Generic lsp request to node failed: Request textDocument/codeAction failed with message: Cannot read properties of undefined (reading 'disableRuleComment') 2024-05-01T19:48:00+01:00 [ERROR] crates/editor/src/editor.rs:8417: Request textDocument/codeAction failed with message: Cannot read properties of undefined (reading 'disableRuleComment') 2024-05-01T19:48:07+01:00 [WARN] Generic lsp request to node failed: Request textDocument/codeAction failed with message: Cannot read properties of undefined (reading 'disableRuleComment') 2024-05-01T19:48:07+01:00 [ERROR] crates/editor/src/editor.rs:8417: Request textDocument/codeAction failed with message: Cannot read properties of undefined (reading 'disableRuleComment')

Maybe due to update? Zed: v0.133.5 (Zed) OS: macOS 14.5.0 Memory: 64 GiB Architecture: aarch64

chrisvariety commented 4 months ago

Looks like this is resolved by #11896, confirmed in v0.137.0-pre.