-
Notifications
You must be signed in to change notification settings - Fork 318
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
Invalid file URIs on Windows #105
Comments
CC @jrieken |
Our URI implementation doesn't perform scheme-dependent serialisation but uses the default percentage encoding/decoding. You can also observe that when serialising an http uri that uses Generally, our URI guarantees that When calling @felixfbecker Is this a problem because you are passing on our serialised URIs to another library and that fails to parse them or is this just an observation? |
@jrieken It caused the PHP language server (which is implemented in PHP) to crash because the URI implementation there did not not handle this case. It performed a match against the URI to check if it is a well-formed Windows file URI, and if yes, stripped the leading slash. Since this match failed, file paths were left with a trailing backslash, which caused the LS to crash when trying to read the file from disk. I implemented a workaround to handle this case but it is technically not a valid file URI. I don't know what |
As said encoding is scheme-specific (https://tools.ietf.org/html/rfc3986#section-2.2) and we have not implemented that. I am aware on What I have observed form implements like C# |
Here is the workaround I implemented: felixfbecker/php-language-server@66b5176 So imo the mistake is on VS Code's side. Maybe you could at least do a check for |
@felixfbecker there is a way how you can address this on the client itself. The LanguageClient allows you to pass in a uriConverter which we call whenever a URI flows from the client to the server and vice versa. See https://github.com/Microsoft/vscode-languageserver-node/blob/master/client/src/main.ts#L359 |
I worked around this with a custom URI converter, by first letting VS Code format without encoding, then parse and format it by NodeJS's |
I leave the answer up to @jrieken :-) |
I think everybody knows the answer - cough standalone editor, single code base cough |
Sorry, I don't understand? Are you not allowed to use Node native modules? There is a shim for the URI module on NPM for the browser (automatically used by Browserify). |
FYI, Node 7 has just been released and includes an implementation of the WHATWG URL standard: I think that would be great to use as it is available in browsers as well and can be polyfilled if not. |
@felixfbecker I think we are beyond the point changing this now. And with the URI rewiter code that is available on the client you can always adopt this nicely. Any objection to close. |
No, I can live with my workaround. I still think VS Code / Monaco should sooner or later move away from (inferior) "home-cooked" implementations for basic things like URI parsing, globbing, type checking etc. Just my 2ct 😄 |
The client %-encodes the colon after the drive letter on Windows, which is not how file URIs are done under Windows: https://en.wikipedia.org/wiki/File_URI_scheme#Windows
Just an exempt from a stack trace I just got:
The text was updated successfully, but these errors were encountered: