diff options
author | Aleksey Kladov <[email protected]> | 2019-01-02 14:11:04 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-01-02 14:11:04 +0000 |
commit | fb775a293d42787ae7c3a78fc341cbbba5863fcd (patch) | |
tree | 460c6e30151ba4b15d67ee691388b79a8eba7d42 /crates/ra_analysis | |
parent | 830abe0c1b9fdbc20a78771d0b3df37d9eabdc3e (diff) |
make FileSymbol private
Diffstat (limited to 'crates/ra_analysis')
-rw-r--r-- | crates/ra_analysis/src/lib.rs | 3 | ||||
-rw-r--r-- | crates/ra_analysis/src/symbol_index.rs | 12 |
2 files changed, 7 insertions, 8 deletions
diff --git a/crates/ra_analysis/src/lib.rs b/crates/ra_analysis/src/lib.rs index 75867ee86..392437ad9 100644 --- a/crates/ra_analysis/src/lib.rs +++ b/crates/ra_analysis/src/lib.rs | |||
@@ -31,13 +31,12 @@ use relative_path::RelativePathBuf; | |||
31 | 31 | ||
32 | use crate::{ | 32 | use crate::{ |
33 | imp::{AnalysisHostImpl, AnalysisImpl}, | 33 | imp::{AnalysisHostImpl, AnalysisImpl}, |
34 | symbol_index::SymbolIndex, | 34 | symbol_index::{SymbolIndex, FileSymbol}, |
35 | }; | 35 | }; |
36 | 36 | ||
37 | pub use crate::{ | 37 | pub use crate::{ |
38 | completion::{CompletionItem, CompletionItemKind, InsertText}, | 38 | completion::{CompletionItem, CompletionItemKind, InsertText}, |
39 | runnables::{Runnable, RunnableKind}, | 39 | runnables::{Runnable, RunnableKind}, |
40 | symbol_index::FileSymbol, | ||
41 | }; | 40 | }; |
42 | pub use ra_editor::{ | 41 | pub use ra_editor::{ |
43 | Fold, FoldKind, HighlightedRange, LineIndex, StructureNode, Severity | 42 | Fold, FoldKind, HighlightedRange, LineIndex, StructureNode, Severity |
diff --git a/crates/ra_analysis/src/symbol_index.rs b/crates/ra_analysis/src/symbol_index.rs index edb2268fb..56a84a850 100644 --- a/crates/ra_analysis/src/symbol_index.rs +++ b/crates/ra_analysis/src/symbol_index.rs | |||
@@ -125,14 +125,14 @@ fn is_type(kind: SyntaxKind) -> bool { | |||
125 | } | 125 | } |
126 | 126 | ||
127 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 127 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
128 | pub struct FileSymbol { | 128 | pub(crate) struct FileSymbol { |
129 | pub name: SmolStr, | 129 | pub(crate) name: SmolStr, |
130 | pub node_range: TextRange, | 130 | pub(crate) node_range: TextRange, |
131 | pub kind: SyntaxKind, | 131 | pub(crate) kind: SyntaxKind, |
132 | } | 132 | } |
133 | 133 | ||
134 | impl FileSymbol { | 134 | impl FileSymbol { |
135 | pub fn docs(&self, file: &SourceFileNode) -> Option<String> { | 135 | pub(crate) fn docs(&self, file: &SourceFileNode) -> Option<String> { |
136 | file.syntax() | 136 | file.syntax() |
137 | .descendants() | 137 | .descendants() |
138 | .filter(|node| node.kind() == self.kind && node.range() == self.node_range) | 138 | .filter(|node| node.kind() == self.kind && node.range() == self.node_range) |
@@ -162,7 +162,7 @@ impl FileSymbol { | |||
162 | /// Get a description of this node. | 162 | /// Get a description of this node. |
163 | /// | 163 | /// |
164 | /// e.g. `struct Name`, `enum Name`, `fn Name` | 164 | /// e.g. `struct Name`, `enum Name`, `fn Name` |
165 | pub fn description(&self, file: &SourceFileNode) -> Option<String> { | 165 | pub(crate) fn description(&self, file: &SourceFileNode) -> Option<String> { |
166 | // TODO: After type inference is done, add type information to improve the output | 166 | // TODO: After type inference is done, add type information to improve the output |
167 | file.syntax() | 167 | file.syntax() |
168 | .descendants() | 168 | .descendants() |