diff options
author | ontley | 2024-02-12 01:35:25 +0000 |
---|---|---|
committer | GitHub | 2024-02-12 01:35:25 +0000 |
commit | 6a90166d0a3d8fd0e2e96e4ac8e196b2b2989760 (patch) | |
tree | e722b996e123813e2fb0f9972136fa6002ca1839 /helix-lsp/src/client.rs | |
parent | ac8d1f62a126781fbac087aa374aad540dd659b1 (diff) |
Add required-root-patterns for situational lsp activation (#8696)
* Added required-root-patterns for situational lsp activation using globbing
* Replaced filter_map with flatten
* updated book to include required-root-patterns option
* fixed wrong function name for path
* Added globset to helix-core. Moved globset building to config parsing.
* Normalize implements AsRef
* cargo fmt
* Revert "cargo fmt"
This reverts commit ca8ce123e8d77d2ae8ed84d5273a9b554101b0db.
Diffstat (limited to 'helix-lsp/src/client.rs')
-rw-r--r-- | helix-lsp/src/client.rs | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/helix-lsp/src/client.rs b/helix-lsp/src/client.rs index 94bad6fa..0d3a2a56 100644 --- a/helix-lsp/src/client.rs +++ b/helix-lsp/src/client.rs @@ -177,12 +177,11 @@ impl Client { args: &[String], config: Option<Value>, server_environment: HashMap<String, String>, - root_markers: &[String], - manual_roots: &[PathBuf], + root_path: PathBuf, + root_uri: Option<lsp::Url>, id: usize, name: String, req_timeout: u64, - doc_path: Option<&std::path::PathBuf>, ) -> Result<(Self, UnboundedReceiver<(usize, Call)>, Arc<Notify>)> { // Resolve path to the binary let cmd = helix_stdx::env::which(cmd)?; @@ -206,22 +205,6 @@ impl Client { let (server_rx, server_tx, initialize_notify) = Transport::start(reader, writer, stderr, id, name.clone()); - let (workspace, workspace_is_cwd) = find_workspace(); - let workspace = path::normalize(workspace); - let root = find_lsp_workspace( - doc_path - .and_then(|x| x.parent().and_then(|x| x.to_str())) - .unwrap_or("."), - root_markers, - manual_roots, - &workspace, - workspace_is_cwd, - ); - - // `root_uri` and `workspace_folder` can be empty in case there is no workspace - // `root_url` can not, use `workspace` as a fallback - let root_path = root.clone().unwrap_or_else(|| workspace.clone()); - let root_uri = root.and_then(|root| lsp::Url::from_file_path(root).ok()); let workspace_folders = root_uri .clone() |