microsoft / vscode

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

Test API: Cursor should be placed prior to inline error message #134912

Open JustinGrote opened 2 years ago

JustinGrote commented 2 years ago

Issue Type: Bug @connor4312 When an inline test error is displayed, the cursor final position is not at the end of the code but at the end of the message. Other APIs e.g. inline values do not allow the cursor to be placed after the message. Testing API should be updated to match if possible for consistency.

image

VS Code version: Code - Insiders 1.62.0-insider (e96a97448aae1572246bf7c438b7c2ee68a964c0, 2021-10-11T05:16:36.885Z) OS version: Windows_NT x64 10.0.22000 Restricted Mode: No

System Info |Item|Value| |---|---| |CPUs|AMD Ryzen 7 4700U with Radeon Graphics (8 x 1996)| |GPU Status|2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled| |Load (avg)|undefined| |Memory (System)|15.36GB (2.97GB free)| |Process Argv|--crash-reporter-id 4453efaa-0821-4555-88e2-3de8bad9109e| |Screen Reader|no| |VM|0%|
Extensions (47) Extension|Author (truncated)|Version ---|---|--- vscode-log-viewer|ber|0.12.2 markdown-checkbox|bie|0.3.2 vscode-opennewinstance|chr|0.0.12 esbuild-problem-matchers|con|0.0.2 vscode-eslint|dba|2.2.1 vscode-generate-getter-setter|DSK|0.5.0 gitlens|eam|11.6.1 filter-lines|ear|1.0.0 EditorConfig|Edi|0.16.4 prettier-vscode|esb|9.0.0 copilot|Git|1.5.2993 remotehub|Git|0.15.0 vscode-pull-request-github|Git|0.31.0 todo-tree|Gru|0.0.214 vscode-test-explorer|hbe|2.21.1 vscode-drawio|hed|1.6.2 change-case|hjd|1.0.2 git-graph|mhu|1.30.0 vscode-azurefunctions|ms-|1.5.1 vscode-azureresourcegroups|ms-|0.4.0 vscode-bicep|ms-|0.4.613 vscode-docker|ms-|1.17.0 csharp|ms-|1.23.16 vscode-dotnet-runtime|ms-|1.3.0 remote-containers|ms-|0.202.1 remote-ssh-nightly|ms-|2021.10.5220 remote-wsl|ms-|0.58.2 azure-account|ms-|0.9.9 powershell-preview|ms-|2021.9.2 test-adapter-converter|ms-|0.1.3 vscode-paste-image|mus|1.0.4 indent-rainbow|ode|8.2.0 docthis|oou|0.8.2 vscode-jest|Ort|4.1.2 pester-test|psp|2021.9.24 quicktype|qui|12.0.46 vscode-commons|red|0.0.6 vscode-yaml|red|0.23.0 vscode-sort-json|ric|1.20.0 even-better-toml|tam|0.14.2 vscode-inline-values-powershell|Tyl|0.0.5 errorlens|use|3.4.0 vscode-icons|vsc|11.6.0 codetour|vsl|0.0.58 gistfs|vsl|0.3.0 gitmoji-vscode|Vtr|1.0.9 better-align|wwm|1.1.6
A/B Experiments ``` vsliv695:30137379 vsins829:30139715 vsliv368cf:30146710 vsreu685:30147344 python383:30185418 pythonvspyt602:30291494 vspor879:30202332 vspor708:30202333 vspor363:30204092 pythonvspyt639:30291487 pythontb:30258533 pythonptprofiler:30281269 vshan820:30294714 pythondataviewer:30285072 pythonvsuse255:30319630 vscod805:30301674 pythonvspyt200:30323110 vsccppwt:30377800 pythonvssor306:30340298 bridge0708:30335490 pygetstartedt2:30353727 bridge0723:30353136 pythonrunftest32:30365365 pythonf5test824:30361779 javagetstartedt:30350119 pythonvspyt187:30365360 pydsgst2:30361790 vsqsis300:30374797 vsaa593:30376534 ```
connor4312 commented 2 years ago

This seems like an effect of using IModelDecorationOptions.after

alexdima commented 2 years ago

@connor4312 Normally, the way injected text works is by creating 2 view positions (before and after the injected text) which map to the same model position. Hitting the individual view positions is possible via using the mouse, but otherwise arrow left / right would normally skip one of the two view positions that map to the same model position.

If I understand correctly, you would like to suppress the second view position that maps to the same model position, probably due to the fact that your injected text is always at the end of a line (it is a "post-line decoration" in a way). Is that the case?

connor4312 commented 2 years ago

Yea, that's correct.