-
Notifications
You must be signed in to change notification settings - Fork 62
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
Fix Windows by handling Url paths correctly. #136
Conversation
Previous implementation was mixing Url paths with file paths. It caused errors like: "Error: `file:///C:/work/bazel_plain/sample.bzl` could not be converted back to a URL\n" More: cameron-martin/bazel-lsp#62 The Url.path() is usually `"/" + path to file` which works fine as file path under unix-like systems, but breaks under Windows, where it can be e.g. "/c:/some/file". See https://en.wikipedia.org/wiki/Uniform_Resource_Identifier#syntax Switched to using Url.to_file_path() which represents actual file path. In the process: - Enabled back Windows tests that at least for my machine started passing; - In validate() function not converting from Url to LspUrl and back, just returning to client Url passed in the request.
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.
Awesome! Thanks for this fix, a really nice improvement. One question around the test paths, let me know what seems best here, and then I'll merge it.
@ndmitchell has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Summary: Previous implementation was using `Url.path()` where it should use `Url.to_file_path()` It caused errors like: ``` "Error: `file:///C:/work/bazel_plain/sample.bzl` could not be converted back to a URL\n" ``` More: cameron-martin/bazel-lsp#62 The `Url.path()` is usually `"/" + path to file` which works fine as file path under unix-like systems, but breaks under Windows, where it can be e.g. `"/c:/some/file"`. See https://en.wikipedia.org/wiki/Uniform_Resource_Identifier#syntax Switched to using `Url.to_file_path()` which represents actual file path. In the process: - Enabled back Windows tests that at least for my machine started passing; - In validate() function not converting from Url to LspUrl and back, just returning to client Url passed in the request. X-link: facebook/starlark-rust#136 Reviewed By: KapJI Differential Revision: D66655476 Pulled By: ndmitchell fbshipit-source-id: b4590fb27348019424e27ee1d12ffe27d86c6f9f
@ndmitchell merged this pull request in 760df74. |
Previous implementation was using
Url.path()
where it should useUrl.to_file_path()
It caused errors like:
More: cameron-martin/bazel-lsp#62
The
Url.path()
is usually"/" + path to file
which works fine as file path under unix-like systems, but breaks under Windows, where it can be e.g."/c:/some/file"
. Seehttps://en.wikipedia.org/wiki/Uniform_Resource_Identifier#syntax
Switched to using
Url.to_file_path()
which represents actual file path.In the process: