Refactor server api

This commit is contained in:
Kirill Bulatov 2019-07-20 00:20:09 +03:00
parent 761fc71083
commit 201b344f2b
5 changed files with 222 additions and 55 deletions

View file

@ -38,6 +38,7 @@ mod join_lines;
mod typing;
mod matching_brace;
mod display;
mod inlay_hints;
#[cfg(test)]
mod marks;
@ -64,6 +65,7 @@ pub use crate::{
display::{file_structure, FunctionSignature, NavigationTarget, StructureNode},
folding_ranges::{Fold, FoldKind},
hover::HoverResult,
inlay_hints::{InlayHint, InlayKind},
line_index::{LineCol, LineIndex},
line_index_utils::translate_offset_with_edit,
references::ReferenceSearchResult,
@ -396,6 +398,11 @@ impl Analysis {
file_structure(&parse.tree())
}
/// Returns a list of the places in the file where type hints can be displayed.
pub fn inlay_hints(&self, file_id: FileId) -> Vec<InlayHint> {
inlay_hints::inlay_hints(&self.db.parse(file_id).tree())
}
/// Returns the set of folding ranges.
pub fn folding_ranges(&self, file_id: FileId) -> Vec<Fold> {
let parse = self.db.parse(file_id);