]> git.lizzy.rs Git - rust.git/commitdiff
Move SymbolKind to ide_db
authorLukas Wirth <lukastw97@gmail.com>
Wed, 20 Jan 2021 14:25:34 +0000 (15:25 +0100)
committerLukas Wirth <lukastw97@gmail.com>
Wed, 20 Jan 2021 14:25:34 +0000 (15:25 +0100)
crates/ide/src/display/navigation_target.rs
crates/ide/src/file_structure.rs
crates/ide/src/lib.rs
crates/ide/src/runnables.rs
crates/ide/src/syntax_highlighting.rs
crates/ide/src/syntax_highlighting/format.rs
crates/ide/src/syntax_highlighting/highlight.rs
crates/ide/src/syntax_highlighting/tags.rs
crates/ide_db/src/lib.rs
crates/rust-analyzer/src/handlers.rs
crates/rust-analyzer/src/to_proto.rs

index 00e6012442bc69e0bb13e7a501685498fa6704ab..8d08e4763ddb43db65c91c80045e0f012cb16c07 100644 (file)
@@ -7,6 +7,7 @@
 use ide_db::{
     base_db::{FileId, FileRange, SourceDatabase},
     symbol_index::FileSymbolKind,
+    SymbolKind,
 };
 use ide_db::{defs::Definition, RootDatabase};
 use syntax::{
 
 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.
 ///
index 32556dad33a1347115a94409de3678927f758860..26793bdb441455672a63e90091d929c69e5a27f7 100644 (file)
@@ -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<usize>,
index 567b8117eb39c1b58b57a3ea7624f444d4a05317..989e94a31fcd1de302531324d80b6601c8a396e5 100644 (file)
@@ -65,7 +65,7 @@ macro_rules! eprintln {
 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},
index 8976f1080f58588d880c47ea20ec101f03d04784..e282b31afbad7dda1ce0e2df9ebe921e3d514aa9 100644 (file)
@@ -3,7 +3,7 @@
 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 crate::{
     display::{ToNav, TryToNav},
-    FileId, NavigationTarget, SymbolKind,
+    FileId, NavigationTarget,
 };
 
 #[derive(Debug, Clone)]
index f2d4da78d006b4339349f588245bb322a1b00270..a3d4e4f77ad9de7f5324917958a480daa9002761 100644 (file)
@@ -13,7 +13,7 @@
 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 @@
         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;
index a74ca844b33f89f955e9d2e0327dfe1c9fd9b40f..63bff6376f787c9f82dcf739b2d1b735c0788ef9 100644 (file)
@@ -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,
index 8625ef5dfce9a113f182740ce71bc046d612de94..24fcbb5845a7dc4913b67a130ffa43456a34ce71 100644 (file)
@@ -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 @@
     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<RootDatabase>,
index 8dd05ac5245ae1ca8f1c78c05aebcf3ba86a2950..3c02fdb1151fb24707be8bef662cac479803e551 100644 (file)
@@ -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 {
index 118c090d759d5a975472298435ea90eea5a977c8..ee35d02f5a7ee935e247a8b991e14eeddfad87cc 100644 (file)
@@ -134,3 +134,27 @@ fn line_index(db: &dyn LineIndexDatabase, file_id: FileId) -> Arc<LineIndex> {
     let text = db.file_text(file_id);
     Arc::new(LineIndex::new(&*text))
 }
+
+#[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,
+}
index 001f3a37de3562f9a5131e74483c8cbb7955dbc4..10cbd7eeb95d119497f39829799b6f881494da7d 100644 (file)
@@ -10,8 +10,9 @@
 
 use ide::{
     FileId, FilePosition, FileRange, HoverAction, HoverGotoTypeData, LineIndex, NavigationTarget,
-    Query, RangeInfo, Runnable, RunnableKind, SearchScope, SourceChange, SymbolKind, TextEdit,
+    Query, RangeInfo, Runnable, RunnableKind, SearchScope, SourceChange, TextEdit,
 };
+use ide_db::SymbolKind;
 use itertools::Itertools;
 use lsp_server::ErrorCode;
 use lsp_types::{
index 9fd32a8c7dec8f17730c7b26a9402b56f558cd5e..18e8a6d2275a60d4205a79b3b3034fccf15132aa 100644 (file)
@@ -8,8 +8,9 @@
     Assist, AssistKind, CallInfo, CompletionItem, CompletionItemKind, Documentation, FileId,
     FileRange, FileSystemEdit, Fold, FoldKind, Highlight, HlMod, HlPunct, HlRange, HlTag, Indel,
     InlayHint, InlayKind, InsertTextFormat, LineIndex, Markup, NavigationTarget, ReferenceAccess,
-    RenameError, Runnable, Severity, SourceChange, SymbolKind, TextEdit, TextRange, TextSize,
+    RenameError, Runnable, Severity, SourceChange, TextEdit, TextRange, TextSize,
 };
+use ide_db::SymbolKind;
 use itertools::Itertools;
 
 use crate::{