Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cfg completions are duplicated many times #12623

Closed
jonas-schievink opened this issue Jun 23, 2022 · 1 comment · Fixed by #12642
Closed

cfg completions are duplicated many times #12623

jonas-schievink opened this issue Jun 23, 2022 · 1 comment · Fixed by #12642
Labels
A-completion autocompletion C-bug Category: bug E-has-instructions Issue has some instructions and pointers to code to get started good first issue S-actionable Someone could pick this issue up and work on it right now

Comments

@jonas-schievink
Copy link
Contributor

screenshot-2022-06-23-14:29:02

I'm assuming this is because cfg flags may be set with mulitple values, eg. target_has_atomic = "ptr" and target_has_atomic = "8" may both be set at once. However, our completions don't actually complete that part of the directive. Perhaps they should, or if not (since it's reasonable to write cfgs that are inactive) they should be deduplicated.

@jonas-schievink jonas-schievink added A-completion autocompletion S-actionable Someone could pick this issue up and work on it right now C-bug Category: bug labels Jun 23, 2022
@Veykril
Copy link
Member

Veykril commented Jun 23, 2022

Relevant code is here

None => ctx.krate.potential_cfg(ctx.db).get_cfg_keys().cloned().for_each(|s| {
let item = CompletionItem::new(SymbolKind::BuiltinAttr, ctx.source_range(), s);
acc.add(item.build());
}),

@jonas-schievink jonas-schievink added good first issue E-has-instructions Issue has some instructions and pointers to code to get started labels Jun 23, 2022
bors added a commit that referenced this issue Jun 27, 2022
fix: deduplicate cfg completions

cfg completions are duplicated if they are set with multiple values.
This patch deduplicates them.

fixes: [#12623](#12623)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-completion autocompletion C-bug Category: bug E-has-instructions Issue has some instructions and pointers to code to get started good first issue S-actionable Someone could pick this issue up and work on it right now
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants