diff --git a/crates/lsp/src/lsp.rs b/crates/lsp/src/lsp.rs index ce90a5c068..2d789b976b 100644 --- a/crates/lsp/src/lsp.rs +++ b/crates/lsp/src/lsp.rs @@ -79,6 +79,7 @@ pub struct LanguageServer { io_tasks: Mutex>, Task>)>>, output_done_rx: Mutex>, root_path: PathBuf, + working_dir: PathBuf, server: Arc>>, } @@ -288,6 +289,7 @@ impl LanguageServer { stderr_capture, Some(server), root_path, + working_dir, code_action_kinds, cx, move |notification| { @@ -322,6 +324,7 @@ impl LanguageServer { stderr_capture: Arc>>, server: Option, root_path: &Path, + working_dir: &Path, code_action_kinds: Option>, cx: AsyncAppContext, on_unhandled_notification: F, @@ -393,6 +396,7 @@ impl LanguageServer { io_tasks: Mutex::new(Some((input_task, output_task))), output_done_rx: Mutex::new(Some(output_done_rx)), root_path: root_path.to_path_buf(), + working_dir: working_dir.to_path_buf(), server: Arc::new(Mutex::new(server)), } } @@ -566,7 +570,7 @@ impl LanguageServer { options: Option, cx: &AppContext, ) -> Task>> { - let root_uri = Url::from_file_path(&self.root_path).unwrap(); + let root_uri = Url::from_file_path(&self.working_dir).unwrap(); #[allow(deprecated)] let params = InitializeParams { process_id: None, @@ -1171,6 +1175,7 @@ impl FakeLanguageServer { Arc::new(Mutex::new(None)), None, Path::new("/"), + Path::new("/"), None, cx.clone(), |_| {}, @@ -1187,6 +1192,7 @@ impl FakeLanguageServer { Arc::new(Mutex::new(None)), None, Path::new("/"), + Path::new("/"), None, cx, move |msg| {