From 563a175fdb9073a548fc2e161d5de0a093b0d74d Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Wed, 20 Jan 2021 15:25:34 +0100 Subject: Move SymbolKind to ide_db --- crates/ide/src/display/navigation_target.rs | 25 +------------------------ crates/ide/src/file_structure.rs | 3 +-- crates/ide/src/lib.rs | 2 +- crates/ide/src/runnables.rs | 4 ++-- crates/ide/src/syntax_highlighting.rs | 4 ++-- crates/ide/src/syntax_highlighting/format.rs | 3 ++- crates/ide/src/syntax_highlighting/highlight.rs | 4 ++-- crates/ide/src/syntax_highlighting/tags.rs | 2 +- 8 files changed, 12 insertions(+), 35 deletions(-) (limited to 'crates/ide') diff --git a/crates/ide/src/display/navigation_target.rs b/crates/ide/src/display/navigation_target.rs index 00e601244..8d08e4763 100644 --- a/crates/ide/src/display/navigation_target.rs +++ b/crates/ide/src/display/navigation_target.rs @@ -7,6 +7,7 @@ use hir::{AssocItem, Documentation, FieldSource, HasAttrs, HasSource, InFile, Mo use ide_db::{ base_db::{FileId, FileRange, SourceDatabase}, symbol_index::FileSymbolKind, + SymbolKind, }; use ide_db::{defs::Definition, RootDatabase}; use syntax::{ @@ -18,30 +19,6 @@ use crate::FileSymbol; use super::short_label::ShortLabel; -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)] -pub enum SymbolKind { - Module, - Impl, - Field, - TypeParam, - ConstParam, - LifetimeParam, - ValueParam, - SelfParam, - Local, - Label, - Function, - Const, - Static, - Struct, - Enum, - Variant, - Union, - TypeAlias, - Trait, - Macro, -} - /// `NavigationTarget` represents and element in the editor's UI which you can /// click on to navigate to a particular piece of code. /// diff --git a/crates/ide/src/file_structure.rs b/crates/ide/src/file_structure.rs index 32556dad3..26793bdb4 100644 --- a/crates/ide/src/file_structure.rs +++ b/crates/ide/src/file_structure.rs @@ -1,10 +1,9 @@ +use ide_db::SymbolKind; use syntax::{ ast::{self, AttrsOwner, GenericParamsOwner, NameOwner}, match_ast, AstNode, SourceFile, SyntaxNode, TextRange, WalkEvent, }; -use crate::SymbolKind; - #[derive(Debug, Clone)] pub struct StructureNode { pub parent: Option, diff --git a/crates/ide/src/lib.rs b/crates/ide/src/lib.rs index 567b8117e..989e94a31 100644 --- a/crates/ide/src/lib.rs +++ b/crates/ide/src/lib.rs @@ -65,7 +65,7 @@ use crate::display::ToNav; pub use crate::{ call_hierarchy::CallItem, diagnostics::{Diagnostic, DiagnosticsConfig, Fix, Severity}, - display::navigation_target::{NavigationTarget, SymbolKind}, + display::navigation_target::NavigationTarget, expand_macro::ExpandedMacro, file_structure::StructureNode, folding_ranges::{Fold, FoldKind}, diff --git a/crates/ide/src/runnables.rs b/crates/ide/src/runnables.rs index 8976f1080..e282b31af 100644 --- a/crates/ide/src/runnables.rs +++ b/crates/ide/src/runnables.rs @@ -3,7 +3,7 @@ use std::fmt; use assists::utils::test_related_attribute; use cfg::CfgExpr; use hir::{AsAssocItem, HasAttrs, HasSource, Semantics}; -use ide_db::{defs::Definition, RootDatabase}; +use ide_db::{defs::Definition, RootDatabase, SymbolKind}; use itertools::Itertools; use syntax::{ ast::{self, AstNode, AttrsOwner}, @@ -12,7 +12,7 @@ use syntax::{ use crate::{ display::{ToNav, TryToNav}, - FileId, NavigationTarget, SymbolKind, + FileId, NavigationTarget, }; #[derive(Debug, Clone)] diff --git a/crates/ide/src/syntax_highlighting.rs b/crates/ide/src/syntax_highlighting.rs index f2d4da78d..a3d4e4f77 100644 --- a/crates/ide/src/syntax_highlighting.rs +++ b/crates/ide/src/syntax_highlighting.rs @@ -13,7 +13,7 @@ mod html; mod tests; use hir::{Name, Semantics}; -use ide_db::RootDatabase; +use ide_db::{RootDatabase, SymbolKind}; use rustc_hash::FxHashMap; use syntax::{ ast::{self, HasFormatSpecifier}, @@ -27,7 +27,7 @@ use crate::{ format::highlight_format_string, highlights::Highlights, macro_rules::MacroRulesHighlighter, tags::Highlight, }, - FileId, HlMod, HlTag, SymbolKind, + FileId, HlMod, HlTag, }; pub(crate) use html::highlight_as_html; diff --git a/crates/ide/src/syntax_highlighting/format.rs b/crates/ide/src/syntax_highlighting/format.rs index a74ca844b..63bff6376 100644 --- a/crates/ide/src/syntax_highlighting/format.rs +++ b/crates/ide/src/syntax_highlighting/format.rs @@ -1,10 +1,11 @@ //! Syntax highlighting for format macro strings. +use ide_db::SymbolKind; use syntax::{ ast::{self, FormatSpecifier, HasFormatSpecifier}, AstNode, AstToken, TextRange, }; -use crate::{syntax_highlighting::highlights::Highlights, HlRange, HlTag, SymbolKind}; +use crate::{syntax_highlighting::highlights::Highlights, HlRange, HlTag}; pub(super) fn highlight_format_string( stack: &mut Highlights, diff --git a/crates/ide/src/syntax_highlighting/highlight.rs b/crates/ide/src/syntax_highlighting/highlight.rs index 8625ef5df..24fcbb584 100644 --- a/crates/ide/src/syntax_highlighting/highlight.rs +++ b/crates/ide/src/syntax_highlighting/highlight.rs @@ -3,7 +3,7 @@ use hir::{AsAssocItem, Semantics, VariantDef}; use ide_db::{ defs::{Definition, NameClass, NameRefClass}, - RootDatabase, + RootDatabase, SymbolKind, }; use rustc_hash::FxHashMap; use syntax::{ @@ -12,7 +12,7 @@ use syntax::{ SyntaxNode, SyntaxToken, T, }; -use crate::{syntax_highlighting::tags::HlPunct, Highlight, HlMod, HlTag, SymbolKind}; +use crate::{syntax_highlighting::tags::HlPunct, Highlight, HlMod, HlTag}; pub(super) fn element( sema: &Semantics, diff --git a/crates/ide/src/syntax_highlighting/tags.rs b/crates/ide/src/syntax_highlighting/tags.rs index 8dd05ac52..3c02fdb11 100644 --- a/crates/ide/src/syntax_highlighting/tags.rs +++ b/crates/ide/src/syntax_highlighting/tags.rs @@ -3,7 +3,7 @@ use std::{fmt, ops}; -use crate::SymbolKind; +use ide_db::SymbolKind; #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)] pub struct Highlight { -- cgit v1.2.3