Introduce StructureNodeKind

This commit is contained in:
ivan770 2021-03-14 17:16:29 +02:00
parent 8602f9573b
commit 7d48e04f31
No known key found for this signature in database
GPG key ID: D8C4BD5AE4D9CC4D
7 changed files with 110 additions and 57 deletions

View file

@ -1,7 +1,7 @@
use hir::Semantics;
use ide_db::{
base_db::{FileId, FilePosition, FileRange, SourceDatabase},
RootDatabase, SymbolKind,
RootDatabase, StructureNodeKind, SymbolKind,
};
use syntax::TextRange;
@ -80,15 +80,17 @@ pub(crate) fn annotations(
.filter(|node| {
matches!(
node.kind,
SymbolKind::Trait
| SymbolKind::Struct
| SymbolKind::Enum
| SymbolKind::Union
| SymbolKind::Const
StructureNodeKind::SymbolKind(SymbolKind::Trait)
| StructureNodeKind::SymbolKind(SymbolKind::Struct)
| StructureNodeKind::SymbolKind(SymbolKind::Enum)
| StructureNodeKind::SymbolKind(SymbolKind::Union)
| StructureNodeKind::SymbolKind(SymbolKind::Const)
)
})
.for_each(|node| {
if config.annotate_impls && node.kind != SymbolKind::Const {
if config.annotate_impls
&& node.kind != StructureNodeKind::SymbolKind(SymbolKind::Const)
{
annotations.push(Annotation {
range: node.node_range,
kind: AnnotationKind::HasImpls {