Vscode: Cannot click relative paths in terminal

Created on 8 Sep 2018  ·  20Comments  ·  Source: microsoft/vscode

Issue Type: Bug

Run a compiler on a file with an error, and hold down the Alt button and click on the pathname. Nothing happens.

VS Code version: Code 1.27.1 (5944e81f3c46a3938a82c701f96d7a59b074cfdc, 2018-09-06T09:21:18.328Z)
OS version: Windows_NT x64 6.1.7601


System Info

|Item|Value|
|---|---|
|CPUs|Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz (8 x 3408)|
|GPU Status|2d_canvas: unavailable_software
checker_imaging: disabled_off
flash_3d: unavailable_software
flash_stage3d: unavailable_software
flash_stage3d_baseline: unavailable_software
gpu_compositing: unavailable_software
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
rasterization: unavailable_software
video_decode: unavailable_software
video_encode: unavailable_software
webgl: enabled_readback
webgl2: unavailable_off|
|Memory (System)|31.89GB (23.46GB free)|
|Process Argv|C:\Program Files\Microsoft VS Code\Code.exe|
|Screen Reader|no|
|VM|0%|

Extensions (15)

Extension|Author (truncated)|Version
---|---|---
language-x86-64-assembly|13x|2.2.11
rainbow-brackets|2gu|0.0.6
vscode-whitespacer|dee|1.0.0
EditorConfig|Edi|0.12.4
CppSnippets|har|0.0.13
JSDocTagComplete|Hoo|0.0.2
MagicPython|mag|1.0.12
python|ms-|2018.8.0
cpptools|ms-|0.18.1
vscode-clearcase|Ope|1.12.1
trailing-spaces|sha|0.2.11
vscode-hexdump|sle|1.6.0
addDocComments|ste|0.0.8
python|tht|0.2.3
comment-snippets|Tob|0.2.0


bug candidate integrated-terminal verified

Most helpful comment

@PsychoXIVI I think I'll put the fix together for this today as it will likely be included in 1.27.2, thanks again for the investigation!

All 20 comments

Same for me, just updated: I was thinking "ok fine update", then there my favorite functionality doesn't work...

URL links seems to work: https://example.org/...
image

..., full path links also: E:/MyFolder/MyFile.cpp...
image

...but relative paths nope:
image

Related:

I bet @Tyriar can fix it ;F
Edit: even I can fix it(?)

What is worng?

It looks like there is problem with current working directory:
Full paths are working (i.e. on Windows E:/Some/main.cpp), but relative aren't. There is suspicious looking TODO comment... :C

It really looks like initialCwd is invalid.

There is a function where it is used (to validate path):
https://github.com/Microsoft/vscode/blob/release/1.27/src/vs/workbench/parts/terminal/electron-browser/terminalLinkHandler.ts#L199

Home path is working, since it doesn't use initialCwd:
image

What is worng with initialCwd? 🤔

How can be it solved?

I see two ways:

A)

B)

I also thinking about just invoking createProcess without (stupid) setTimeout... 🤔

Why I am writing this instead of just fixing it?

I can create some pull request, but later, since it would by mine first PR to VS Code repository, and my first use of TypeScript ;F (I am right now in process of installing contributing environment and cloning the repo XD).

By the way, while reading sources I noticed there is no way to use nice bash paths (/mnt/e/ etc) on Windows, since the path style and home directory are determined by OS which is running VS Code. :C (screen above works because I have Windows/Linux home at same location).

I am working on it! Edit: I am stuck :|

There is confirmation that newest version from GitHub repository is also not going very well
image

Edit:
Confirmation, that it was caused by https://github.com/Microsoft/vscode/commit/4ed24e070ab4bf4995af829e5cfaabcf01ff4d45, but I do know for now how to work around it, since it fixes https://github.com/Microsoft/vscode/issues/48136
Edit 2:
^^^ Not true - commit/issue not related probably. I don't know now why it happend. Sorry for the mess :/

@PsychoXIVI wow, nice investigation! @octref noticed links not working but we couldn't repro after that, this being a race condition makes sense as to why we couldn't repro so easily. I've definitely seen it before as well.

A PR would be awesome if you can put it together quick, this might go in the recovery build that we will probably release next week so if you can put a fix together in the next couple of days that would be best.

I think the best and easiest fix here is use TerminalInstance. processReady and set initialCwd on TerminalLinkHandler, and probably remove it from the constructor since it's not very useful there.

After working with it for some time, I can say only that is appears to be randomly (?) bugged.

I will try to use another approach: detecting current working directory of the process form terminal.

Edit: It can't be easily done because of Windows is stupid as fuck and cannot provide simplest API function to read CWD of the process (only availble via raw, cross-process memory access (here AHK code?) :| ). It can be possible for lovely Linux, as always as simple as single shell command: readlink -e /proc/441/cwd. PID can be obtained by onProcessIdReady which is provided node-pty (_process from TerminalProcessManager)

@PsychoXIVI we only need the initial cwd to be set to fix this regression. Getting the actual cwd in realtime is another feature which is a bunch of work (mainly because it's tough on Windows currently).

I had the similar issue on Mac OSX, I can not hold the Command and click the relative path.
VScode version: 1.27.1
macOS: 10.13.6

@PsychoXIVI I think I'll put the fix together for this today as it will likely be included in 1.27.2, thanks again for the investigation!

Fixed in master and release/1.27

~Still not working for me after updating to 1.27.1 on macOS~ NVM, I see this isn't coming till 1.27.2. Saw it in the release notes for 1.27.1 and assumed it should be fixed.

Just tried out 1.27.2, the issue still exists. 1.26.x is also broken but 1.25.x works fine.

(macOS 10.13.6)

@szhu can you share a screenshot and text of the failing line?

screen recording 2018-09-14 at 10 47 am

.
./Music
./Music/.localized  ← Recognized
./.gnupg
./.CFUserTextEncoding  ← Recognized
./Pictures
./Pictures/.localized  ← Recognized
./.atom
./.atom/styles.less  ← Recognized
./.atom/.apm
./.atom/.apm/cool-trim
./.atom/.apm/sb-callsite
./.atom/.apm/asap
./.atom/.apm/sb-debounce
./.atom/.apm/disposify
./.atom/.apm/sb-react-table
./.atom/.apm/loose-envify
./.atom/.apm/ms
./.atom/.apm/atom-package-deps

I noticed that links that wrap are no longer working. :(

@szhu folders never worked. https://github.com/Microsoft/vscode/issues/29499

@somewhatabstract works for me:

screen shot 2018-09-14 at 12 25 41 pm

It appears to be linked with resizing.

terminallinks

@somewhatabstract that's an unrelated bug that should get fixed with https://github.com/Microsoft/vscode/issues/23688

It worked for me before, Now it is disabled.

@b00f did you update to 1.27.2? Please report a new issue if so.

@Tyriar Thanks. It is fixed in this version. Hopefully you have integration test for this feature then it won't be an issue in later versions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

villiv picture villiv  ·  3Comments

shanalikhan picture shanalikhan  ·  3Comments

VitorLuizC picture VitorLuizC  ·  3Comments

mrkiley picture mrkiley  ·  3Comments

philipgiuliani picture philipgiuliani  ·  3Comments