-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Generic link provider #2893
Comments
That's essentially what the old API can accomplish: Lines 730 to 750 in 939de5d
But this one's on the way out, there's been a bunch of work done recently on the "link provider" API that gets asks for lines at a particular cell: Lines 752 to 758 in 939de5d
The link provider API will probably soon ask for all links on a particular line, see #2848 |
Are there other link provider addons available beyond the web links one? Main intention behind this request was to make it easier to craft new link providers with just {match, replacement template} instead of having to build a full addon for each snippet you want to match. |
Only the web one is in this repo, there are more examples in the vscode repo though: Isn't the link matcher API basically what you're after? I'm not sure exactly what you had in mind with strategy, but that API lets you set a regex, matchIndex to use and then a handler (which is needed for most cases so it's mandatory). Perhaps we should tweak that into a |
I do see that this is what the original API being deprecated allows. I think a Let me give some examples of what I'm after.
This addon allows matching different captures of the regex. Maybe the core idea is |
Oh ok that makes sense. This new API would also need to surface these APIs so embedders could use them to give underline feedback, modifier clicks and tooltips in a consistent way: Lines 1124 to 1152 in 1168c6c
|
Maybe there should be a new class in the API instead: class RegexLinkProvider implements ILinkProvider {
...
} That way there's no need to worry about exposing/duplicating |
+1 for the regexp link provider idea. @Tyriar If we spawn things directly from |
@jerch yes order is important, but the order is defined by the embedder so all good. |
The constructor for |
@rodolf0 the link matcher system used a priority, link providers priority is defined by the order they are registered, so it's in complete control of the embedding application. That's called out here: Lines 754 to 755 in 1168c6c
|
@rodolf0 |
Hey @LabhanshAgrawal this is super cool! Per my understanding the callback is invoked with a range and the text matched correct? Is there a chance to also invoke the callback with the returned match object from |
I'm not sure if I understand your example fully |
I think this ask is covered by https://github.com/LabhanshAgrawal/xterm-link-provider |
The web link add-on allows matching a restricted set of text (eg. Http links) and lifting that into an object you can interact with.
Would it be possible to create a slightly more general version of it? It would takes 2 construction parameters:
The text was updated successfully, but these errors were encountered: