diff options
author | Aleksey Kladov <[email protected]> | 2021-03-15 09:55:27 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2021-03-15 09:55:27 +0000 |
commit | 5dcdf2ceee2d9fcce9bb2bc5dcbafd5dbfc722b1 (patch) | |
tree | b83064da602dc881b15623959553aabc8b31bf91 | |
parent | cec676d08236076a48a9fdae28cf0e716ae99b16 (diff) |
Move code to the appropriate layer
StructureNodeKind is a type which is specific to a particular feature,
file_structure. It shouldn't be in the "code shared by all ide features"
part.
-rw-r--r-- | crates/ide/src/annotations.rs | 4 | ||||
-rw-r--r-- | crates/ide/src/file_structure.rs | 8 | ||||
-rw-r--r-- | crates/ide/src/lib.rs | 4 | ||||
-rw-r--r-- | crates/ide_db/src/lib.rs | 6 | ||||
-rw-r--r-- | crates/rust-analyzer/src/to_proto.rs | 3 |
5 files changed, 12 insertions, 13 deletions
diff --git a/crates/ide/src/annotations.rs b/crates/ide/src/annotations.rs index fd317874e..8e0a8fd8d 100644 --- a/crates/ide/src/annotations.rs +++ b/crates/ide/src/annotations.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | use hir::Semantics; | 1 | use hir::Semantics; |
2 | use ide_db::{ | 2 | use ide_db::{ |
3 | base_db::{FileId, FilePosition, FileRange, SourceDatabase}, | 3 | base_db::{FileId, FilePosition, FileRange, SourceDatabase}, |
4 | RootDatabase, StructureNodeKind, SymbolKind, | 4 | RootDatabase, SymbolKind, |
5 | }; | 5 | }; |
6 | use syntax::TextRange; | 6 | use syntax::TextRange; |
7 | 7 | ||
@@ -11,7 +11,7 @@ use crate::{ | |||
11 | goto_implementation::goto_implementation, | 11 | goto_implementation::goto_implementation, |
12 | references::find_all_refs, | 12 | references::find_all_refs, |
13 | runnables::{runnables, Runnable}, | 13 | runnables::{runnables, Runnable}, |
14 | NavigationTarget, RunnableKind, | 14 | NavigationTarget, RunnableKind, StructureNodeKind, |
15 | }; | 15 | }; |
16 | 16 | ||
17 | // Feature: Annotations | 17 | // Feature: Annotations |
diff --git a/crates/ide/src/file_structure.rs b/crates/ide/src/file_structure.rs index c21b3fa77..9f879a66e 100644 --- a/crates/ide/src/file_structure.rs +++ b/crates/ide/src/file_structure.rs | |||
@@ -1,4 +1,4 @@ | |||
1 | use ide_db::{StructureNodeKind, SymbolKind}; | 1 | use ide_db::SymbolKind; |
2 | use syntax::{ | 2 | use syntax::{ |
3 | ast::{self, AttrsOwner, GenericParamsOwner, NameOwner}, | 3 | ast::{self, AttrsOwner, GenericParamsOwner, NameOwner}, |
4 | match_ast, AstNode, AstToken, NodeOrToken, SourceFile, SyntaxNode, SyntaxToken, TextRange, | 4 | match_ast, AstNode, AstToken, NodeOrToken, SourceFile, SyntaxNode, SyntaxToken, TextRange, |
@@ -16,6 +16,12 @@ pub struct StructureNode { | |||
16 | pub deprecated: bool, | 16 | pub deprecated: bool, |
17 | } | 17 | } |
18 | 18 | ||
19 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)] | ||
20 | pub enum StructureNodeKind { | ||
21 | SymbolKind(SymbolKind), | ||
22 | Region, | ||
23 | } | ||
24 | |||
19 | // Feature: File Structure | 25 | // Feature: File Structure |
20 | // | 26 | // |
21 | // Provides a tree of the symbols defined in the file. Can be used to | 27 | // Provides a tree of the symbols defined in the file. Can be used to |
diff --git a/crates/ide/src/lib.rs b/crates/ide/src/lib.rs index a8b169e87..662da5a96 100644 --- a/crates/ide/src/lib.rs +++ b/crates/ide/src/lib.rs | |||
@@ -71,7 +71,7 @@ pub use crate::{ | |||
71 | diagnostics::{Diagnostic, DiagnosticsConfig, Fix, Severity}, | 71 | diagnostics::{Diagnostic, DiagnosticsConfig, Fix, Severity}, |
72 | display::navigation_target::NavigationTarget, | 72 | display::navigation_target::NavigationTarget, |
73 | expand_macro::ExpandedMacro, | 73 | expand_macro::ExpandedMacro, |
74 | file_structure::StructureNode, | 74 | file_structure::{StructureNode, StructureNodeKind}, |
75 | folding_ranges::{Fold, FoldKind}, | 75 | folding_ranges::{Fold, FoldKind}, |
76 | hover::{HoverAction, HoverConfig, HoverGotoTypeData, HoverResult}, | 76 | hover::{HoverAction, HoverConfig, HoverGotoTypeData, HoverResult}, |
77 | inlay_hints::{InlayHint, InlayHintsConfig, InlayKind}, | 77 | inlay_hints::{InlayHint, InlayHintsConfig, InlayKind}, |
@@ -101,7 +101,7 @@ pub use ide_db::{ | |||
101 | search::{ReferenceAccess, SearchScope}, | 101 | search::{ReferenceAccess, SearchScope}, |
102 | source_change::{FileSystemEdit, SourceChange}, | 102 | source_change::{FileSystemEdit, SourceChange}, |
103 | symbol_index::Query, | 103 | symbol_index::Query, |
104 | RootDatabase, | 104 | RootDatabase, SymbolKind, |
105 | }; | 105 | }; |
106 | pub use ide_ssr::SsrError; | 106 | pub use ide_ssr::SsrError; |
107 | pub use syntax::{TextRange, TextSize}; | 107 | pub use syntax::{TextRange, TextSize}; |
diff --git a/crates/ide_db/src/lib.rs b/crates/ide_db/src/lib.rs index e8cafba43..88ee4a87d 100644 --- a/crates/ide_db/src/lib.rs +++ b/crates/ide_db/src/lib.rs | |||
@@ -136,12 +136,6 @@ fn line_index(db: &dyn LineIndexDatabase, file_id: FileId) -> Arc<LineIndex> { | |||
136 | } | 136 | } |
137 | 137 | ||
138 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)] | 138 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)] |
139 | pub enum StructureNodeKind { | ||
140 | SymbolKind(SymbolKind), | ||
141 | Region, | ||
142 | } | ||
143 | |||
144 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)] | ||
145 | pub enum SymbolKind { | 139 | pub enum SymbolKind { |
146 | Const, | 140 | Const, |
147 | ConstParam, | 141 | ConstParam, |
diff --git a/crates/rust-analyzer/src/to_proto.rs b/crates/rust-analyzer/src/to_proto.rs index ab742a17c..70eaae5e8 100644 --- a/crates/rust-analyzer/src/to_proto.rs +++ b/crates/rust-analyzer/src/to_proto.rs | |||
@@ -9,9 +9,8 @@ use ide::{ | |||
9 | CompletionRelevance, Documentation, FileId, FileRange, FileSystemEdit, Fold, FoldKind, | 9 | CompletionRelevance, Documentation, FileId, FileRange, FileSystemEdit, Fold, FoldKind, |
10 | Highlight, HlMod, HlPunct, HlRange, HlTag, Indel, InlayHint, InlayKind, InsertTextFormat, | 10 | Highlight, HlMod, HlPunct, HlRange, HlTag, Indel, InlayHint, InlayKind, InsertTextFormat, |
11 | Markup, NavigationTarget, ReferenceAccess, RenameError, Runnable, Severity, SourceChange, | 11 | Markup, NavigationTarget, ReferenceAccess, RenameError, Runnable, Severity, SourceChange, |
12 | TextEdit, TextRange, TextSize, | 12 | StructureNodeKind, SymbolKind, TextEdit, TextRange, TextSize, |
13 | }; | 13 | }; |
14 | use ide_db::{StructureNodeKind, SymbolKind}; | ||
15 | use itertools::Itertools; | 14 | use itertools::Itertools; |
16 | use serde_json::to_value; | 15 | use serde_json::to_value; |
17 | 16 | ||