mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
Merge pull request #4382 from woody77/json_cfgs
Begin transition to new fields for JsonProject crate cfgs
This commit is contained in:
commit
ac4782ef11
3 changed files with 92 additions and 2 deletions
|
@ -252,6 +252,16 @@ impl ProjectWorkspace {
|
|||
};
|
||||
let cfg_options = {
|
||||
let mut opts = default_cfg_options.clone();
|
||||
for cfg in &krate.cfg {
|
||||
match cfg.find('=') {
|
||||
None => opts.insert_atom(cfg.into()),
|
||||
Some(pos) => {
|
||||
let key = &cfg[..pos];
|
||||
let value = cfg[pos + 1..].trim_matches('"');
|
||||
opts.insert_key_value(key.into(), value.into());
|
||||
}
|
||||
}
|
||||
}
|
||||
for name in &krate.atom_cfgs {
|
||||
opts.insert_atom(name.into());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue