1016: Move folding_ranges to ra_ide_api r=pasa a=pasa

folding_ranges part of #1009 

Co-authored-by: Sergey Parilin <sergey.parilin@fxdd.com>
This commit is contained in:
bors[bot] 2019-03-22 13:57:07 +00:00
commit 6e324d38d6
3 changed files with 5 additions and 5 deletions

View file

@ -20,7 +20,7 @@ pub struct Fold {
pub kind: FoldKind, pub kind: FoldKind,
} }
pub fn folding_ranges(file: &SourceFile) -> Vec<Fold> { pub(crate) fn folding_ranges(file: &SourceFile) -> Vec<Fold> {
let mut res = vec![]; let mut res = vec![];
let mut visited_comments = FxHashSet::default(); let mut visited_comments = FxHashSet::default();
let mut visited_imports = FxHashSet::default(); let mut visited_imports = FxHashSet::default();

View file

@ -34,6 +34,7 @@ mod assists;
mod diagnostics; mod diagnostics;
mod syntax_tree; mod syntax_tree;
mod line_index; mod line_index;
mod folding_ranges;
mod line_index_utils; mod line_index_utils;
#[cfg(test)] #[cfg(test)]
@ -64,9 +65,10 @@ pub use crate::{
hover::{HoverResult}, hover::{HoverResult},
line_index::{LineIndex, LineCol}, line_index::{LineIndex, LineCol},
line_index_utils::translate_offset_with_edit, line_index_utils::translate_offset_with_edit,
folding_ranges::{Fold, FoldKind},
}; };
pub use ra_ide_api_light::{ pub use ra_ide_api_light::{
Fold, FoldKind, HighlightedRange, Severity, StructureNode, LocalEdit, HighlightedRange, Severity, StructureNode, LocalEdit,
}; };
pub use ra_db::{ pub use ra_db::{
Canceled, CrateGraph, CrateId, FileId, FilePosition, FileRange, SourceRootId, Canceled, CrateGraph, CrateId, FileId, FilePosition, FileRange, SourceRootId,
@ -314,7 +316,7 @@ impl Analysis {
/// Returns the set of folding ranges. /// Returns the set of folding ranges.
pub fn folding_ranges(&self, file_id: FileId) -> Vec<Fold> { pub fn folding_ranges(&self, file_id: FileId) -> Vec<Fold> {
let file = self.db.parse(file_id); let file = self.db.parse(file_id);
ra_ide_api_light::folding_ranges(&file) folding_ranges::folding_ranges(&file)
} }
/// Fuzzy searches for a symbol. /// Fuzzy searches for a symbol.

View file

@ -3,7 +3,6 @@
//! This usually means functions which take syntax tree as an input and produce //! This usually means functions which take syntax tree as an input and produce
//! an edit or some auxiliary info. //! an edit or some auxiliary info.
mod folding_ranges;
mod structure; mod structure;
#[cfg(test)] #[cfg(test)]
mod test_utils; mod test_utils;
@ -20,7 +19,6 @@ use ra_syntax::{
}; };
pub use crate::{ pub use crate::{
folding_ranges::{folding_ranges, Fold, FoldKind},
structure::{file_structure, StructureNode}, structure::{file_structure, StructureNode},
join_lines::join_lines, join_lines::join_lines,
typing::{on_enter, on_dot_typed, on_eq_typed}, typing::{on_enter, on_dot_typed, on_eq_typed},