microsoft / vscode

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

Links to files starting with ./ do not work correctly #228323

Open sonofR9 opened 1 week ago

sonofR9 commented 1 week ago

Type: Bug

1) Connect to some remote machine. 2) Create a folder, for example "tmp"; 3) Create a file in this folder, for example "tmp/text.txt" (you can add some data if you want, it won't change the behavior); 4) Open this folder in vscode; 5) Type echo "./text.txt:1" in terminal; When clicking (with alt) on the ./text.txt:1 part of the command, the file will not be found. When clicking on the echo output, the file is sometimes found, sometimes not. "text.txt:1" or absolute path works fine.

Note: line number doesn't matter (for example, if I have a file with 100 lines and the link points to line 22, it still won't work).

If you want, you can use this script to automate the file creation:

mkdir tmp
touch tmp/text.txt
echo "line 1
line 2" >> tmp/text.txt

The reason this is important: some extensions use the syntax like in my example (TestMate for example) and it stopped working/never worked.

VS Code version: Code 1.93.0 (4849ca9bdf9666755eb463db297b69e5385090e3, 2024-09-04T13:02:38.431Z) OS version: Linux x64 6.10.6-amd64 Modes: Remote OS version: Linux x64 5.15.0-70-generic Remote OS version: Linux x64 5.15.0-70-generic

System Info |Item|Value| |---|---| |CPUs|12th Gen Intel(R) Core(TM) i5-12450H (12 x 1890)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: enabled_on
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_graphite: disabled_off
video_decode: enabled
video_encode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
webnn: disabled_off| |Load (avg)|2, 1, 1| |Memory (System)|15.34GB (1.98GB free)| |Process Argv|--crash-reporter-id d6824b2b-3e5a-4bc1-84f4-7b1e54a44ccc| |Screen Reader|no| |VM|75%| |DESKTOP_SESSION|gnome| |XDG_CURRENT_DESKTOP|GNOME| |XDG_SESSION_DESKTOP|gnome| |XDG_SESSION_TYPE|wayland| |Item|Value| |---|---| |Remote|SSH: astra-1.7.4-local| |OS|Linux x64 5.15.0-70-generic| |CPUs|12th Gen Intel(R) Core(TM) i5-12450H (6 x 0)| |Memory (System)|7.76GB (5.82GB free)| |VM|100%| |Item|Value| |---|---| |Remote|SSH: astra-1.7.4-local| |OS|Linux x64 5.15.0-70-generic| |CPUs|12th Gen Intel(R) Core(TM) i5-12450H (6 x 0)| |Memory (System)|7.76GB (5.82GB free)| |VM|100%|
Extensions (79) Extension|Author (truncated)|Version ---|---|--- better-comments|aar|3.0.2 tsl-problem-matcher|amo|0.6.2 Doxygen|bbe|1.0.0 vscode-doxygen-runner|bet|1.8.0 ruff|cha|2024.48.0 cmake-format|che|0.6.11 path-intellisense|chr|2.9.0 codeium|Cod|1.14.12 doxdocgen|csc|1.4.0 vscode-markdownlint|Dav|0.56.0 python-environment-manager|don|1.2.4 python-extension-pack|don|1.7.0 gitlens|eam|15.4.0 vscode-hide-comments|eli|1.9.0 restore-terminals|Eth|1.1.8 todo-tree|Gru|0.0.226 vscode-test-explorer|hbe|2.21.1 vscode-drawio|hed|1.6.6 gtest-snippets|idm|1.0.1 latex-workshop|Jam|10.3.2 vsc-python-indent|Kev|1.18.0 kanban|lba|1.8.1 vscode-clangd|llv|0.1.29 vscode-catch2-test-adapter|mat|4.12.0 json|Mee|0.1.2 git-graph|mhu|1.30.0 vscode-docker|ms-|1.29.2 vscode-dotnet-runtime|ms-|2.1.5 autopep8|ms-|2024.0.0 black-formatter|ms-|2024.2.0 debugpy|ms-|2024.10.0 flake8|ms-|2023.10.0 isort|ms-|2023.10.1 mypy-type-checker|ms-|2024.0.0 pylint|ms-|2023.10.1 python|ms-|2024.14.0 vscode-pylance|ms-|2024.9.1 jupyter|ms-|2024.8.1 jupyter-keymap|ms-|1.1.2 jupyter-renderers|ms-|1.0.19 vscode-jupyter-cell-tags|ms-|0.1.9 vscode-jupyter-powertoys|ms-|0.1.1 vscode-jupyter-slideshow|ms-|0.1.6 remote-containers|ms-|0.384.0 remote-ssh|ms-|0.114.2 remote-ssh-edit|ms-|0.86.0 remote-wsl|ms-|0.88.3 vscode-remote-extensionpack|ms-|0.25.0 cmake-tools|ms-|1.19.51 cpptools|ms-|1.22.2 cpptools-extension-pack|ms-|1.3.0 remote-explorer|ms-|0.4.3 remote-server|ms-|1.5.2 test-adapter-converter|ms-|0.1.9 autodocstring|njp|0.6.1 pytest-runner|pam|0.0.7 vscode-xml|red|0.27.1 vscode-yaml|red|1.15.0 command-variable|rio|1.65.4 markdown-preview-enhanced|shd|0.8.14 swdc-vscode|sof|2.8.1 remote-x11|spa|1.5.0 remote-x11-ssh|spa|1.5.0 BuildOutputColorizer|Ste|0.1.6 code-spell-checker|str|3.0.1 code-spell-checker-british-english|str|1.4.11 code-spell-checker-russian|str|2.2.2 code-spell-checker-scientific-terms|str|0.2.2 cmantic|tde|0.9.0 cmake|twx|0.0.17 vscode-lldb|vad|1.10.0 intellicode-api-usage-examples|Vis|0.2.8 vscodeintellicode|Vis|1.3.1 jinja|who|0.0.8 autocomplete-english-word|wus|0.1.7 clang-format|xav|1.9.0 ds-toolkit-vscode|yan|0.1.2 markdown-all-in-one|yzh|3.6.2 cmake-highlight|zch|0.0.2 (1 theme extensions excluded)
A/B Experiments ``` vsliv368:30146709 vspor879:30202332 vspor708:30202333 vspor363:30204092 vscod805:30301674 binariesv615:30325510 vsaa593:30376534 py29gd2263:31024239 vscaat:30438848 c4g48928:30535728 azure-dev_surveyone:30548225 962ge761:30959799 pythongtdpath:30769146 welcomedialog:30910333 pythonnoceb:30805159 asynctok:30898717 pythonmypyd1:30879173 h48ei257:31000450 pythontbext0:30879054 accentitlementst:30995554 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 cppperfnew:31000557 dsvsc020:30976470 pythonait:31006305 dsvsc021:30996838 945dj816:31013170 a69g1124:31058053 dvdeprecation:31068756 dwnewjupyter:31046869 impr_priority:31102340 nativerepl1:31134654 refactort:31108082 pythonrstrctxt:31112756 flightc:31134773 wkspc-onlycs-t:31132770 wkspc-ranged-t:31125599 defaultse:31133495 fje88620:31121564 ```
GongT commented 22 hours ago

relative path is () relative to the working directory.

you can not open ./tmp/text.txt by click on ./text.txt, unless cd ./tmp before click.

sonofR9 commented 22 hours ago

Yes, I know. That's why the 4-th step is to go into that folder (tmp).

My apologies: english is not my first language and I didn't write it correct/ understandable.

And the problem is partially fixed: now you can't reproduce it with the steps in the description. But it still persists in some other windows: for example in the test results. I tested in TestMate c++ with gtest: it prints the path to the test relative to the cmake project directory starting with "./" (which opens as a folder in vscode). In particular, when I copy this path and print it to the console, vscode correctly gets to this location.

Screenshots: From test results does not automatically go into linked file: image But from echo of the same path (copied from test results window) did successfully follow the link: image

Partially solved in: Version: 1.93.1 Commit: 38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40 Date: 2024-09-11T17:20:05.685Z Electron: 30.4.0 ElectronBuildId: 10073054 Chromium: 124.0.6367.243 Node.js: 20.15.1 V8: 12.4.254.20-electron.0 OS: Linux x64 6.10.9-amd64