-
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
Mismatching normalized URI in plugin system #11179
Comments
@msujew, do you have any thoughts here? Is the mistake allowing the ill-formed URI in the first place (and we should modify our URI implementations to do some normalization when the URI is created), or is the mistake the fact that we do normalize at some point - probably resource resolution - and so depart from the input we've received? VSCode recently added a |
@colin-grant-work I guess it's a combination of both. Something that irked me quite for a while already was the fact that we effectively use two different URI/path implementations. See for example: const uri = new URI('file:///tmp//doubleslash');
const vscodeUriString = uri.toString(); // this will result in file:///tmp//doubleslash'
const theiaUriString = uri.schema + uri.path.toString(); // this will result in 'file:///tmp/doubleslash' Note the missing doubleslash in the We could go the same way as vscode and implement such an identity service. Alternatively, we could feed the normalized path back into the vscode URI after parsing it from a string, but I'm not sure how safe this is, considering we have parts of the app (plugin side) which almost exclusively deals in vscode URIs. |
Yikes - that's no good at all! |
@colin-grant-work Nvm, I believe it does only do that if we actually manually call theia/packages/core/src/common/path.ts Lines 145 to 146 in d8a6ab4
|
Bug Description:
This plugin uses the following sequence of calls to open, reveal, and set the selection in an editor:
https://github.com/alefragnani/vscode-bookmarks/blob/83483c19da24c2246436592b262f871f1cd39a17/src/extension.ts#L205-L213
For whatever reason - likely to do with workspace handling - the URI sometimes contains a double slash, e.g.
This gets through the
openTextDocument
call fine, but inshowTextDocument
we have this code:theia/packages/plugin-ext/src/plugin/plugin-context.ts
Lines 385 to 391 in f4409b0
The URI that is given by
editor.document.uri.toString()
is normalized to something likewith no double slash, so the
.find
call returnsundefined
, and we throw an error in line 390, even though the document has actually been shown.Steps to Reproduce:
Additional Information
master
The text was updated successfully, but these errors were encountered: