mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
switch to FileRange
This commit is contained in:
parent
02924174bb
commit
fd33c89207
4 changed files with 37 additions and 15 deletions
11
crates/ra_analysis/src/extend_selection.rs
Normal file
11
crates/ra_analysis/src/extend_selection.rs
Normal 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)
|
||||
}
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue