aboutsummaryrefslogtreecommitdiff
path: root/crates/project_model/src
diff options
context:
space:
mode:
authorJamie Cunliffe <[email protected]>2021-05-30 14:52:19 +0100
committerJamie Cunliffe <[email protected]>2021-06-21 17:47:00 +0100
commit284483b347d15bee3a7bf293d33e5f19a9740102 (patch)
treee582a7ecdef30511b8982529f11889f1aab3ca5e /crates/project_model/src
parent1b05dbba39d5a4d46f321dc962df99038cddbf21 (diff)
Improve completion of cfg attributes
The completion of cfg will look at the enabled cfg keys when performing completion. It will also look crate features when completing a feature cfg option. A fixed list of known values for some cfg options are provided. For unknown keys it will look at the enabled values for that cfg key, which means that completion will only show enabled options for those.
Diffstat (limited to 'crates/project_model/src')
-rw-r--r--crates/project_model/src/workspace.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/crates/project_model/src/workspace.rs b/crates/project_model/src/workspace.rs
index d8217f714..9ee3fc1a3 100644
--- a/crates/project_model/src/workspace.rs
+++ b/crates/project_model/src/workspace.rs
@@ -387,6 +387,7 @@ fn project_json_to_crate_graph(
387 cfg_options, 387 cfg_options,
388 env, 388 env,
389 proc_macro.unwrap_or_default(), 389 proc_macro.unwrap_or_default(),
390 Default::default(),
390 ), 391 ),
391 ) 392 )
392 }) 393 })
@@ -582,6 +583,7 @@ fn detached_files_to_crate_graph(
582 cfg_options.clone(), 583 cfg_options.clone(),
583 Env::default(), 584 Env::default(),
584 Vec::new(), 585 Vec::new(),
586 Default::default(),
585 ); 587 );
586 588
587 for (name, krate) in public_deps.iter() { 589 for (name, krate) in public_deps.iter() {
@@ -726,6 +728,7 @@ fn add_target_crate_root(
726 cfg_options, 728 cfg_options,
727 env, 729 env,
728 proc_macro, 730 proc_macro,
731 pkg.features.clone(),
729 ); 732 );
730 733
731 crate_id 734 crate_id
@@ -755,6 +758,7 @@ fn sysroot_to_crate_graph(
755 cfg_options.clone(), 758 cfg_options.clone(),
756 env, 759 env,
757 proc_macro, 760 proc_macro,
761 Default::default(),
758 ); 762 );
759 Some((krate, crate_id)) 763 Some((krate, crate_id))
760 }) 764 })