diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-06-04 18:45:37 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-06-04 18:45:37 +0100 |
commit | 98395f29a417b37a5969594f0cac5ae23585da85 (patch) | |
tree | 3a13913003723f3da843dae8580287b9d33c68eb /crates/ide_completion/src/completions/attribute.rs | |
parent | 92d91050c4aa48732e7af3bf979aa7ed5aed924d (diff) | |
parent | ae1c63fcdd0caf34f41fba62b04e3d868a589f1d (diff) |
Merge #9138
9138: feat: Implement hover for lints r=Veykril a=Veykril
fixes https://github.com/rust-analyzer/rust-analyzer/issues/8857, fixes https://github.com/rust-analyzer/rust-analyzer/issues/3941
![URXBanNxYe](https://user-images.githubusercontent.com/3757771/120830905-4bd8da80-c55f-11eb-9f55-ff5a321726fa.gif)
We also generate the default lints(and lint groups 🎉) instead now by invoking `rustc -W help` and parsing the output from that.
Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/ide_completion/src/completions/attribute.rs')
-rw-r--r-- | crates/ide_completion/src/completions/attribute.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/crates/ide_completion/src/completions/attribute.rs b/crates/ide_completion/src/completions/attribute.rs index c48bb9e66..f80d7eec3 100644 --- a/crates/ide_completion/src/completions/attribute.rs +++ b/crates/ide_completion/src/completions/attribute.rs | |||
@@ -3,20 +3,19 @@ | |||
3 | //! This module uses a bit of static metadata to provide completions | 3 | //! This module uses a bit of static metadata to provide completions |
4 | //! for built-in attributes. | 4 | //! for built-in attributes. |
5 | 5 | ||
6 | use ide_db::helpers::generated_lints::{CLIPPY_LINTS, DEFAULT_LINTS, FEATURES}; | ||
6 | use once_cell::sync::Lazy; | 7 | use once_cell::sync::Lazy; |
7 | use rustc_hash::{FxHashMap, FxHashSet}; | 8 | use rustc_hash::{FxHashMap, FxHashSet}; |
8 | use syntax::{algo::non_trivia_sibling, ast, AstNode, Direction, NodeOrToken, SyntaxKind, T}; | 9 | use syntax::{algo::non_trivia_sibling, ast, AstNode, Direction, NodeOrToken, SyntaxKind, T}; |
9 | 10 | ||
10 | use crate::{ | 11 | use crate::{ |
11 | context::CompletionContext, | 12 | context::CompletionContext, |
12 | generated_lint_completions::{CLIPPY_LINTS, FEATURES}, | ||
13 | item::{CompletionItem, CompletionItemKind, CompletionKind}, | 13 | item::{CompletionItem, CompletionItemKind, CompletionKind}, |
14 | Completions, | 14 | Completions, |
15 | }; | 15 | }; |
16 | 16 | ||
17 | mod derive; | 17 | mod derive; |
18 | mod lint; | 18 | mod lint; |
19 | pub(crate) use self::lint::LintCompletion; | ||
20 | 19 | ||
21 | pub(crate) fn complete_attribute(acc: &mut Completions, ctx: &CompletionContext) -> Option<()> { | 20 | pub(crate) fn complete_attribute(acc: &mut Completions, ctx: &CompletionContext) -> Option<()> { |
22 | let attribute = ctx.attribute_under_caret.as_ref()?; | 21 | let attribute = ctx.attribute_under_caret.as_ref()?; |
@@ -25,7 +24,7 @@ pub(crate) fn complete_attribute(acc: &mut Completions, ctx: &CompletionContext) | |||
25 | "derive" => derive::complete_derive(acc, ctx, token_tree), | 24 | "derive" => derive::complete_derive(acc, ctx, token_tree), |
26 | "feature" => lint::complete_lint(acc, ctx, token_tree, FEATURES), | 25 | "feature" => lint::complete_lint(acc, ctx, token_tree, FEATURES), |
27 | "allow" | "warn" | "deny" | "forbid" => { | 26 | "allow" | "warn" | "deny" | "forbid" => { |
28 | lint::complete_lint(acc, ctx, token_tree.clone(), lint::DEFAULT_LINT_COMPLETIONS); | 27 | lint::complete_lint(acc, ctx, token_tree.clone(), DEFAULT_LINTS); |
29 | lint::complete_lint(acc, ctx, token_tree, CLIPPY_LINTS); | 28 | lint::complete_lint(acc, ctx, token_tree, CLIPPY_LINTS); |
30 | } | 29 | } |
31 | _ => (), | 30 | _ => (), |