Skip to content
This repository was archived by the owner on Aug 31, 2023. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions crates/rome_lsp/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,11 @@ impl Session {
.to_file_path()
.map_err(|()| anyhow!("failed to convert {url} to a filesystem path"))?;

let relative_path = {
let root_uri = self.root_uri.read().unwrap();
root_uri.as_ref().and_then(|root_uri| {
let root_path = root_uri.to_file_path().ok()?;
path_to_file.strip_prefix(&root_path).ok()
})
};
let relative_path = self.initialize_params.get().and_then(|initialize_params| {
let root_uri = initialize_params.root_uri.as_ref()?;
let root_path = root_uri.to_file_path().ok()?;
path_to_file.strip_prefix(&root_path).ok()
});

if let Some(relative_path) = relative_path {
path_to_file = relative_path.into();
Expand Down