make FileSymbol private

This commit is contained in:
Aleksey Kladov 2019-01-02 17:11:04 +03:00
parent 830abe0c1b
commit fb775a293d
2 changed files with 7 additions and 8 deletions

View file

@ -31,13 +31,12 @@ use relative_path::RelativePathBuf;
use crate::{ use crate::{
imp::{AnalysisHostImpl, AnalysisImpl}, imp::{AnalysisHostImpl, AnalysisImpl},
symbol_index::SymbolIndex, symbol_index::{SymbolIndex, FileSymbol},
}; };
pub use crate::{ pub use crate::{
completion::{CompletionItem, CompletionItemKind, InsertText}, completion::{CompletionItem, CompletionItemKind, InsertText},
runnables::{Runnable, RunnableKind}, runnables::{Runnable, RunnableKind},
symbol_index::FileSymbol,
}; };
pub use ra_editor::{ pub use ra_editor::{
Fold, FoldKind, HighlightedRange, LineIndex, StructureNode, Severity Fold, FoldKind, HighlightedRange, LineIndex, StructureNode, Severity

View file

@ -125,14 +125,14 @@ fn is_type(kind: SyntaxKind) -> bool {
} }
#[derive(Debug, Clone, PartialEq, Eq, Hash)] #[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct FileSymbol { pub(crate) struct FileSymbol {
pub name: SmolStr, pub(crate) name: SmolStr,
pub node_range: TextRange, pub(crate) node_range: TextRange,
pub kind: SyntaxKind, pub(crate) kind: SyntaxKind,
} }
impl FileSymbol { impl FileSymbol {
pub fn docs(&self, file: &SourceFileNode) -> Option<String> { pub(crate) fn docs(&self, file: &SourceFileNode) -> Option<String> {
file.syntax() file.syntax()
.descendants() .descendants()
.filter(|node| node.kind() == self.kind && node.range() == self.node_range) .filter(|node| node.kind() == self.kind && node.range() == self.node_range)
@ -162,7 +162,7 @@ impl FileSymbol {
/// Get a description of this node. /// Get a description of this node.
/// ///
/// e.g. `struct Name`, `enum Name`, `fn Name` /// e.g. `struct Name`, `enum Name`, `fn Name`
pub fn description(&self, file: &SourceFileNode) -> Option<String> { pub(crate) fn description(&self, file: &SourceFileNode) -> Option<String> {
// TODO: After type inference is done, add type information to improve the output // TODO: After type inference is done, add type information to improve the output
file.syntax() file.syntax()
.descendants() .descendants()