This repository has been archived by the owner on Aug 31, 2023. It is now read-only.
fix(rome_lsp): fix the parsing of the Workspace root URI on Windows #3185
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #3182
In the Language Server Protocol, the path to the workspace root is sent from the editor to the language server as a URI. In order to load the configuration file from the disk we need to parse this URI as a filesystem path, previously this was done by extracting the path segment of the URI which works on Unix systems (the URI
file:///home/user/workspace
becomes the path/home/user/workspace
) but is not sufficient on Windows where the drive ID needs to be decoded: the URIfile:///c%3A/users/user/workspace
should be parsed asc:/users/user/workspace
but was previously interpreted as/c%3A/users/user/workspace
Test Plan
Unfortunately this relies on OS-specific code (the implementation of the
Uri::to_file_path
differs depending on the target platform) so it's hard to test automatically as we do not run tests on Windows. Instead I just built and run the language server locally and verified it could parse the workspace path and load the configuration file correctly on Windows