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

Terminal link detection issues #21125

Closed
alexdima opened this issue Feb 22, 2017 · 29 comments
Closed

Terminal link detection issues #21125

alexdima opened this issue Feb 22, 2017 · 29 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug terminal Integrated terminal issues terminal-links upstream Issue identified as 'upstream' component related (exists outside of VS Code) upstream-issue-linked This is an upstream issue that has been reported upstream verified Verification succeeded
Milestone

Comments

@alexdima
Copy link
Member

Testing #21021

linkComputer.test.ts contains a set of tests used for editor link detection. Some links that do not get fully detected in the terminal. Some do get detected, but partially or contain trailing periods, etc:

// Click here to learn more. https://go.microsoft.com/fwlink/?LinkID=513275&clcid=0x409
// Click here to learn more. https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).
aspx
<!-- !!! Do not remove !!!   WebContentRef(link:https://go.microsoft.com/fwlink/?LinkId=166007, area:Adm
in, updated:2015, nextUpdate:2016, tags:SqlServer)   !!! Do not remove !!! -->
For instructions, see https://go.microsoft.com/fwlink/?LinkId=166007.</value>
For instructions, see https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx.</
value>
x = "https://en.wikipedia.org/wiki/Zürich";
請參閱 http://go.microsoft.com/fwlink/?LinkId=761051。
x = "file:///foo.bar";
x = "file://c:/foo.bar";
x = "file://shäres/foo.bar";
Some text, then http://www.bing.com.
@Tyriar Tyriar modified the milestones: February 2017, March 2017 Feb 22, 2017
@Tyriar Tyriar added bug Issue identified by VS Code Team member as probable bug terminal Integrated terminal issues labels Feb 23, 2017
@Tyriar
Copy link
Member

Tyriar commented Mar 3, 2017

Upstream issue xtermjs/xterm.js#583

@Tyriar Tyriar modified the milestones: March 2017, Backlog Mar 3, 2017
@Tyriar Tyriar added the upstream Issue identified as 'upstream' component related (exists outside of VS Code) label Mar 3, 2017
@Tyriar
Copy link
Member

Tyriar commented Dec 22, 2017

Another case from #21361:

bash-3.2$ echo "https://task.krümplr.com/signup?referral=51cfe998f397460200000001"
https://task.krümplr.com/signup?referral=51cfe998f397460200000001
bash-3.2$

@Tyriar
Copy link
Member

Tyriar commented Dec 23, 2017

Another case from #31460:

https://api.darksky.net/forecast/YOURAPIKEY/-23.5567497,-46.6541193'

@kachkaev
Copy link

kachkaev commented Mar 21, 2018

I also face an issue with links that contain spaces:

# works
/path/to/file.yml

# does not work and I don't expect it to
/path/to/file with spaces.yml

# does not work, but it'd be great if it worked
/path/to/file\ with\ spaces.yml

# does not work too
/path/to/file%20with%20spaces.yml

After trying various combinations of backslashes, quotes etc., I could not find any means to make a path that contains spaces highlightable and clickable. This would be useful in linting reports.

UPD: Actually, supporting /path/to/file with space.yml would be probably a right thing despite that it's harder to implement – this would make the life of all command line tool developers easier.

The parser can find /path/to/file (before the first space) and then start eating forthcoming words while /path/to is a valid directory and until the eaten string matches the existing file or is too long to parse. Supporting spaces in non-file links is not necessary as this is not supported anyway.

@mike-zorn
Copy link

Similarly, http://1.9.0.21:99 does not work

@Tyriar
Copy link
Member

Tyriar commented Mar 23, 2018

@ApeChimp that should work?

screen shot 2018-03-23 at 9 49 45 am

@mike-zorn
Copy link

That does work. I think it must have something to do with how the program that is outputting my url outputs it then. I'll see if I can isolate it.

@Hbbb
Copy link

Hbbb commented Sep 12, 2018

I'm seeing this issue after updating to 1.27.1

Specifically relative file paths beginning with a . are no longer clickable. This is a big workflow hit for me because I often run unit tests in the integrated terminal and I rely on the links being clickable to quickly open files associated with test failures.

I've tried running code --disable-extensions and am still able to reproduce the bug. I can confirm this worked before updating to 1.27.1

@Tyriar
Copy link
Member

Tyriar commented Sep 12, 2018

@Hbbb that's another issue that is fixed in 1.27.2

@Tyriar
Copy link
Member

Tyriar commented Sep 22, 2018

Currently links on Windows don't work when the opened folder (initial cwd) has a space in the path because this regex pulls the section before the first space (#59052):

https://github.com/Microsoft/vscode/blob/079518239fa8643678b74ef87fbe687ce760e3c7/src/vs/workbench/parts/terminal/electron-browser/terminalLinkHandler.ts#L304-L310

This doesn't appear to be easily to fix so deferring until xtermjs/xterm.js#583

@Geobert
Copy link

Geobert commented Oct 23, 2018

I also have this issue with paths that wrap on 2 lines when using vertical terminal layout.
1.27.2 on Windows

@Tyriar
Copy link
Member

Tyriar commented Jan 8, 2019

Another issue: #66182

https://chromium-review.googlesource.com/c/chromium/src/+/1399451

image

@Tyriar
Copy link
Member

Tyriar commented Jan 11, 2019

Case from #66391: console.log("https://github.com/Microsoft/vscode-piñata");

@Fire-
Copy link

Fire- commented Feb 25, 2020

Just adding my 2c ( and a thumb's up ) from OSX: file paths tend to work correctly for me unless they are in the root of the current directory.

For example, anything in a subdirectory (.vscode/) correctly hyperlinks, while anything in the root ( like Rakefile ) never hyperlinks

image

@Tyriar
Copy link
Member

Tyriar commented Apr 12, 2020

#90336 just got merged which fixes the majority of web/protocol related links as it uses the same link detector as the editor. To turn on this new feature (in tomorrow's Insiders) you can set this in settings:

"terminal.integrated.experimentalLinkProvider": true

Note that while more web cases will be covered, using this setting will break all local file link detection currently. The plan is to keep this issue open until the functionality gap is closed and provider-based is the new default.

@Tyriar
Copy link
Member

Tyriar commented Apr 13, 2020

Ok scratch that, after merging in #95072, functionality should be just as good as with the old system. Here's a demo of what you get, notice the trailing . on the URL isn't part of the link and any word can be clicked which triggers and auto-fills quick access.

Kapture 2020-04-12 at 18 57 10

@Tyriar
Copy link
Member

Tyriar commented May 15, 2020

Lots of work has happened in this area recently. In stable you can turn on the new "link provider" based links in the terminal that will fix a lot of these problems, and should cover all the ones in the original issue comment as the terminal now leverages monaco's detection for web/file protocol links. I'm going to call this finished with #96266

If there is still support missing, feel free to file issues on them, but note that for more obscure links it will soon be possible to detect links within extensions so I may close it in favor of that. See #91290 for the API proposal (I'll be updating that issue soon).

@Tyriar
Copy link
Member

Tyriar commented Jun 1, 2020

To verifier: Test the links in the original comment.

@lramos15 lramos15 added the verified Verification succeeded label Jun 5, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Jul 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug terminal Integrated terminal issues terminal-links upstream Issue identified as 'upstream' component related (exists outside of VS Code) upstream-issue-linked This is an upstream issue that has been reported upstream verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

16 participants