diff options
-rw-r--r-- | crates/ide/src/display/navigation_target.rs | 25 | ||||
-rw-r--r-- | crates/ide/src/file_structure.rs | 3 | ||||
-rw-r--r-- | crates/ide/src/lib.rs | 2 | ||||
-rw-r--r-- | crates/ide/src/runnables.rs | 4 | ||||
-rw-r--r-- | crates/ide/src/syntax_highlighting.rs | 4 | ||||
-rw-r--r-- | crates/ide/src/syntax_highlighting/format.rs | 3 | ||||
-rw-r--r-- | crates/ide/src/syntax_highlighting/highlight.rs | 4 | ||||
-rw-r--r-- | crates/ide/src/syntax_highlighting/tags.rs | 2 | ||||
-rw-r--r-- | crates/ide_db/src/lib.rs | 24 | ||||
-rw-r--r-- | crates/rust-analyzer/src/handlers.rs | 3 | ||||
-rw-r--r-- | crates/rust-analyzer/src/to_proto.rs | 3 |
11 files changed, 40 insertions, 37 deletions
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 | |||
7 | use ide_db::{ | 7 | use ide_db::{ |
8 | base_db::{FileId, FileRange, SourceDatabase}, | 8 | base_db::{FileId, FileRange, SourceDatabase}, |
9 | symbol_index::FileSymbolKind, | 9 | symbol_index::FileSymbolKind, |
10 | SymbolKind, | ||
10 | }; | 11 | }; |
11 | use ide_db::{defs::Definition, RootDatabase}; | 12 | use ide_db::{defs::Definition, RootDatabase}; |
12 | use syntax::{ | 13 | use syntax::{ |
@@ -18,30 +19,6 @@ use crate::FileSymbol; | |||
18 | 19 | ||
19 | use super::short_label::ShortLabel; | 20 | use super::short_label::ShortLabel; |
20 | 21 | ||
21 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)] | ||
22 | pub enum SymbolKind { | ||
23 | Module, | ||
24 | Impl, | ||
25 | Field, | ||
26 | TypeParam, | ||
27 | ConstParam, | ||
28 | LifetimeParam, | ||
29 | ValueParam, | ||
30 | SelfParam, | ||
31 | Local, | ||
32 | Label, | ||
33 | Function, | ||
34 | Const, | ||
35 | Static, | ||
36 | Struct, | ||
37 | Enum, | ||
38 | Variant, | ||
39 | Union, | ||
40 | TypeAlias, | ||
41 | Trait, | ||
42 | Macro, | ||
43 | } | ||
44 | |||
45 | /// `NavigationTarget` represents and element in the editor's UI which you can | 22 | /// `NavigationTarget` represents and element in the editor's UI which you can |
46 | /// click on to navigate to a particular piece of code. | 23 | /// click on to navigate to a particular piece of code. |
47 | /// | 24 | /// |
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 @@ | |||
1 | use ide_db::SymbolKind; | ||
1 | use syntax::{ | 2 | use syntax::{ |
2 | ast::{self, AttrsOwner, GenericParamsOwner, NameOwner}, | 3 | ast::{self, AttrsOwner, GenericParamsOwner, NameOwner}, |
3 | match_ast, AstNode, SourceFile, SyntaxNode, TextRange, WalkEvent, | 4 | match_ast, AstNode, SourceFile, SyntaxNode, TextRange, WalkEvent, |
4 | }; | 5 | }; |
5 | 6 | ||
6 | use crate::SymbolKind; | ||
7 | |||
8 | #[derive(Debug, Clone)] | 7 | #[derive(Debug, Clone)] |
9 | pub struct StructureNode { | 8 | pub struct StructureNode { |
10 | pub parent: Option<usize>, | 9 | pub parent: Option<usize>, |
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; | |||
65 | pub use crate::{ | 65 | pub use crate::{ |
66 | call_hierarchy::CallItem, | 66 | call_hierarchy::CallItem, |
67 | diagnostics::{Diagnostic, DiagnosticsConfig, Fix, Severity}, | 67 | diagnostics::{Diagnostic, DiagnosticsConfig, Fix, Severity}, |
68 | display::navigation_target::{NavigationTarget, SymbolKind}, | 68 | display::navigation_target::NavigationTarget, |
69 | expand_macro::ExpandedMacro, | 69 | expand_macro::ExpandedMacro, |
70 | file_structure::StructureNode, | 70 | file_structure::StructureNode, |
71 | folding_ranges::{Fold, FoldKind}, | 71 | 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; | |||
3 | use assists::utils::test_related_attribute; | 3 | use assists::utils::test_related_attribute; |
4 | use cfg::CfgExpr; | 4 | use cfg::CfgExpr; |
5 | use hir::{AsAssocItem, HasAttrs, HasSource, Semantics}; | 5 | use hir::{AsAssocItem, HasAttrs, HasSource, Semantics}; |
6 | use ide_db::{defs::Definition, RootDatabase}; | 6 | use ide_db::{defs::Definition, RootDatabase, SymbolKind}; |
7 | use itertools::Itertools; | 7 | use itertools::Itertools; |
8 | use syntax::{ | 8 | use syntax::{ |
9 | ast::{self, AstNode, AttrsOwner}, | 9 | ast::{self, AstNode, AttrsOwner}, |
@@ -12,7 +12,7 @@ use syntax::{ | |||
12 | 12 | ||
13 | use crate::{ | 13 | use crate::{ |
14 | display::{ToNav, TryToNav}, | 14 | display::{ToNav, TryToNav}, |
15 | FileId, NavigationTarget, SymbolKind, | 15 | FileId, NavigationTarget, |
16 | }; | 16 | }; |
17 | 17 | ||
18 | #[derive(Debug, Clone)] | 18 | #[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; | |||
13 | mod tests; | 13 | mod tests; |
14 | 14 | ||
15 | use hir::{Name, Semantics}; | 15 | use hir::{Name, Semantics}; |
16 | use ide_db::RootDatabase; | 16 | use ide_db::{RootDatabase, SymbolKind}; |
17 | use rustc_hash::FxHashMap; | 17 | use rustc_hash::FxHashMap; |
18 | use syntax::{ | 18 | use syntax::{ |
19 | ast::{self, HasFormatSpecifier}, | 19 | ast::{self, HasFormatSpecifier}, |
@@ -27,7 +27,7 @@ use crate::{ | |||
27 | format::highlight_format_string, highlights::Highlights, | 27 | format::highlight_format_string, highlights::Highlights, |
28 | macro_rules::MacroRulesHighlighter, tags::Highlight, | 28 | macro_rules::MacroRulesHighlighter, tags::Highlight, |
29 | }, | 29 | }, |
30 | FileId, HlMod, HlTag, SymbolKind, | 30 | FileId, HlMod, HlTag, |
31 | }; | 31 | }; |
32 | 32 | ||
33 | pub(crate) use html::highlight_as_html; | 33 | 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 @@ | |||
1 | //! Syntax highlighting for format macro strings. | 1 | //! Syntax highlighting for format macro strings. |
2 | use ide_db::SymbolKind; | ||
2 | use syntax::{ | 3 | use syntax::{ |
3 | ast::{self, FormatSpecifier, HasFormatSpecifier}, | 4 | ast::{self, FormatSpecifier, HasFormatSpecifier}, |
4 | AstNode, AstToken, TextRange, | 5 | AstNode, AstToken, TextRange, |
5 | }; | 6 | }; |
6 | 7 | ||
7 | use crate::{syntax_highlighting::highlights::Highlights, HlRange, HlTag, SymbolKind}; | 8 | use crate::{syntax_highlighting::highlights::Highlights, HlRange, HlTag}; |
8 | 9 | ||
9 | pub(super) fn highlight_format_string( | 10 | pub(super) fn highlight_format_string( |
10 | stack: &mut Highlights, | 11 | 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 @@ | |||
3 | use hir::{AsAssocItem, Semantics, VariantDef}; | 3 | use hir::{AsAssocItem, Semantics, VariantDef}; |
4 | use ide_db::{ | 4 | use ide_db::{ |
5 | defs::{Definition, NameClass, NameRefClass}, | 5 | defs::{Definition, NameClass, NameRefClass}, |
6 | RootDatabase, | 6 | RootDatabase, SymbolKind, |
7 | }; | 7 | }; |
8 | use rustc_hash::FxHashMap; | 8 | use rustc_hash::FxHashMap; |
9 | use syntax::{ | 9 | use syntax::{ |
@@ -12,7 +12,7 @@ use syntax::{ | |||
12 | SyntaxNode, SyntaxToken, T, | 12 | SyntaxNode, SyntaxToken, T, |
13 | }; | 13 | }; |
14 | 14 | ||
15 | use crate::{syntax_highlighting::tags::HlPunct, Highlight, HlMod, HlTag, SymbolKind}; | 15 | use crate::{syntax_highlighting::tags::HlPunct, Highlight, HlMod, HlTag}; |
16 | 16 | ||
17 | pub(super) fn element( | 17 | pub(super) fn element( |
18 | sema: &Semantics<RootDatabase>, | 18 | sema: &Semantics<RootDatabase>, |
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 @@ | |||
3 | 3 | ||
4 | use std::{fmt, ops}; | 4 | use std::{fmt, ops}; |
5 | 5 | ||
6 | use crate::SymbolKind; | 6 | use ide_db::SymbolKind; |
7 | 7 | ||
8 | #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)] | 8 | #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)] |
9 | pub struct Highlight { | 9 | pub struct Highlight { |
diff --git a/crates/ide_db/src/lib.rs b/crates/ide_db/src/lib.rs index 118c090d7..ee35d02f5 100644 --- a/crates/ide_db/src/lib.rs +++ b/crates/ide_db/src/lib.rs | |||
@@ -134,3 +134,27 @@ fn line_index(db: &dyn LineIndexDatabase, file_id: FileId) -> Arc<LineIndex> { | |||
134 | let text = db.file_text(file_id); | 134 | let text = db.file_text(file_id); |
135 | Arc::new(LineIndex::new(&*text)) | 135 | Arc::new(LineIndex::new(&*text)) |
136 | } | 136 | } |
137 | |||
138 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)] | ||
139 | pub enum SymbolKind { | ||
140 | Module, | ||
141 | Impl, | ||
142 | Field, | ||
143 | TypeParam, | ||
144 | ConstParam, | ||
145 | LifetimeParam, | ||
146 | ValueParam, | ||
147 | SelfParam, | ||
148 | Local, | ||
149 | Label, | ||
150 | Function, | ||
151 | Const, | ||
152 | Static, | ||
153 | Struct, | ||
154 | Enum, | ||
155 | Variant, | ||
156 | Union, | ||
157 | TypeAlias, | ||
158 | Trait, | ||
159 | Macro, | ||
160 | } | ||
diff --git a/crates/rust-analyzer/src/handlers.rs b/crates/rust-analyzer/src/handlers.rs index 001f3a37d..10cbd7eeb 100644 --- a/crates/rust-analyzer/src/handlers.rs +++ b/crates/rust-analyzer/src/handlers.rs | |||
@@ -10,8 +10,9 @@ use std::{ | |||
10 | 10 | ||
11 | use ide::{ | 11 | use ide::{ |
12 | FileId, FilePosition, FileRange, HoverAction, HoverGotoTypeData, LineIndex, NavigationTarget, | 12 | FileId, FilePosition, FileRange, HoverAction, HoverGotoTypeData, LineIndex, NavigationTarget, |
13 | Query, RangeInfo, Runnable, RunnableKind, SearchScope, SourceChange, SymbolKind, TextEdit, | 13 | Query, RangeInfo, Runnable, RunnableKind, SearchScope, SourceChange, TextEdit, |
14 | }; | 14 | }; |
15 | use ide_db::SymbolKind; | ||
15 | use itertools::Itertools; | 16 | use itertools::Itertools; |
16 | use lsp_server::ErrorCode; | 17 | use lsp_server::ErrorCode; |
17 | use lsp_types::{ | 18 | use lsp_types::{ |
diff --git a/crates/rust-analyzer/src/to_proto.rs b/crates/rust-analyzer/src/to_proto.rs index 9fd32a8c7..18e8a6d22 100644 --- a/crates/rust-analyzer/src/to_proto.rs +++ b/crates/rust-analyzer/src/to_proto.rs | |||
@@ -8,8 +8,9 @@ use ide::{ | |||
8 | Assist, AssistKind, CallInfo, CompletionItem, CompletionItemKind, Documentation, FileId, | 8 | Assist, AssistKind, CallInfo, CompletionItem, CompletionItemKind, Documentation, FileId, |
9 | FileRange, FileSystemEdit, Fold, FoldKind, Highlight, HlMod, HlPunct, HlRange, HlTag, Indel, | 9 | FileRange, FileSystemEdit, Fold, FoldKind, Highlight, HlMod, HlPunct, HlRange, HlTag, Indel, |
10 | InlayHint, InlayKind, InsertTextFormat, LineIndex, Markup, NavigationTarget, ReferenceAccess, | 10 | InlayHint, InlayKind, InsertTextFormat, LineIndex, Markup, NavigationTarget, ReferenceAccess, |
11 | RenameError, Runnable, Severity, SourceChange, SymbolKind, TextEdit, TextRange, TextSize, | 11 | RenameError, Runnable, Severity, SourceChange, TextEdit, TextRange, TextSize, |
12 | }; | 12 | }; |
13 | use ide_db::SymbolKind; | ||
13 | use itertools::Itertools; | 14 | use itertools::Itertools; |
14 | 15 | ||
15 | use crate::{ | 16 | use crate::{ |