aboutsummaryrefslogtreecommitdiff
path: root/helix-lsp/src/client.rs
diff options
context:
space:
mode:
authorPascal Kuthe2023-01-30 23:31:21 +0000
committerBlaž Hrastnik2023-03-29 03:57:30 +0000
commit2d10a429ebf7abe5af184b6227346377dc0523e8 (patch)
tree114b19f0031fc001d7798a31372675a94623262f /helix-lsp/src/client.rs
parentd59b80514e15d26f280a9b0dbd18afac08578638 (diff)
add workspace config and manual LSP root management
fixup documentation Co-authored-by: LeoniePhiline <22329650+LeoniePhiline@users.noreply.github.com> fixup typo Co-authored-by: LeoniePhiline <22329650+LeoniePhiline@users.noreply.github.com>
Diffstat (limited to 'helix-lsp/src/client.rs')
-rw-r--r--helix-lsp/src/client.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/helix-lsp/src/client.rs b/helix-lsp/src/client.rs
index f93e5826..34e4c346 100644
--- a/helix-lsp/src/client.rs
+++ b/helix-lsp/src/client.rs
@@ -1,22 +1,22 @@
use crate::{
- jsonrpc,
+ find_root, jsonrpc,
transport::{Payload, Transport},
Call, Error, OffsetEncoding, Result,
};
-use helix_core::{find_root, ChangeSet, Rope};
+use helix_core::{ChangeSet, Rope};
use helix_loader::{self, VERSION_AND_GIT_HASH};
use lsp::PositionEncodingKind;
use lsp_types as lsp;
use serde::Deserialize;
use serde_json::Value;
-use std::collections::HashMap;
use std::future::Future;
use std::process::Stdio;
use std::sync::{
atomic::{AtomicU64, Ordering},
Arc,
};
+use std::{collections::HashMap, path::PathBuf};
use tokio::{
io::{BufReader, BufWriter},
process::{Child, Command},
@@ -49,6 +49,7 @@ impl Client {
config: Option<Value>,
server_environment: HashMap<String, String>,
root_markers: &[String],
+ manual_roots: &[PathBuf],
id: usize,
req_timeout: u64,
doc_path: Option<&std::path::PathBuf>,
@@ -77,8 +78,11 @@ impl Client {
Transport::start(reader, writer, stderr, id);
let root_path = find_root(
- doc_path.and_then(|x| x.parent().and_then(|x| x.to_str())),
+ doc_path
+ .and_then(|x| x.parent().and_then(|x| x.to_str()))
+ .unwrap_or("."),
root_markers,
+ manual_roots,
);
let root_uri = lsp::Url::from_file_path(root_path.clone()).ok();