microsoft / vscode

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

Links sometimes stop working completely in terminals #184046

Closed AlCalzone closed 7 months ago

AlCalzone commented 1 year ago

Type: Bug

In Node.js processes in the integrated terminal, CTRL-hovering a potential link no longer turns it into a link. This makes it very cumbersome to go to errors that TypeScript reports. The same text in a bash terminal is working fine:

https://github.com/microsoft/vscode/assets/17641229/936ef6e4-2a60-4bef-a753-d08a496d8a9a

VS Code version: Code 1.78.2 (b3e4e68a0bc097f0ae7907b217c1119af9e03435, 2023-05-10T14:47:05.613Z) OS version: Linux x64 5.19.0-42-generic snap Modes: Sandboxed: Yes

System Info |Item|Value| |---|---| |CPUs|11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz (8 x 3346)| |GPU Status|2d_canvas: unavailable_software
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: disabled_software
multiple_raster_threads: enabled_on
opengl: disabled_off
rasterization: disabled_software
raw_draw: disabled_off_ok
video_decode: disabled_software
video_encode: disabled_software
vulkan: disabled_off
webgl: unavailable_software
webgl2: unavailable_software
webgpu: disabled_off| |Load (avg)|2, 2, 2| |Memory (System)|31.07GB (24.11GB free)| |Process Argv|--no-sandbox --force-user-env --unity-launch --crash-reporter-id 23d56de3-001d-431f-81e8-0c352e7ea82f| |Screen Reader|no| |VM|0%| |DESKTOP_SESSION|ubuntu| |XDG_CURRENT_DESKTOP|Unity| |XDG_SESSION_DESKTOP|ubuntu| |XDG_SESSION_TYPE|x11|
Extensions (70) Extension|Author (truncated)|Version ---|---|--- toggle-excluded-files|amo|2.0.0 tsl-problem-matcher|amo|0.6.2 vscode-zipfs|arc|3.0.0 chronicler|arc|0.1.16 better-toml|bun|0.3.2 css-theme-completions|con|0.0.5 esbuild-problem-matchers|con|0.0.2 vscode-eslint|dba|2.4.0 gitlens|eam|13.6.0 EditorConfig|Edi|0.16.4 RunOnSave|eme|0.2.0 json-tools|eri|1.0.2 prettier-vscode|esb|9.13.0 copilot|Git|1.87.127 copilot-labs|Git|0.14.884 vscode-github-actions|git|0.25.7 vscode-pull-request-github|Git|0.65.2023053009 vscode-mocha-test-adapter|hbe|2.14.1 vscode-test-explorer|hbe|2.21.1 rest-client|hum|0.25.1 template-string-converter|meg|0.6.1 git-graph|mhu|1.30.0 compare-folders|mos|0.22.5 vscode-json5|mrm|1.0.0 vscode-docker|ms-|1.25.1 vscode-language-pack-de|MS-|1.78.2023051009 python|ms-|2023.8.0 vscode-pylance|ms-|2023.5.40 jupyter|ms-|2023.4.1011241018 jupyter-keymap|ms-|1.1.0 jupyter-renderers|ms-|1.0.15 vscode-jupyter-cell-tags|ms-|0.1.8 vscode-jupyter-slideshow|ms-|0.1.5 remote-containers|ms-|0.292.0 remote-ssh|ms-|0.102.0 remote-ssh-edit|ms-|0.86.0 remote-wsl|ms-|0.78.8 vscode-remote-extensionpack|ms-|0.24.0 azure-account|ms-|0.11.5 cmake-tools|ms-|1.14.31 cpptools|ms-|1.15.4 cpptools-extension-pack|ms-|1.3.0 hexeditor|ms-|1.9.11 live-server|ms-|0.4.8 makefile-tools|ms-|0.7.0 powershell|ms-|2023.5.0 remote-explorer|ms-|0.4.0 remote-server|ms-|1.1.0 test-adapter-converter|ms-|0.1.7 vscode-js-profile-flame|ms-|1.0.5 hide-gitignored|npx|1.1.0 vetur|oct|0.37.3 vscode-twoslash-queries|Ort|1.1.0 typescript-mono-repo-import-helper|q|0.0.6 tsserver-live-reload|rbu|1.0.1 java|red|1.18.0 vscode-sort-json|ric|1.20.0 rust-analyzer|rus|0.3.1533 gitconfig|sid|2.0.1 cmake|twx|0.0.17 sort-lines|Tyr|1.10.1 intellicode-api-usage-examples|Vis|0.2.7 vscodeintellicode|Vis|1.2.30 vscode-java-dependency|vsc|0.22.0 vscode-java-pack|vsc|0.25.11 vscode-maven|vsc|0.41.0 vscode-icons|vsc|12.4.0 vscode-todo-highlight|way|1.0.5 vitest-explorer|Zix|0.2.41 config-editor|zwa|0.0.12 (1 theme extensions excluded)
A/B Experiments ``` vsliv368:30146709 vsreu685:30147344 python383cf:30185419 vspor879:30202332 vspor708:30202333 vspor363:30204092 vswsl492:30256859 vslsvsres303:30308271 vserr242cf:30382550 pythontb:30283811 vsjup518:30340749 pythonptprofiler:30281270 vshan820:30294714 vstes263:30335439 vscorecescf:30445987 vscod805cf:30301675 binariesv615:30325510 bridge0708:30335490 bridge0723:30353136 cmake_vspar411:30581797 vsaa593:30376534 pythonvs932:30410667 cppdebug:30492333 vsclangdc:30486549 c4g48928:30535728 dsvsc012:30540252 pynewext54:30695312 azure-dev_surveyone:30548225 3biah626:30602489 pyind779:30671433 89544117:30613380 pythonsymbol12:30671437 a9j8j154:30646983 showlangstatbar:30737416 vsctsb:30748421 pythonms35:30701012 pythonfmttext:30731395 pythoncmv:30739700 fixhidewlkth:30730051 pythongtdpathcf:30739705 ```
meganrogge commented 1 year ago

Thanks for creating this issue! To help narrow it down, please take the time to follow below steps. Thanks a lot and happy coding 🙏

Is the issue caused by an Extension?

Stop VS Code and from the command line (NOT the integrated terminal in Code), execute: code --disable-extensions and try your steps again to see if it reproduces. If it still reproduces, jump to the next chapter.

If you see it is an issue with the extension, please run the command Start Extension Bisect and follow the instructions to find the extension that is causing this issue.

image

Please report the issue to the extension causing this.

Is the issue caused by VS Code Core?

If the issue is not caused by an extension, it is maybe caused by your configuration. Try to run code --disable-extensions --user-data-dir <directory> where <directory> is an empty folder. This will ensure Code is starting with a fresh data directory, e.g. no specific settings and without any extensions running.

If it still reproduces, it was maybe fixed already in our nightly release. Please download from https://code.visualstudio.com/insiders/ and see if you can reproduce the issue.

Finally, to help us narrow down what change caused the issue, please run the following command to find the build. It will start previous releases of VS Code insiders to see where the regression was introduced:

Thanks!

Tyriar commented 1 year ago

Was this just a one off or is it reliably reproducible? There is some issue where hovers/underlines will stop working sometimes, but I think you can still ctrl/cmd+click them in that case.

AlCalzone commented 1 year ago

This is definitely reproducible, but I'm unable to narrow down which extension causes it. I also noticed that it happens only after reloading the extension host. There are no links at all in that case, ctrl+click does nothing.

I've now done the bisect 4 times, each time waited longer after reloading in case this is just happening with a delay. The behavior is always the same.

From that, I'd say it is caused by some extension, not VSCode itself

Tyriar commented 1 year ago

I've seen this as well but very rarely, sometimes links are just completely broken for the terminal. I did notice last time that the link detection was happening by checking the logs, but no underlines showed up

AlCalzone commented 1 year ago

Any info I could collect when it happens?

Tyriar commented 1 year ago

I mainly need a repro case to debug against.

Some info which would be good to clarify:

AlCalzone commented 1 year ago

Links are detected it seems:

2023-06-27 10:48:07.764 [trace] terminalMultiLineLinkDetector#detect text ["src/lib/driver/Driver.ts:324:36 - error TS18050: The value 'null' cannot be used here."]
2023-06-27 10:48:07.764 [trace] terminalMultiLineLinkDetector#detect candidate ["324:36"]
2023-06-27 10:48:07.764 [trace] terminalLocalLinkDetector#detect text ["src/lib/driver/Driver.ts:324:36 - error TS18050: The value 'null' cannot be used here."]
2023-06-27 10:48:07.765 [trace] terminalLocalLinkDetector#detect parsedLinks [[{"path":{"index":0,"text":"src/lib/driver/Driver.ts"},"suffix":{"row":324,"col":36,"suffix":{"index":24,"text":":324:36"}}}]]
2023-06-27 10:48:07.765 [trace] terminalLinkHelpers#updateLinkWithRelativeCwd cwd [null]
2023-06-27 10:48:07.765 [trace] terminalLocalLinkDetector#detect linkCandidates [["src/lib/driver/Driver.ts"]]
2023-06-27 10:48:07.765 [trace] terminalMultiLineLinkDetector#detect text ["src/lib/driver/Driver.ts:324:36 - error TS18050: The value 'null' cannot be used here."]
2023-06-27 10:48:07.766 [trace] terminalMultiLineLinkDetector#detect candidate ["324:36"]
2023-06-27 10:48:07.766 [trace] terminalLocalLinkDetector#detect text ["src/lib/driver/Driver.ts:324:36 - error TS18050: The value 'null' cannot be used here."]
2023-06-27 10:48:07.766 [trace] terminalLocalLinkDetector#detect parsedLinks [[{"path":{"index":0,"text":"src/lib/driver/Driver.ts"},"suffix":{"row":324,"col":36,"suffix":{"index":24,"text":":324:36"}}}]]
2023-06-27 10:48:07.766 [trace] terminalLinkHelpers#updateLinkWithRelativeCwd cwd [null]
2023-06-27 10:48:07.766 [trace] terminalLocalLinkDetector#detect linkCandidates [["src/lib/driver/Driver.ts"]]
2023-06-27 10:48:08.680 [trace] terminalMultiLineLinkDetector#detect text ["src/lib/driver/Driver.ts:324:36 - error TS18050: The value 'null' cannot be used here."]
2023-06-27 10:48:08.681 [trace] terminalMultiLineLinkDetector#detect candidate ["324:36"]
2023-06-27 10:48:08.681 [trace] terminalLocalLinkDetector#detect text ["src/lib/driver/Driver.ts:324:36 - error TS18050: The value 'null' cannot be used here."]
2023-06-27 10:48:08.681 [trace] terminalLocalLinkDetector#detect parsedLinks [[{"path":{"index":0,"text":"src/lib/driver/Driver.ts"},"suffix":{"row":324,"col":36,"suffix":{"index":24,"text":":324:36"}}}]]
2023-06-27 10:48:08.681 [trace] terminalLinkHelpers#updateLinkWithRelativeCwd cwd [null]
2023-06-27 10:48:08.682 [trace] terminalLocalLinkDetector#detect linkCandidates [["src/lib/driver/Driver.ts"]]
2023-06-27 10:48:08.682 [trace] terminalMultiLineLinkDetector#detect text ["src/lib/driver/Driver.ts:324:36 - error TS18050: The value 'null' cannot be used here."]
2023-06-27 10:48:08.682 [trace] terminalMultiLineLinkDetector#detect candidate ["324:36"]
2023-06-27 10:48:08.682 [trace] terminalLocalLinkDetector#detect text ["src/lib/driver/Driver.ts:324:36 - error TS18050: The value 'null' cannot be used here."]
2023-06-27 10:48:08.683 [trace] terminalLocalLinkDetector#detect parsedLinks [[{"path":{"index":0,"text":"src/lib/driver/Driver.ts"},"suffix":{"row":324,"col":36,"suffix":{"index":24,"text":":324:36"}}}]]
2023-06-27 10:48:08.683 [trace] terminalLinkHelpers#updateLinkWithRelativeCwd cwd [null]
2023-06-27 10:48:08.683 [trace] terminalLocalLinkDetector#detect linkCandidates [["src/lib/driver/Driver.ts"]]
2023-06-27 10:48:08.865 [trace] terminalMultiLineLinkDetector#detect text ["[10:47:33 AM] Starting compilation in watch mode..."]
2023-06-27 10:48:08.865 [trace] terminalMultiLineLinkDetector#detect candidate ["10:47"]
2023-06-27 10:48:08.865 [trace] terminalLocalLinkDetector#detect text ["[10:47:33 AM] Starting compilation in watch mode..."]
2023-06-27 10:48:08.866 [trace] terminalLocalLinkDetector#detect parsedLinks [[{"path":{"index":1,"text":"10"},"suffix":{"row":47,"col":33,"suffix":{"index":3,"text":":47:33"}}}]]
2023-06-27 10:48:08.866 [trace] terminalLinkHelpers#updateLinkWithRelativeCwd cwd [null]
2023-06-27 10:48:08.866 [trace] terminalLocalLinkDetector#detect linkCandidates [["10"]]
2023-06-27 10:48:08.866 [trace] terminalMultiLineLinkDetector#detect text ["[10:47:33 AM] Starting compilation in watch mode..."]
2023-06-27 10:48:08.867 [trace] terminalMultiLineLinkDetector#detect candidate ["10:47"]
2023-06-27 10:48:08.867 [trace] terminalLocalLinkDetector#detect text ["[10:47:33 AM] Starting compilation in watch mode..."]
2023-06-27 10:48:08.867 [trace] terminalLocalLinkDetector#detect parsedLinks [[{"path":{"index":1,"text":"10"},"suffix":{"row":47,"col":33,"suffix":{"index":3,"text":":47:33"}}}]]
2023-06-27 10:48:08.867 [trace] terminalLinkHelpers#updateLinkWithRelativeCwd cwd [null]
2023-06-27 10:48:08.867 [trace] terminalLocalLinkDetector#detect linkCandidates [["10"]]
2023-06-27 10:48:16.002 [trace] terminalMultiLineLinkDetector#detect text ["src/lib/driver/Driver.ts:324:36 - error TS18050: The value 'null' cannot be used here."]
2023-06-27 10:48:16.002 [trace] terminalMultiLineLinkDetector#detect candidate ["324:36"]
2023-06-27 10:48:16.002 [trace] terminalLocalLinkDetector#detect text ["src/lib/driver/Driver.ts:324:36 - error TS18050: The value 'null' cannot be used here."]
2023-06-27 10:48:16.002 [trace] terminalLocalLinkDetector#detect parsedLinks [[{"path":{"index":0,"text":"src/lib/driver/Driver.ts"},"suffix":{"row":324,"col":36,"suffix":{"index":24,"text":":324:36"}}}]]
2023-06-27 10:48:16.002 [trace] terminalLinkHelpers#updateLinkWithRelativeCwd cwd [null]
2023-06-27 10:48:16.002 [trace] terminalLocalLinkDetector#detect linkCandidates [["src/lib/driver/Driver.ts"]]
2023-06-27 10:48:16.003 [trace] terminalMultiLineLinkDetector#detect text ["src/lib/driver/Driver.ts:324:36 - error TS18050: The value 'null' cannot be used here."]
2023-06-27 10:48:16.003 [trace] terminalMultiLineLinkDetector#detect candidate ["324:36"]
2023-06-27 10:48:16.003 [trace] terminalLocalLinkDetector#detect text ["src/lib/driver/Driver.ts:324:36 - error TS18050: The value 'null' cannot be used here."]
2023-06-27 10:48:16.003 [trace] terminalLocalLinkDetector#detect parsedLinks [[{"path":{"index":0,"text":"src/lib/driver/Driver.ts"},"suffix":{"row":324,"col":36,"suffix":{"index":24,"text":":324:36"}}}]]
2023-06-27 10:48:16.003 [trace] terminalLinkHelpers#updateLinkWithRelativeCwd cwd [null]
2023-06-27 10:48:16.003 [trace] terminalLocalLinkDetector#detect linkCandidates [["src/lib/driver/Driver.ts"]]
2023-06-27 10:48:16.235 [trace] terminalMultiLineLinkDetector#detect text ["src/lib/driver/Driver.ts:324:36 - error TS18050: The value 'null' cannot be used here."]
2023-06-27 10:48:16.235 [trace] terminalMultiLineLinkDetector#detect candidate ["324:36"]
2023-06-27 10:48:16.236 [trace] terminalLocalLinkDetector#detect text ["src/lib/driver/Driver.ts:324:36 - error TS18050: The value 'null' cannot be used here."]
2023-06-27 10:48:16.236 [trace] terminalLocalLinkDetector#detect parsedLinks [[{"path":{"index":0,"text":"src/lib/driver/Driver.ts"},"suffix":{"row":324,"col":36,"suffix":{"index":24,"text":":324:36"}}}]]
2023-06-27 10:48:16.236 [trace] terminalLinkHelpers#updateLinkWithRelativeCwd cwd [null]
2023-06-27 10:48:16.236 [trace] terminalLocalLinkDetector#detect linkCandidates [["src/lib/driver/Driver.ts"]]
2023-06-27 10:48:16.236 [trace] terminalMultiLineLinkDetector#detect text ["src/lib/driver/Driver.ts:324:36 - error TS18050: The value 'null' cannot be used here."]
2023-06-27 10:48:16.237 [trace] terminalMultiLineLinkDetector#detect candidate ["324:36"]
2023-06-27 10:48:16.238 [trace] terminalLocalLinkDetector#detect text ["src/lib/driver/Driver.ts:324:36 - error TS18050: The value 'null' cannot be used here."]
2023-06-27 10:48:16.238 [trace] terminalLocalLinkDetector#detect parsedLinks [[{"path":{"index":0,"text":"src/lib/driver/Driver.ts"},"suffix":{"row":324,"col":36,"suffix":{"index":24,"text":":324:36"}}}]]
2023-06-27 10:48:16.238 [trace] terminalLinkHelpers#updateLinkWithRelativeCwd cwd [null]
2023-06-27 10:48:16.238 [trace] terminalLocalLinkDetector#detect linkCandidates [["src/lib/driver/Driver.ts"]]
2023-06-27 10:48:18.285 [trace] terminalMultiLineLinkDetector#detect text ["[10:47:33 AM] Starting compilation in watch mode..."]
2023-06-27 10:48:18.286 [trace] terminalMultiLineLinkDetector#detect candidate ["10:47"]
2023-06-27 10:48:18.286 [trace] terminalLocalLinkDetector#detect text ["[10:47:33 AM] Starting compilation in watch mode..."]
2023-06-27 10:48:18.286 [trace] terminalLocalLinkDetector#detect parsedLinks [[{"path":{"index":1,"text":"10"},"suffix":{"row":47,"col":33,"suffix":{"index":3,"text":":47:33"}}}]]
2023-06-27 10:48:18.286 [trace] terminalLinkHelpers#updateLinkWithRelativeCwd cwd [null]
2023-06-27 10:48:18.287 [trace] terminalLocalLinkDetector#detect linkCandidates [["10"]]
2023-06-27 10:48:18.287 [trace] terminalMultiLineLinkDetector#detect text ["[10:47:33 AM] Starting compilation in watch mode..."]
2023-06-27 10:48:18.287 [trace] terminalMultiLineLinkDetector#detect candidate ["10:47"]
2023-06-27 10:48:18.287 [trace] terminalLocalLinkDetector#detect text ["[10:47:33 AM] Starting compilation in watch mode..."]
2023-06-27 10:48:18.288 [trace] terminalLocalLinkDetector#detect parsedLinks [[{"path":{"index":1,"text":"10"},"suffix":{"row":47,"col":33,"suffix":{"index":3,"text":":47:33"}}}]]
2023-06-27 10:48:18.288 [trace] terminalLinkHelpers#updateLinkWithRelativeCwd cwd [null]
2023-06-27 10:48:18.288 [trace] terminalLocalLinkDetector#detect linkCandidates [["10"]]

But I cannot CTRL+click them - nothing happens, no underline, no navigation.

AlCalzone commented 1 year ago

This is probably extension-related, as I couldn't reproduce on insiders until I started the settings sync with stable. If there's a way that you can load VSCode with the same extensions I have, you should be able to reproduce this way:

Empty folder with file test.txt:


./test.txt:3:5

Repro:

  1. cat test.txt -> link works
  2. Reload extension host
  3. existing link no longer works
  4. cat test.txt -> new link also broken
Tyriar commented 1 year ago

If there's a way that you can load VSCode with the same extensions I have

If this is true I wonder if the extension is never resolving the request and our timeout doesn't work or something. This is good info thanks! I'll try have a look into this again next week

Tyriar commented 1 year ago

I just tested and it looks like extensions can cause this. I added await new Promise<void>(r => setTimeout(r, 10000)); to an extension that used provideTerminalLinks and it looks like the links are broken for 10 seconds, if you keep the mouse on that line for 10 seconds it will work.

Jason3S commented 10 months ago

@Tyriar,

This issue happens quite consistently as of (1.84.0). It seems to be based upon how long the terminal is open or how much content was displayed in the terminal. My feeling is that it is the later. I do not believe it is a third party extension issue, since restarting Extension-Host doesn't not fix the issue.

The workaround is to delete and re-open the terminal.

Typical scenario:

Tyriar commented 7 months ago

Might be related to https://github.com/microsoft/vscode/issues/203437

dickreuter commented 7 months ago

This is how it looks like on vscode when I type pylint in the terminal, no hyperlinks, I need to go manually search where the files and line numbers are. The link system needs to be fixed. Until then I have to use PyCharm.

image

alexr00 commented 7 months ago

If this is verifiable by successfully opening a link from a node process then this is verified.

Tyriar commented 7 months ago

The repro for this was difficult, I think the fast that I haven't seen it happen in 3 weeks is good enough for verification. We can always reopen if it pops back up.

AlCalzone commented 6 months ago

I haven't seen this happen in a few weeks now 👍🏻