fix(rome_lsp): fix the parsing of the Workspace root URI on Windows
MODIFY
crates/rome_lsp/src/session.rs
crates/rome_lsp/src/session.rs
@@ -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;
@@ -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)) => {

fix(rome_lsp): fix the parsing of the Workspace root URI on Windows (#3185)