@@ -31,6 +31,7 @@ pub struct Client {
31 pub(crate) capabilities: OnceCell<lsp::ServerCapabilities>,
31 pub(crate) capabilities: OnceCell<lsp::ServerCapabilities>,
32 offset_encoding: OffsetEncoding,
32 offset_encoding: OffsetEncoding,
33 config: Option<Value>,
33 config: Option<Value>,
34+ root_markers: Vec<String>,
36impl Client {
37impl Client {
@@ -39,6 +40,7 @@ impl Client {
39 cmd: &str,
40 cmd: &str,
40 args: &[String],
41 args: &[String],
41 config: Option<Value>,
42 config: Option<Value>,
43+ root_markers: Vec<String>,
42 id: usize,
44 id: usize,
43 ) -> Result<(Self, UnboundedReceiver<(usize, Call)>, Arc<Notify>)> {
45 ) -> Result<(Self, UnboundedReceiver<(usize, Call)>, Arc<Notify>)> {
44 let process = Command::new(cmd)
46 let process = Command::new(cmd)
@@ -68,6 +70,7 @@ impl Client {
68 capabilities: OnceCell::new(),
70 capabilities: OnceCell::new(),
69 offset_encoding: OffsetEncoding::Utf8,
71 offset_encoding: OffsetEncoding::Utf8,
73 Ok((client, server_rx, initialize_notify))
76 Ok((client, server_rx, initialize_notify))
@@ -225,7 +228,8 @@ impl Client {
226 pub(crate) async fn initialize(&self) -> Result<lsp::InitializeResult> {
229 pub(crate) async fn initialize(&self) -> Result<lsp::InitializeResult> {
227 // TODO: delay any requests that are triggered prior to initialize
230 // TODO: delay any requests that are triggered prior to initialize
231+ let root = find_root(None, &self.root_markers)
228− let root = find_root(None).and_then(|root| lsp::Url::from_file_path(root).ok());
232+ .and_then(|root| lsp::Url::from_file_path(root).ok());
230 if self.config.is_some() {
234 if self.config.is_some() {
231 log::info!("Using custom LSP config: {}", self.config.as_ref().unwrap());
235 log::info!("Using custom LSP config: {}", self.config.as_ref().unwrap());