diff options
| author | Aleksey Kladov <aleksey.kladov@gmail.com> | 2021-03-15 12:55:27 +0300 |
|---|---|---|
| committer | Aleksey Kladov <aleksey.kladov@gmail.com> | 2021-03-15 12:55:27 +0300 |
| commit | 5dcdf2ceee2d9fcce9bb2bc5dcbafd5dbfc722b1 (patch) | |
| tree | b83064da602dc881b15623959553aabc8b31bf91 /crates | |
| parent | cec676d08236076a48a9fdae28cf0e716ae99b16 (diff) | |
| download | rust-5dcdf2ceee2d9fcce9bb2bc5dcbafd5dbfc722b1.tar.gz rust-5dcdf2ceee2d9fcce9bb2bc5dcbafd5dbfc722b1.zip | |
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.
Diffstat (limited to 'crates')
| -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 fd317874e04..8e0a8fd8de2 100644 --- a/crates/ide/src/annotations.rs +++ b/crates/ide/src/annotations.rs @@ -1,7 +1,7 @@ use hir::Semantics; use ide_db::{ base_db::{FileId, FilePosition, FileRange, SourceDatabase}, - RootDatabase, StructureNodeKind, SymbolKind, + RootDatabase, SymbolKind, }; use syntax::TextRange; @@ -11,7 +11,7 @@ use crate::{ goto_implementation::goto_implementation, references::find_all_refs, runnables::{runnables, Runnable}, - NavigationTarget, RunnableKind, + NavigationTarget, RunnableKind, StructureNodeKind, }; // Feature: Annotations diff --git a/crates/ide/src/file_structure.rs b/crates/ide/src/file_structure.rs index c21b3fa770e..9f879a66e7c 100644 --- a/crates/ide/src/file_structure.rs +++ b/crates/ide/src/file_structure.rs @@ -1,4 +1,4 @@ -use ide_db::{StructureNodeKind, SymbolKind}; +use ide_db::SymbolKind; use syntax::{ ast::{self, AttrsOwner, GenericParamsOwner, NameOwner}, match_ast, AstNode, AstToken, NodeOrToken, SourceFile, SyntaxNode, SyntaxToken, TextRange, @@ -16,6 +16,12 @@ pub struct StructureNode { pub deprecated: bool, } +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)] +pub enum StructureNodeKind { + SymbolKind(SymbolKind), + Region, +} + // Feature: File Structure // // 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 a8b169e87b4..662da5a9660 100644 --- a/crates/ide/src/lib.rs +++ b/crates/ide/src/lib.rs @@ -71,7 +71,7 @@ pub use crate::{ diagnostics::{Diagnostic, DiagnosticsConfig, Fix, Severity}, display::navigation_target::NavigationTarget, expand_macro::ExpandedMacro, - file_structure::StructureNode, + file_structure::{StructureNode, StructureNodeKind}, folding_ranges::{Fold, FoldKind}, hover::{HoverAction, HoverConfig, HoverGotoTypeData, HoverResult}, inlay_hints::{InlayHint, InlayHintsConfig, InlayKind}, @@ -101,7 +101,7 @@ pub use ide_db::{ search::{ReferenceAccess, SearchScope}, source_change::{FileSystemEdit, SourceChange}, symbol_index::Query, - RootDatabase, + RootDatabase, SymbolKind, }; pub use ide_ssr::SsrError; pub use syntax::{TextRange, TextSize}; diff --git a/crates/ide_db/src/lib.rs b/crates/ide_db/src/lib.rs index e8cafba433e..88ee4a87d51 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> { } #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)] -pub enum StructureNodeKind { - SymbolKind(SymbolKind), - Region, -} - -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)] pub enum SymbolKind { Const, ConstParam, diff --git a/crates/rust-analyzer/src/to_proto.rs b/crates/rust-analyzer/src/to_proto.rs index ab742a17ceb..70eaae5e833 100644 --- a/crates/rust-analyzer/src/to_proto.rs +++ b/crates/rust-analyzer/src/to_proto.rs @@ -9,9 +9,8 @@ use ide::{ CompletionRelevance, Documentation, FileId, FileRange, FileSystemEdit, Fold, FoldKind, Highlight, HlMod, HlPunct, HlRange, HlTag, Indel, InlayHint, InlayKind, InsertTextFormat, Markup, NavigationTarget, ReferenceAccess, RenameError, Runnable, Severity, SourceChange, - TextEdit, TextRange, TextSize, + StructureNodeKind, SymbolKind, TextEdit, TextRange, TextSize, }; -use ide_db::{StructureNodeKind, SymbolKind}; use itertools::Itertools; use serde_json::to_value; |
