Skip to content
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

Merged
merged 1 commit into from
Sep 8, 2022
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
9 changes: 7 additions & 2 deletions crates/rome_lsp/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use rome_service::workspace::{FeatureName, PullDiagnosticsParams, SupportsFeatur
use rome_service::{load_config, Workspace};
use rome_service::{DynRef, RomeError};
use std::collections::HashMap;
use std::path::PathBuf;
use std::sync::Arc;
use std::sync::RwLock;
use tokio::sync::Notify;
Expand Down Expand Up @@ -176,7 +175,13 @@ impl Session {
/// This function attempts to read the configuration from the root URI
pub(crate) async fn update_configuration(&self) {
let root_uri = self.root_uri.read().unwrap();
let base_path = root_uri.as_ref().map(|uri| PathBuf::from(uri.path()));
let base_path = root_uri.as_ref().and_then(|root_uri| match root_uri.to_file_path() {
Ok(base_path) => Some(base_path),
Err(()) => {
error!("The Workspace root URI {root_uri:?} could not be parsed as a filesystem path");
None
}
});

match load_config(&self.fs, base_path) {
Ok(Some(configuration)) => {
Expand Down