aboutsummaryrefslogtreecommitdiff
path: root/helix-lsp/src
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-06-07 12:32:01 +0000
committerBlaž Hrastnik2021-06-07 12:32:01 +0000
commit8d6fad4cac65083a0b08e49391c579ec793bc8f3 (patch)
tree80c2f9dd475e6d141d7828a1b7224cd316a7bc82 /helix-lsp/src
parent14830e75ff9316f8a5a428a06f3b3c8c4706d35a (diff)
lsp: Provide workspace root on client.initialize()
Diffstat (limited to 'helix-lsp/src')
-rw-r--r--helix-lsp/src/client.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/helix-lsp/src/client.rs b/helix-lsp/src/client.rs
index 8a3aabd9..a1c1134a 100644
--- a/helix-lsp/src/client.rs
+++ b/helix-lsp/src/client.rs
@@ -3,7 +3,7 @@ use crate::{
Call, Error, OffsetEncoding, Result,
};
-use helix_core::{ChangeSet, Rope};
+use helix_core::{find_root, ChangeSet, Rope};
// use std::collections::HashMap;
use std::future::Future;
@@ -218,13 +218,14 @@ impl Client {
pub async fn initialize(&mut self) -> Result<()> {
// TODO: delay any requests that are triggered prior to initialize
+ let root = find_root(None).and_then(|root| lsp::Url::from_file_path(root).ok());
#[allow(deprecated)]
let params = lsp::InitializeParams {
process_id: Some(std::process::id()),
+ // root_path is obsolete, use root_uri
root_path: None,
- // root_uri: Some(lsp_types::Url::parse("file://localhost/")?),
- root_uri: None, // set to project root in the future
+ root_uri: root,
initialization_options: None,
capabilities: lsp::ClientCapabilities {
text_document: Some(lsp::TextDocumentClientCapabilities {