project: Fine-grained language server management (#24038)
Closes #ISSUE https://github.com/zed-industries/zed/pull/23804 Release Notes: - Improved detection of project roots for use by language servers. Closes #ISSUE Release Notes: - N/A *or* Added/Fixed/Improved ... --------- Co-authored-by: smit <0xtimsb@gmail.com> Co-authored-by: Henrikh Kantuni <henrikh.kantuni@gmail.com> Co-authored-by: Caleb! <48127194+kaf-lamed-beyt@users.noreply.github.com> Co-authored-by: Marshall Bowers <git@maxdeviant.com> Co-authored-by: Kirill Bulatov <kirill@zed.dev> Co-authored-by: Agus Zubiaga <agus@zed.dev> Co-authored-by: Danilo <danilo@zed.dev> Co-authored-by: Nate Butler <iamnbutler@gmail.com>
This commit is contained in:
parent
8d839fca06
commit
a618830aea
33 changed files with 2350 additions and 962 deletions
|
@ -5169,6 +5169,7 @@ mod tests {
|
|||
use project::FakeFs;
|
||||
use search::project_search::{self, perform_project_search};
|
||||
use serde_json::json;
|
||||
use util::path;
|
||||
use workspace::OpenVisible;
|
||||
|
||||
use super::*;
|
||||
|
@ -5546,8 +5547,8 @@ mod tests {
|
|||
init_test(cx);
|
||||
|
||||
let fs = FakeFs::new(cx.background_executor.clone());
|
||||
populate_with_test_ra_project(&fs, "/rust-analyzer").await;
|
||||
let project = Project::test(fs.clone(), ["/rust-analyzer".as_ref()], cx).await;
|
||||
populate_with_test_ra_project(&fs, path!("/rust-analyzer")).await;
|
||||
let project = Project::test(fs.clone(), [path!("/rust-analyzer").as_ref()], cx).await;
|
||||
project.read_with(cx, |project, _| {
|
||||
project.languages().add(Arc::new(rust_lang()))
|
||||
});
|
||||
|
@ -5591,15 +5592,17 @@ mod tests {
|
|||
);
|
||||
});
|
||||
});
|
||||
let all_matches = r#"/rust-analyzer/
|
||||
let root_path = format!("{}/", path!("/rust-analyzer"));
|
||||
let all_matches = format!(
|
||||
r#"{root_path}
|
||||
crates/
|
||||
ide/src/
|
||||
inlay_hints/
|
||||
fn_lifetime_fn.rs
|
||||
search: match config.param_names_for_lifetime_elision_hints {
|
||||
search: allocated_lifetimes.push(if config.param_names_for_lifetime_elision_hints {
|
||||
search: Some(it) if config.param_names_for_lifetime_elision_hints => {
|
||||
search: InlayHintsConfig { param_names_for_lifetime_elision_hints: true, ..TEST_CONFIG },
|
||||
search: match config.param_names_for_lifetime_elision_hints {{
|
||||
search: allocated_lifetimes.push(if config.param_names_for_lifetime_elision_hints {{
|
||||
search: Some(it) if config.param_names_for_lifetime_elision_hints => {{
|
||||
search: InlayHintsConfig {{ param_names_for_lifetime_elision_hints: true, ..TEST_CONFIG }},
|
||||
inlay_hints.rs
|
||||
search: pub param_names_for_lifetime_elision_hints: bool,
|
||||
search: param_names_for_lifetime_elision_hints: self
|
||||
|
@ -5610,7 +5613,8 @@ mod tests {
|
|||
analysis_stats.rs
|
||||
search: param_names_for_lifetime_elision_hints: true,
|
||||
config.rs
|
||||
search: param_names_for_lifetime_elision_hints: self"#;
|
||||
search: param_names_for_lifetime_elision_hints: self"#
|
||||
);
|
||||
let select_first_in_all_matches = |line_to_select: &str| {
|
||||
assert!(all_matches.contains(line_to_select));
|
||||
all_matches.replacen(
|
||||
|
@ -5921,7 +5925,7 @@ mod tests {
|
|||
async fn test_navigating_in_singleton(cx: &mut TestAppContext) {
|
||||
init_test(cx);
|
||||
|
||||
let root = "/root";
|
||||
let root = path!("/root");
|
||||
let fs = FakeFs::new(cx.background_executor.clone());
|
||||
fs.insert_tree(
|
||||
root,
|
||||
|
@ -5968,7 +5972,7 @@ struct OutlineEntryExcerpt {
|
|||
|
||||
let _editor = workspace
|
||||
.update(cx, |workspace, window, cx| {
|
||||
workspace.open_abs_path(PathBuf::from("/root/src/lib.rs"), true, window, cx)
|
||||
workspace.open_abs_path(PathBuf::from(path!("/root/src/lib.rs")), true, window, cx)
|
||||
})
|
||||
.unwrap()
|
||||
.await
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue