diff options
Diffstat (limited to 'helix-lsp/src/client.rs')
-rw-r--r-- | helix-lsp/src/client.rs | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/helix-lsp/src/client.rs b/helix-lsp/src/client.rs index 9ae8f20e..497ce80c 100644 --- a/helix-lsp/src/client.rs +++ b/helix-lsp/src/client.rs @@ -34,7 +34,7 @@ pub struct Client { pub(crate) capabilities: OnceCell<lsp::ServerCapabilities>, offset_encoding: OffsetEncoding, config: Option<Value>, - root_path: Option<std::path::PathBuf>, + root_path: std::path::PathBuf, root_uri: Option<lsp::Url>, workspace_folders: Vec<lsp::WorkspaceFolder>, req_timeout: u64, @@ -74,9 +74,7 @@ impl Client { let root_path = find_root(None, root_markers); - let root_uri = root_path - .clone() - .and_then(|root| lsp::Url::from_file_path(root).ok()); + let root_uri = lsp::Url::from_file_path(root_path.clone()).ok(); // TODO: support multiple workspace folders let workspace_folders = root_uri @@ -281,10 +279,7 @@ impl Client { workspace_folders: Some(self.workspace_folders.clone()), // root_path is obsolete, but some clients like pyright still use it so we specify both. // clients will prefer _uri if possible - root_path: self - .root_path - .clone() - .and_then(|path| path.to_str().map(|path| path.to_owned())), + root_path: self.root_path.to_str().map(|path| path.to_owned()), root_uri: self.root_uri.clone(), initialization_options: self.config.clone(), capabilities: lsp::ClientCapabilities { |