@@ -34,7 +34,7 @@ pub struct Client {
34 pub(crate) capabilities: OnceCell<lsp::ServerCapabilities>,
34 pub(crate) capabilities: OnceCell<lsp::ServerCapabilities>,
35 offset_encoding: OffsetEncoding,
35 offset_encoding: OffsetEncoding,
36 config: Option<Value>,
36 config: Option<Value>,
37− root_path: Option<std::path::PathBuf>,
37+ root_path: std::path::PathBuf,
38 root_uri: Option<lsp::Url>,
38 root_uri: Option<lsp::Url>,
39 workspace_folders: Vec<lsp::WorkspaceFolder>,
39 workspace_folders: Vec<lsp::WorkspaceFolder>,
40 req_timeout: u64,
40 req_timeout: u64,
@@ -74,9 +74,7 @@ impl Client {
75 let root_path = find_root(None, root_markers);
75 let root_path = find_root(None, root_markers);
77− let root_uri = root_path
79− .and_then(|root| lsp::Url::from_file_path(root).ok());
77+ let root_uri = lsp::Url::from_file_path(root_path.clone()).ok();
81 // TODO: support multiple workspace folders
79 // TODO: support multiple workspace folders
82 let workspace_folders = root_uri
80 let workspace_folders = root_uri
@@ -281,10 +279,7 @@ impl Client {
281 workspace_folders: Some(self.workspace_folders.clone()),
279 workspace_folders: Some(self.workspace_folders.clone()),
282 // root_path is obsolete, but some clients like pyright still use it so we specify both.
280 // root_path is obsolete, but some clients like pyright still use it so we specify both.
283 // clients will prefer _uri if possible
281 // clients will prefer _uri if possible
287− .and_then(|path| path.to_str().map(|path| path.to_owned())),
282+ root_path: self.root_path.to_str().map(|path| path.to_owned()),
288 root_uri: self.root_uri.clone(),
283 root_uri: self.root_uri.clone(),
289 initialization_options: self.config.clone(),
284 initialization_options: self.config.clone(),
290 capabilities: lsp::ClientCapabilities {
285 capabilities: lsp::ClientCapabilities {