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

Linkify terminal paths without any path separators #22772

Closed
Tyriar opened this issue Mar 17, 2017 · 11 comments
Closed

Linkify terminal paths without any path separators #22772

Tyriar opened this issue Mar 17, 2017 · 11 comments
Assignees
Labels
*duplicate Issue identified as a duplicate of another issue(s) feature-request Request for new features or functionality terminal Integrated terminal issues
Milestone

Comments

@Tyriar
Copy link
Member

Tyriar commented Mar 17, 2017

Follow up from #22528, #22602

Currently we're limited to the current workspace (knowledge of shell's cwd is blocked on #20676), but it would be good to linkify files in the current directory that don't have path separators. This would linkify the files in ls for example:

❯ ls
build       node_modules  scripts  appveyor.yml     issue_template.md  npm-shrinkwrap.json  product.json           tsfmt.json
extensions  out           src      CONTRIBUTING.md  jsconfig.json      OSSREADME.json       README.md              tslint.json
i18n        resources     test     gulpfile.js      LICENSE.txt        package.json         ThirdPartyNotices.txt
@Tyriar Tyriar added feature-request Request for new features or functionality help wanted Issues identified as good community contribution opportunities terminal Integrated terminal issues labels Mar 17, 2017
@Tyriar Tyriar added this to the Backlog milestone Mar 17, 2017
@Tyriar Tyriar self-assigned this Mar 17, 2017
@lifez
Copy link
Contributor

lifez commented Apr 12, 2017

@Tyriar Can i take this ?. Could you guide me a little

@Tyriar
Copy link
Member Author

Tyriar commented Apr 12, 2017

@lifez sure that would be great 😃

I'm a little concerned that this might be bad for perf if we're constantly checking whether files exist like this. It would be good to look into whether we could cache the results of an pfs.readdir so we don't need to stat each individual file. Let me know if you need more guidance.

@lifez
Copy link
Contributor

lifez commented Apr 13, 2017

@Tyriar Linkify is mean we can click to file within vscode terminal ?

@Tyriar
Copy link
Member Author

Tyriar commented Apr 17, 2017

@lifez yes linkify means add a link to the path.

@Tyriar
Copy link
Member Author

Tyriar commented Jul 10, 2017

Current we don't have knowledge of the cwd but eventually we will #27107 so if we're building some cache we would want to allow support for different cwd. Also when are they invalidated? Should the file watcher come into play here?

@Tyriar
Copy link
Member Author

Tyriar commented Jan 22, 2018

Related #25024

@ssbarnea
Copy link

ssbarnea commented Dec 6, 2018

This bug is more importan than it gives impression in its description before it breaks even linters with standardized output, like:

scripts/compare-reviews.py:64:1: H405: multi line docstring summary not separated with an empty line
testenv-client:68:80: E501 line too long (100 > 79 characters)

First one is linkified but the second one is not, just because it does not have a slash in the file name.

@Tyriar
Copy link
Member Author

Tyriar commented Oct 23, 2019

I would like to work on this. What would be a good starting point for adding this functionality?

@sohailrajdev97 I closed #82903 in favor of this one as thinking about it more I don't think we should invest in links specifically for java and instead improve all languages. I think this issue has a number of things we can do:

  • Firstly we will need to be able to disable the current local link validation step that checks the file system, right now there is enableFileLinks which allows disabling outright:
    'terminal.integrated.enableFileLinks': {

    We could improve this by still allowing links but not validate them (until clicked). An exception or notification is probably shown when files don't exist right now, this might need some thinking if failures will become more prevalent.
  • After the above is done we could allow just file names to be supported as there is no longer the risk on the file system
  • An idea that came to me when reading Linkify unqualified file names in the terminal #82903 was that for files that do not have exact matches (cwd + file_link) we could open a quick pick and search the workspace for it, essentially a shortcut for ctrl/cmd+p

The above could be tackled as individual steps/PRs.

All terminal link code is in https://github.com/microsoft/vscode/blob/master/src/vs/workbench/contrib/terminal/browser/terminalLinkHandler.ts, it used this API in xterm.js to add the links: https://github.com/xtermjs/xterm.js/blob/d9f58c0dbbd73145779586a9a4caddba3871ffc1/typings/xterm.d.ts#L524-L534

@sohailrajdev97
Copy link
Member

@Tyriar As we won't be validating the links with the filesystem until it's clicked, what can be the expected behavior when a link which points to a directory is clicked ?

In other words, how will this be handled in the new scenario ?

@Tyriar
Copy link
Member Author

Tyriar commented Oct 25, 2019

@sohailrajdev97 I actually did some thinking and a big write up on a proposal to change how links work all together in xterm.js which should also allow us to tackle this problem in a nicer way as well as fix a bunch of other problems/inconsistencies with the terminal's link detection. See xtermjs/xterm.js#583 (comment)

For that particular case in the new system that validation would happen on hover.

@Tyriar
Copy link
Member Author

Tyriar commented Aug 27, 2021

This is done 🎉 any link that doesn't have a high accuracy link will revert to searching the workspace and opening the file if there's one match or the quick pick if there are multiple.

@Tyriar Tyriar closed this as completed Aug 27, 2021
@Tyriar Tyriar added the *duplicate Issue identified as a duplicate of another issue(s) label Aug 27, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Oct 11, 2021
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 terminal Integrated terminal issues
Projects
None yet
Development

No branches or pull requests

4 participants