-
Notifications
You must be signed in to change notification settings - Fork 181
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
Handle schemes other than the file scheme #1620
Conversation
This is a draft where I'm updating the code to handle schemes other than `file`. Points of concern: - [x] goto def should handle arbitrary URIs - [x] goto references should handle arbitrary URIs - [ ] restore output panel functionalit of goto references (or not?) - [ ] what about workspace symbols? - [ ] if a view is already open with the given URI, switch to that view instead of opening a new view. - [x] arbitrary URI schemes are handled through AbstractPlugin.on_open_uri_async - [ ] SessionBuffer (or maybe DocumentSyncListener) should be aware of what its URI is. It currently only knows its filename. Most likely, this will result in us also being able to handle buffer-only views.
So, textDocument/references understands arbitrary URIs now as well: Schermopname.2021-03-21.om.22.12.51.movAnd if an URI is not a file:// URI it goes through the AbstractPlugin extension point. |
Example on how to handle custom uris: https://github.com/sublimelsp/LSP-Deno/blob/1b5cda88f0c182424c0c1b14b36f6cafff8ec344/plugin.py#L14-L26 |
otherwise behavior is a bit weird.
We finally use the ClientConfig for path mapping as well here.
I'll write a wiki page about it if I can find the time. But basically, just never hold on to a session object. A You can test this by printing something in |
I find the reference panel more useful than showing references in the quick panel. Pros of the reference panel:
Cons of the reference panel:
Pros of the quick panel:
Cons of the quick panel:
For me the pros and cons of the reference panel are better that Suggestion: Also I noticed that the "show_references_in_quick_panel" was removed 9adb815 , |
This would still not allow clicking on the URI. As for the disadvantages of the quick panel:
I guess it's possible to make use of the targetSelectionRange for LocationLinks and range for Locations.
Is that really important information?
The built-in Goto References also has this problem. I've been running with this branch for about a month now and it's honestly not that big of a problem. Is it okay to at least roll with this for a while and see how we can improve it further? Given that panels don't understand URIs, I don't think panels have any future. That's really the bigger issue. |
I currently don't have opinion on the panel vs. quick panel but I don't think that that statement is true. A custom panel together with a custom mouse binding that triggers a custom command that parses the clicked text should be possible. |
Not really. I see that you put a lot of effort in this PR, The main issue for me is the complete removal of the reference panel, |
It’s too much work/maintenance for me to maintain two very different presentations of the same information. So let’s go with the panel solution then and see if we can make it work. |
The quick panel has the major advantage (IMO) that it's more keyboard-friendly. I can trigger |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for keeping the reference panel! :)
This is a draft where I'm updating the code to handle schemes other than
file
.Points of concern:
if a view is already open with the given URI, switch to that viewin another PRinstead of opening a new view.
SessionBuffer (or maybe DocumentSyncListener) should be aware of whatin another PRits URI is. It currently only knows its filename. Most likely, this will
result in us also being able to handle buffer-only views.