From 284483b347d15bee3a7bf293d33e5f19a9740102 Mon Sep 17 00:00:00 2001 From: Jamie Cunliffe Date: Sun, 30 May 2021 14:52:19 +0100 Subject: 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. --- crates/project_model/src/workspace.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'crates/project_model') 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( cfg_options, env, proc_macro.unwrap_or_default(), + Default::default(), ), ) }) @@ -582,6 +583,7 @@ fn detached_files_to_crate_graph( cfg_options.clone(), Env::default(), Vec::new(), + Default::default(), ); for (name, krate) in public_deps.iter() { @@ -726,6 +728,7 @@ fn add_target_crate_root( cfg_options, env, proc_macro, + pkg.features.clone(), ); crate_id @@ -755,6 +758,7 @@ fn sysroot_to_crate_graph( cfg_options.clone(), env, proc_macro, + Default::default(), ); Some((krate, crate_id)) }) -- cgit v1.2.3