-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Implement CanonicalUriProvider API. Fixes #12735 #12743
Implement CanonicalUriProvider API. Fixes #12735 #12743
Conversation
The implementation follows the usual pattern of having a Theia service for canonicla URI's with the VS Code implementation being a special case of the Theia service contributions. The API is proposed in VS Code, but used in built-in extensions in versions >= 1.80.0 Contributed on behalf of STMicroelectronics Signed-off-by: Thomas Mäder <t.s.maeder@gmail.com>
here's the vsix: and here's the source: |
alternatively, you could also test with the 1.80.0 version of the "github" built-in. Here's a prebuilt copy: for this to works, you'll need to replace the |
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.
I'm always getting The canonical URI is undefined
for every URI that I enter for every option (uppercase
/lowercase
/https
).
vscode.Uri.parse(decodeURI(uri.toString()))
I believe the code above (extracted from the extension source) isn't correct. Uri.parse
expects a string that has been created by calling uri.toString()
. If you run decodeURI
in between that, you create an invalid URI string that can no longer be parsed.
This works for me. Did you call the "Register Canonical URI Provider" command before testing the conversion? |
Signed-off-by: Thomas Mäder <t.s.maeder@gmail.com>
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.
Looking at the source code, it seems like only URIs with the testScheme
scheme are viable as input for the extension. The test instructions only mentioned:
Enter a uri
Which didn't work for any old URI I tried. Using testScheme
works as expected though.
Looks good to me 👍
That's my 🤦 |
Signed-off-by: Thomas Mäder <t.s.maeder@gmail.com>
What it does
The implementation follows the usual pattern of having a Theia service for canonicla URI's with the VS Code implementation being a special case of the Theia service contributions.
The API is proposed in VS Code, but used in built-in extensions in versions >= 1.80.0
Contributed on behalf of STMicroelectronics
How to test
Add the attached extension to the plugins folder. It provides two commands: one to "Register Canoniccal URI Provider" and one to "Convert to Canonical URI". The first one registers a provider we can test with the second command. To test, invoke the command, then
Review checklist
Reminder for reviewers