mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-26 20:09:19 +00:00
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.
This commit is contained in:
parent
1b05dbba39
commit
284483b347
8 changed files with 185 additions and 0 deletions
|
@ -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))
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue