Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support opening links in the terminal relative to the actual cwd (not initial) #122617

Closed
pmonajem opened this issue Apr 29, 2021 · 7 comments
Closed
Assignees
Labels
*duplicate Issue identified as a duplicate of another issue(s) feature-request Request for new features or functionality linux Issues with VS Code on Linux macos Issues with VS Code on MAC/OS X terminal Integrated terminal issues terminal-links
Milestone

Comments

@pmonajem
Copy link

pmonajem commented Apr 29, 2021

Issue Type: Bug

Click to open a file path from terminal doesn't work if the relative path displayed on terminal starts from above workspace root.

Workspace root is /a/b
Our file is located at /a/b/c/d.txt

These paths work if I Alt+Click on them on the terminal :
/a/b/c/d.txt
c/d.txt
d.txt

This path won't work :
b/c/d.txt

It's arguably easy to check the root path and realize that this relative path is starting from a node above.

Use case : My compiler is printing error messages with file paths starting from a higher folder than the one added to the workspace. I can't click to open the error locations due to the path issue above.

VS Code version: Code 1.55.2 (3c4e3df, 2021-04-13T09:35:57.887Z)
OS version: Windows_NT x64 10.0.19042
Remote OS version: Linux x64 4.18.0-147.3.1.el8_1.x86_64

System Info
Item Value
CPUs Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz (8 x 2112)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
protected_video_decode: enabled
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 15.84GB (5.60GB free)
Process Argv --crash-reporter-id b7556bc8-76c5-4d1a-89ed-5ef163a08323
Screen Reader no
VM 0%
Item Value
Remote SSH: sjc-ads-4989
OS Linux x64 4.18.0-147.3.1.el8_1.x86_64
CPUs Intel(R) Xeon(R) CPU E5-2667 v4 @ 3.20GHz (16 x 3192)
Memory (System) 31.23GB (0.81GB free)
VM 100%
Extensions (23)
Extension Author (truncated) Version
better-cpp-syntax jef 1.15.5
yang mar 0.1.3
remote-containers ms- 0.166.1
remote-ssh ms- 0.65.4
remote-ssh-edit ms- 0.65.4
remote-wsl ms- 0.54.6
vscode-remote-extensionpack ms- 0.20.0
vsonline ms- 1.0.3076
tdl-extension aim 0.1.0
Bookmarks ale 13.0.4
bgforge-mls BGf 1.15.3
doxdocgen csc 1.2.0
githistory don 0.6.16
simvolio-support hy6 0.5.26
better-cpp-syntax jef 1.15.5
python ms- 2021.4.765268190
jupyter ms- 2021.5.745244803
cpptools ms- 1.3.1
cpptools-extension-pack ms- 1.0.0
vsliveshare ms- 1.0.4131
vsliveshare-audio ms- 0.1.91
vsonline ms- 1.0.3076
cmake twx 0.0.17

(5 theme extensions excluded)

@vscodebot
Copy link

vscodebot bot commented Apr 29, 2021

(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

@Tyriar Tyriar added linux Issues with VS Code on Linux macos Issues with VS Code on MAC/OS X feature-request Request for new features or functionality help wanted Issues identified as good community contribution opportunities terminal Integrated terminal issues labels May 3, 2021
@Tyriar Tyriar added this to the Backlog milestone May 3, 2021
@Tyriar
Copy link
Member

Tyriar commented May 3, 2021

We can fetch the cwd now for the terminals but only on macOS or Linux, not Windows.

@Tyriar Tyriar changed the title Relative file path issue on terminal Support opening links in the terminal relative to the actual cwd May 3, 2021
@Tyriar Tyriar changed the title Support opening links in the terminal relative to the actual cwd Support opening links in the terminal relative to the actual cwd (not initial) May 3, 2021
@pmonajem
Copy link
Author

pmonajem commented May 4, 2021

We can fetch the cwd now for the terminals but only on macOS or Linux, not Windows.

The updated title somewhat changes from the original description, although it can still be helpful. You're suggesting to check current terminal's CWD, my thought was for the file search to be more flexible about the input path relative to the ws root, meaning it could process the b/c/d.txt path in the example if root is /a/b/

@juliombb
Copy link

juliombb commented Sep 5, 2021

I tried reproducing this in macOS (big sur 11.2.3) but could not (it worked)
the vscode version in which I tried was 1.60.0

@pmonajem
Copy link
Author

pmonajem commented Sep 7, 2021

I tried reproducing this in macOS (big sur 11.2.3) but could not (it worked)
the vscode version in which I tried was 1.60.0

To be sure, the files I'm trying to open are not part of the workspace itself. In case the file you were trying to open was added to the workspace.

@Tyriar Tyriar removed the help wanted Issues identified as good community contribution opportunities label Oct 18, 2021
@Tyriar
Copy link
Member

Tyriar commented Oct 18, 2021

One complication that comes up here is that different sections of the buffer have different cwd, so links could act differently depending on whether you cd'd to another directory or not. We may want to record when the cwd changes against a line and evaluate the links using that. Related: #133084

@Tyriar Tyriar modified the milestones: Backlog, January 2022 Jan 10, 2022
@Tyriar
Copy link
Member

Tyriar commented Jan 13, 2022

/duplicate #139408

@Tyriar Tyriar closed this as completed Jan 13, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Feb 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*duplicate Issue identified as a duplicate of another issue(s) feature-request Request for new features or functionality linux Issues with VS Code on Linux macos Issues with VS Code on MAC/OS X terminal Integrated terminal issues terminal-links
Projects
None yet
Development

No branches or pull requests

5 participants
@Tyriar @juliombb @meganrogge @pmonajem and others