Microsoft/vscode
GitHub で見るCode action request from problems view includes additional diagnostics
Open
#161,331 opened on 2022年9月20日
bugeditor-code-actionserror-listhelp wanted
Repository metrics
- Stars
- (74,848 stars)
- PR merge metrics
- (平均マージ 11h 43m) (30d で 1,000 merged PRs)
説明
Does this issue occur when all extensions are disabled?: No
- VS Code Version: 1.71.1
- OS Version: macOS Monterey version 12.6
Steps to Reproduce:
- Have a project that has multiple diagnostics for the same range and where each diagnostic has a suggested fix.
- Open the problems view and hover over one of the diagnostics to get the code actions for that diagnostic.
I would expect to see the code action just for that diagnostic, not all diagnostics in the same range. The LSP textDocument/codeAction request includes all of the diagnostics in that range as the context for the codeAction request, not just the selected one in the problems view.
For example, the two diagnostics below have the same line. Getting the quick fixes for one diagnostic, will send a request with both diagnostics included in the context:
Params: {"textDocument":{"uri":"file:///Users/suzmue/govulncheck-study/module5/go.mod"},"range":{"start":{"line":5,"character":1},"end":{"line":5,"character":32}},"context":{"diagnostics":[{"range":{"start":{"line":5,"character":1},"end":{"line":5,"character":32}},"message":"github.com/tidwall/gjson can be upgraded","severity":3,"source":"upgrade available"},{"range":{"start":{"line":5,"character":1},"end":{"line":5,"character":32}},"message":"Vulnerability found:\nA maliciously crafted path can cause Get and other query functions\nto consume excessive amounts of CPU and time.","code":"GO-2021-0265","codeDescription":{"href":"https://pkg.go.dev/vuln/GO-2021-0265"},"severity":2,"source":"vulncheck"}],"triggerKind":2}}
