-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
Allow extensions to contribute links to the terminal (aka link providers) #91290
Comments
@alexr00 this could be useful for GH: I just clicked it instinctively even though I knew it was going to fail 😄 |
Unknown: How do link providers conflicts resolve? If you have GitLens and GitHub PR installed and click on a commit, who wins? Should we show both in the hover in this case and ctrl+click lets you select the default/priority? |
Yeah, I think it should be left up to the user. Showing both providers on the hover popup could work well. Ctrl+click without a default set would force the user to use the popup and choose one. Maybe also a dialog when they click a default for the first time, something like: "Do you want to make this the default link handler for this type of link?". And also there should be a way to change/reset the defaults. This might be able to be directly on the hover popup (For Example: Highlight the default provider with an "x" to reset it), as long it isn't too cluttered. |
I like this idea:
That way you can action it both ways, change the click behavior right in the hover. I guess behind the scenes we'd just track the decision that extension A beats out extension B. |
Current xterm API: This will change to this soon to avoid unconsistent links based on what is hovered first: interface ILinkProvider {
provideLinks(position: IBufferCellPosition, callback: (links: ILink[] | undefined) => void): void;
} |
Idea: a |
Aligns more with other APIs Part of #91290
Things to discuss in API call:
|
Isn't this already handled? In the definition above, it's returning a The API looks like it should support what I want (Dart-Code/Dart-Code#2581 (comment)), though if there may be further changes (eg. returning a |
Because of the possible changes to |
@DanTup the old proposal comment isn't up to date: vscode/src/vs/vscode.proposed.d.ts Lines 1067 to 1070 in d95b654
|
Feedback from call:
|
Looks like this will stay proposed this iteration and finalize next, please test it out and give feedback now before it's too late 😃 |
@Tyriar I tried the proposed API on the terminal output from Java Debugger, it works well. Here is a demo to detect the Java exception stacktrace in the terminal. Only one tiny feedback is to allow the provider show inline message when no result after clicking the link. User Scenario:In Java Debugger, it launches the Java application in the terminal by default. And many users expect the exception stacktrace printed to the terminal to be clickable and able to jump to the source file. This proposed API satisfies the feature pretty well. Thanks for this awesome API. Regarding the implementation, we just use regular expression in the provideTerminalLinks API to check whether the current line looks like a stacktrace. This will keep the provideTerminalLinks fast and lightweight. And only when the user clicks the link, then searching the source mapping at the backend and jump to the file if there is result. Meanwhile, if no source found on clicking, we want to show some inline message to feedback user. Expected:Expect to display inline message inside the terminal, just like what the "go to definition" action did, where it displays an inline message inside the editor if no definition found. |
@testforstephen great feedback thanks!
The intent for the API is that if you provide a link, you must do something when it's clicked. I suggest reverting to the default behavior and trigger a quick open search for something relevant, in your case either a symbol search for I'm not sure how you do this via the API exactly I'm sure it's possible though. Maybe running the command |
Moved the API to stable and added a sample: microsoft/vscode-extension-samples@83261e3 |
This was tested last iteration, to verify run the new sample and make sure it works as expected. |
Currently the way terminal links work is by waiting until the viewport has stopped updating and then parsing the entire viewport. This has a few problems, most notable the performance cost of validating this every time (particularly bad on some environments,
terminal.integrated.enableFileLinks
was added to allow people to disable it) and this awfulness:vscode/src/vs/workbench/contrib/terminal/browser/terminalLinkHandler.ts
Lines 40 to 47 in f6bd0ba
xterm.js just recently merged a new link provider API that allows moving away from this regex approach and instead resolving links when a hover happens. The PR to adopt this API is here #90336.
@connor4312 and I just wrote up this proposal as a starting point for allowing extensions to leverage this API. This has some really cool possibilities:
at Script.runInThisContext (vm.js:96:20)
)Some notes/questions/unknowns:
The text was updated successfully, but these errors were encountered: