switch to FileRange

This commit is contained in:
Aleksey Kladov 2018-12-28 18:15:19 +03:00
parent 02924174bb
commit fd33c89207
4 changed files with 37 additions and 15 deletions

View file

@ -0,0 +1,11 @@
use ra_db::SyntaxDatabase;
use crate::{
TextRange, FileRange,
db::RootDatabase,
};
pub(crate) fn extend_selection(db: &RootDatabase, frange: FileRange) -> TextRange {
let file = db.source_file(frange.file_id);
ra_editor::extend_selection(&file, frange.range).unwrap_or(frange.range)
}

View file

@ -14,9 +14,11 @@ mod db;
mod imp;
mod completion;
mod symbol_index;
mod syntax_highlighting;
pub mod mock_analysis;
mod extend_selection;
mod syntax_highlighting;
use std::{fmt, sync::Arc};
use rustc_hash::FxHashMap;
@ -277,8 +279,8 @@ impl Analysis {
pub fn file_line_index(&self, file_id: FileId) -> Arc<LineIndex> {
self.imp.file_line_index(file_id)
}
pub fn extend_selection(&self, file: &SourceFileNode, range: TextRange) -> TextRange {
ra_editor::extend_selection(file, range).unwrap_or(range)
pub fn extend_selection(&self, frange: FileRange) -> TextRange {
extend_selection::extend_selection(&self.imp.db, frange)
}
pub fn matching_brace(&self, file: &SourceFileNode, offset: TextUnit) -> Option<TextUnit> {
ra_editor::matching_brace(file, offset)