mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Merge #558
558: kill last cancelables r=matklad a=matklad Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
commit
ab46f8abf1
@ -15,7 +15,6 @@ use ra_syntax::{
|
|||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
AnalysisChange,
|
AnalysisChange,
|
||||||
Cancelable,
|
|
||||||
CrateId, db, Diagnostic, FileId, FilePosition, FileRange, FileSystemEdit,
|
CrateId, db, Diagnostic, FileId, FilePosition, FileRange, FileSystemEdit,
|
||||||
Query, RootChange, SourceChange, SourceFileEdit,
|
Query, RootChange, SourceChange, SourceFileEdit,
|
||||||
symbol_index::{LibrarySymbolsQuery, FileSymbol},
|
symbol_index::{LibrarySymbolsQuery, FileSymbol},
|
||||||
@ -158,7 +157,7 @@ impl db::RootDatabase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn diagnostics(&self, file_id: FileId) -> Cancelable<Vec<Diagnostic>> {
|
pub(crate) fn diagnostics(&self, file_id: FileId) -> Vec<Diagnostic> {
|
||||||
let syntax = self.source_file(file_id);
|
let syntax = self.source_file(file_id);
|
||||||
|
|
||||||
let mut res = ra_ide_api_light::diagnostics(&syntax)
|
let mut res = ra_ide_api_light::diagnostics(&syntax)
|
||||||
@ -219,7 +218,7 @@ impl db::RootDatabase {
|
|||||||
res.push(diag)
|
res.push(diag)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Ok(res)
|
res
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn assists(&self, frange: FileRange) -> Vec<SourceChange> {
|
pub(crate) fn assists(&self, frange: FileRange) -> Vec<SourceChange> {
|
||||||
|
@ -429,7 +429,7 @@ impl Analysis {
|
|||||||
/// Computes syntax highlighting for the given file.
|
/// Computes syntax highlighting for the given file.
|
||||||
pub fn highlight(&self, file_id: FileId) -> Cancelable<Vec<HighlightedRange>> {
|
pub fn highlight(&self, file_id: FileId) -> Cancelable<Vec<HighlightedRange>> {
|
||||||
self.db
|
self.db
|
||||||
.catch_canceled(|db| syntax_highlighting::highlight(db, file_id))?
|
.catch_canceled(|db| syntax_highlighting::highlight(db, file_id))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Computes completions at the given position.
|
/// Computes completions at the given position.
|
||||||
@ -448,7 +448,7 @@ impl Analysis {
|
|||||||
|
|
||||||
/// Computes the set of diagnostics for the given file.
|
/// Computes the set of diagnostics for the given file.
|
||||||
pub fn diagnostics(&self, file_id: FileId) -> Cancelable<Vec<Diagnostic>> {
|
pub fn diagnostics(&self, file_id: FileId) -> Cancelable<Vec<Diagnostic>> {
|
||||||
self.with_db(|db| db.diagnostics(file_id))?
|
self.with_db(|db| db.diagnostics(file_id))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Computes the type of the expression at the given position.
|
/// Computes the type of the expression at the given position.
|
||||||
|
@ -2,11 +2,11 @@ use ra_syntax::{ast, AstNode,};
|
|||||||
use ra_db::SyntaxDatabase;
|
use ra_db::SyntaxDatabase;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
FileId, Cancelable, HighlightedRange,
|
FileId, HighlightedRange,
|
||||||
db::RootDatabase,
|
db::RootDatabase,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Cancelable<Vec<HighlightedRange>> {
|
pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Vec<HighlightedRange> {
|
||||||
let source_file = db.source_file(file_id);
|
let source_file = db.source_file(file_id);
|
||||||
let mut res = ra_ide_api_light::highlight(source_file.syntax());
|
let mut res = ra_ide_api_light::highlight(source_file.syntax());
|
||||||
for macro_call in source_file
|
for macro_call in source_file
|
||||||
@ -28,7 +28,7 @@ pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Cancelable<Vec<Hi
|
|||||||
res.extend(mapped_ranges);
|
res.extend(mapped_ranges);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(res)
|
res
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
Loading…
Reference in New Issue
Block a user