microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.46k stars 29.36k forks source link

In problems window, quick fix is shown on the wrong item #164196

Open karthiknadig opened 2 years ago

karthiknadig commented 2 years ago

Type: Bug

When a problem is reported by two separate extensions on the same line. The quick fix for onw of the issue is shown on both the problems, even though the fix itself is not related to the problem reported.

Issues: See line 13 image

The quickfix from the spell check extension is show on the flake8 problem: image

image

VS Code version: Code 1.72.2 (d045a5eda657f4d7b676dedbfa7aab8207f8a075, 2022-10-12T22:15:18.074Z) OS version: Windows_NT x64 10.0.19044 Modes: Sandboxed: No

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz (16 x 2304)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off| |Load (avg)|undefined| |Memory (System)|63.78GB (45.18GB free)| |Process Argv|--folder-uri file:///c%3A/GIT/linters/vscode-pylint --crash-reporter-id 8a06823c-8219-469b-a5be-5ad36c5c7a1c| |Screen Reader|no| |VM|0%|
Extensions (22) Extension|Author (truncated)|Version ---|---|--- tsl-problem-matcher|amo|0.6.2 vscode-eslint|dba|2.2.6 gitlens|eam|13.0.3 EditorConfig|Edi|0.16.4 prettier-vscode|esb|9.9.0 codespaces|Git|1.12.0 copilot|Git|1.54.7077 remotehub|Git|0.44.0 vscode-pull-request-github|Git|0.52.0 azure-pipelines|ms-|1.208.0 vscode-docker|ms-|1.22.2 python|ms-|2022.16.1 vscode-pylance|ms-|2022.10.30 remote-containers|ms-|0.255.4 remote-ssh|ms-|0.90.1 remote-ssh-edit|ms-|0.84.0 remote-wsl|ms-|0.72.0 vscode-remote-extensionpack|ms-|0.21.0 azure-account|ms-|0.11.2 remote-repositories|ms-|0.22.0 vscode-github-issue-notebooks|ms-|0.0.124 code-spell-checker|str|2.10.1
A/B Experiments ``` vsliv368cf:30146710 vsreu685:30147344 python383cf:30185419 vspor879:30202332 vspor708:30202333 vspor363:30204092 vslsvsres303:30308271 pythonvspyl392:30443607 vserr242cf:30382550 pythontb:30283811 vsjup518:30340749 pythonptprofiler:30281270 vshan820:30294714 vstes263cf:30335440 pythondataviewer:30285071 vscod805cf:30301675 binariesv615:30325510 bridge0708:30335490 bridge0723:30353136 cmake_vspar411:30581797 vsaa593:30376534 pythonvs932:30410667 cppdebug:30492333 vsclangdf:30486550 c4g48928:30535728 dsvsc012:30540252 azure-dev_surveyone:30548225 2144e591:30553903 pyindex848:30577860 nodejswelcome1:30587005 fc301958:30573243 ```
sandy081 commented 2 years ago

@mjbvz Any insights here why this is happening?

mjbvz commented 2 years ago

@sandy081 Currently code actions are requested for the range of the diagnostic:

https://github.com/microsoft/vscode/blob/6de5257b642a24b7cffbb146f691d65b015b2323/src/vs/workbench/contrib/markers/browser/markersTreeViewer.ts#L620

The code action providers may return any quick fixes that happen to overlap with that range

I suspect the markers tree view needs to look at the returned code actions to find the one that fixes the target diagnostic. It may also be a good idea to pass the specific diagnostic to the code action provider (although the internal getCodeAcitons api would have to be updated to accept a diagnostic in addition to range.

jblievremont commented 2 years ago

Could this be related to #161331?

eleanorjboyd commented 2 years ago

I am also seeing it, here is a screenshot as another verification:

Screenshot 2022-11-10 at 1 37 54 PM
gabrielBusuioc commented 1 year ago

Hi,

I am encountering this issue on my side as well. Would this fix be considered for future releases?