Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

Commit

Permalink
fix(rome_lsp): fix the parsing of the Workspace root URI on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
leops committed Sep 8, 2022
1 parent 52f54e8 commit eaa4e13
Showing 1 changed file with 7 additions and 2 deletions.
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

0 comments on commit eaa4e13

Please sign in to comment.