Move SymbolKind to ide_db

This commit is contained in:
Lukas Wirth 2021-01-20 15:25:34 +01:00
parent 83e49200d8
commit 563a175fdb
11 changed files with 40 additions and 37 deletions

View File

@ -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.
///

View 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>,

View File

@ -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},

View File

@ -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)]

View File

@ -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;

View 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,

View 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 @@ 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<RootDatabase>,

View 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 {

View 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,
}

View File

@ -10,8 +10,9 @@ use std::{
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::{

View File

@ -8,8 +8,9 @@ use ide::{
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::{