mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
introduce FileRange
This commit is contained in:
parent
d7440a5f49
commit
02924174bb
3 changed files with 29 additions and 19 deletions
|
@ -38,7 +38,7 @@ pub use ra_editor::{
|
|||
pub use hir::FnSignatureInfo;
|
||||
|
||||
pub use ra_db::{
|
||||
Canceled, Cancelable, FilePosition,
|
||||
Canceled, Cancelable, FilePosition, FileRange,
|
||||
CrateGraph, CrateId, SourceRootId, FileId
|
||||
};
|
||||
|
||||
|
@ -287,9 +287,9 @@ impl Analysis {
|
|||
let file = self.imp.file_syntax(file_id);
|
||||
ra_editor::syntax_tree(&file)
|
||||
}
|
||||
pub fn join_lines(&self, file_id: FileId, range: TextRange) -> SourceChange {
|
||||
let file = self.imp.file_syntax(file_id);
|
||||
SourceChange::from_local_edit(file_id, ra_editor::join_lines(&file, range))
|
||||
pub fn join_lines(&self, frange: FileRange) -> SourceChange {
|
||||
let file = self.imp.file_syntax(frange.file_id);
|
||||
SourceChange::from_local_edit(frange.file_id, ra_editor::join_lines(&file, frange.range))
|
||||
}
|
||||
pub fn on_enter(&self, position: FilePosition) -> Option<SourceChange> {
|
||||
let file = self.imp.file_syntax(position.file_id);
|
||||
|
@ -346,8 +346,8 @@ impl Analysis {
|
|||
pub fn completions(&self, position: FilePosition) -> Cancelable<Option<Vec<CompletionItem>>> {
|
||||
self.imp.completions(position)
|
||||
}
|
||||
pub fn assists(&self, file_id: FileId, range: TextRange) -> Cancelable<Vec<SourceChange>> {
|
||||
Ok(self.imp.assists(file_id, range))
|
||||
pub fn assists(&self, frange: FileRange) -> Cancelable<Vec<SourceChange>> {
|
||||
Ok(self.imp.assists(frange))
|
||||
}
|
||||
pub fn diagnostics(&self, file_id: FileId) -> Cancelable<Vec<Diagnostic>> {
|
||||
self.imp.diagnostics(file_id)
|
||||
|
@ -358,8 +358,8 @@ impl Analysis {
|
|||
) -> Cancelable<Option<(FnSignatureInfo, Option<usize>)>> {
|
||||
self.imp.resolve_callable(position)
|
||||
}
|
||||
pub fn type_of(&self, file_id: FileId, range: TextRange) -> Cancelable<Option<String>> {
|
||||
self.imp.type_of(file_id, range)
|
||||
pub fn type_of(&self, frange: FileRange) -> Cancelable<Option<String>> {
|
||||
self.imp.type_of(frange)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue