Repository: vscode
Issue: Terminal: failed link detection on WSL filesystem when wordSeparators contains slashes
Labels: bug,WSL,terminal-links


Type: <b>Bug</b>

1. Add slashes to `"terminal.integrated.wordSeparators"`, e.g. ``" ()[]{}',\"`─‘’“”|//\\"``
2. Create some files *on a WSL drive*, e.g. `src/foo/bar/bim.ts`, `src/foo/bar/baz.ts`
3. Create a build task that produces filepath-like outputs that should link to those files, e.g.
  ```jsonc
{
	"version": "2.0.0",
	"tasks": [
		{
			"type": "shell",
			"command": "echo $SHELL; echo $0; echo 'Problem: src/foo/bar/xyz.ts'",
			"problemMatcher": [],
			"group": {
				"kind": "build",
				"isDefault": true
			},
			"label": "print a Unixy filepath"
		},
		{
			"type": "shell",
			"command": "echo $SHELL; echo $0; echo 'Problem: src\\foo\\bar\\xyz.ts'",
			"problemMatcher": [],
			"group": {
				"kind": "build",
				"isDefault": true
			},
			"label": "print a Windows filepath"
		}
	]
}

  ```
4. Run the task(s)
5. Try to Ctrl-click one of the files (particularly on the directories like `foo`/`bar`).

 
Most likely related to the cause of #179972 or the same issue resurfacing.

Additional trace details for link parsing:
```
2024-11-05 16:59:19.756 [trace] [d9b2eed] terminalLocalLinkDetector#detect text ["/usr/bin/bash"]
2024-11-05 16:59:19.756 [trace] [d9b2eed] terminalLocalLinkDetector#detect parsedLinks [[{"path":{"index":0,"text":"/usr/bin/bash"}}]]
2024-11-05 16:59:19.757 [trace] [d9b2eed] terminalLocalLinkDetector#detect linkCandidates [["/usr/bin/bash"]]
2024-11-05 16:59:19.757 [trace] [d9b2eed] terminalUriLinkDetector#detect computedLinks [[]]
2024-11-05 16:59:20.023 [trace] [d9b2eed] terminalMultiLineLinkDetector#detect text ["Problem: src/foo/bar/xyz.ts"]
2024-11-05 16:59:20.023 [trace] [d9b2eed] terminalLocalLinkDetector#detect text ["Problem: src/foo/bar/xyz.ts"]
2024-11-05 16:59:20.024 [trace] [d9b2eed] terminalLocalLinkDetector#detect parsedLinks [[{"path":{"index":9,"text":"src/foo/bar/xyz.ts"}}]]
2024-11-05 16:59:20.024 [trace] [d9b2eed] terminalLinkHelpers#updateLinkWithRelativeCwd cwd ["\\wsl.localhost\\NixOS\\home\\ian\\Documents\\Development\\vscode-sandbox"]
2024-11-05 16:59:20.024 [trace] [d9b2eed] terminalLocalLinkDetector#detect linkCandidates [["C:\\wsl.localhost\\NixOS\\home\\ian\\Documents\\Development\\vscode-sandbox\\src\\foo\\bar\\xyz.ts"]]
2024-11-05 16:59:20.024 [trace] [d9b2eed] terminalUriLinkDetector#detect computedLinks [[]]
2024-11-05 16:59:20.334 [debug] [d9b2eed] Opening link [{"text":"foo","bufferRange":{"start":{"x":14,"y":5},"end":{"x":16,"y":5}},"type":"Search","contextLine":"Problem: src/foo/bar/xyz.ts"}]
2024-11-05 16:59:20.335 [trace] [d9b2eed] terminalLinkHelpers#updateLinkWithRelativeCwd cwd ["\\wsl.localhost\\NixOS\\home\\ian\\Documents\\Development\\vscode-sandbox"]
2024-11-05 16:59:20.624 [trace] [d9b2eed] terminalMultiLineLinkDetector#detect text [" *  Terminal will be reused by tasks, press any key to close it. "]
2024-11-05 16:59:20.624 [trace] [d9b2eed] terminalLocalLinkDetector#detect text [" *  Terminal will be reused by tasks, press any key to close it. "]
2024-11-05 16:59:20.624 [trace] [d9b2eed] terminalLocalLinkDetector#detect parsedLinks [[]]
2024-11-05 16:59:20.624 [trace] [d9b2eed] terminalUriLinkDetector#detect computedLinks [[]]
```


VS Code version: Code 1.95.1 (65edc4939843c90c34d61f4ce11704f09d3e5cb6, 2024-10-31T05:14:54.222Z)
OS version: Windows_NT x64 10.0.19045
Modes:
Remote OS version: Linux x64 5.15.153.1-microsoft-standard-WSL2

Also tested on Windows without using WSL-remote, and the same problem occurs as long as the filesystem itself is WSL. Plain Windows seems to work okay.

<details>
<summary>System Info</summary>

|Item|Value|
|---|---|
|CPUs|13th Gen Intel(R) Core(TM) i9-13950HX (32 x 2419)|
|GPU Status|2d_canvas: unavailable_software<br>canvas_oop_rasterization: disabled_off<br>direct_rendering_display_compositor: disabled_off_ok<br>gpu_compositing: disabled_software<br>multiple_raster_threads: enabled_on<br>opengl: disabled_off<br>rasterization: disabled_software<br>raw_draw: disabled_off_ok<br>skia_graphite: disabled_off<br>video_decode: disabled_software<br>video_encode: disabled_software<br>vulkan: disabled_off<br>webgl: unavailable_software<br>webgl2: unavailable_software<br>webgpu: unavailable_software<br>webnn: unavailable_software|
|Load (avg)|undefined|
|Memory (System)|63.61GB (18.41GB free)|
|Process Argv|--file-uri vscode-remote://wsl%2Bnixos/home/ian/Documents/Development/scuttle.code-workspace --log asvetliakov.vscode-neovim=info|
|Screen Reader|no|
|VM|0%|

|Item|Value|
|---|---|
|Remote|WSL: NixOS|
|OS|Linux x64 5.15.153.1-microsoft-standard-WSL2|
|CPUs|13th Gen Intel(R) Core(TM) i9-13950HX (32 x 0)|
|Memory (System)|31.15GB (16.84GB free)|
|VM|0%|

|Item|Value|
|---|---|
|Remote|WSL: NixOS|
|OS|Linux x64 5.15.153.1-microsoft-standard-WSL2|
|CPUs|13th Gen Intel(R) Core(TM) i9-13950HX (32 x 0)|
|Memory (System)|31.15GB (16.84GB free)|
|VM|0%|
</details>Extensions disabled
<!-- generated by issue reporter -->