aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-01-15 18:18:01 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-01-15 18:18:01 +0000
commitab46f8abf195a78c018d8b23896eb920d16b028b (patch)
treeb82a2973067dffa988e253c4038cdf0e9b0a6963 /crates/ra_ide_api
parent6fba078ab693ec79e887b64e92a7ed3a21e29728 (diff)
parent8338acfd3a9a9e5ab099abd5f01b5c43245daf0a (diff)
Merge #558
558: kill last cancelables r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_ide_api')
-rw-r--r--crates/ra_ide_api/src/imp.rs5
-rw-r--r--crates/ra_ide_api/src/lib.rs4
-rw-r--r--crates/ra_ide_api/src/syntax_highlighting.rs6
3 files changed, 7 insertions, 8 deletions
diff --git a/crates/ra_ide_api/src/imp.rs b/crates/ra_ide_api/src/imp.rs
index a21cae624..61771ed40 100644
--- a/crates/ra_ide_api/src/imp.rs
+++ b/crates/ra_ide_api/src/imp.rs
@@ -15,7 +15,6 @@ use ra_syntax::{
15 15
16use crate::{ 16use crate::{
17 AnalysisChange, 17 AnalysisChange,
18 Cancelable,
19 CrateId, db, Diagnostic, FileId, FilePosition, FileRange, FileSystemEdit, 18 CrateId, db, Diagnostic, FileId, FilePosition, FileRange, FileSystemEdit,
20 Query, RootChange, SourceChange, SourceFileEdit, 19 Query, RootChange, SourceChange, SourceFileEdit,
21 symbol_index::{LibrarySymbolsQuery, FileSymbol}, 20 symbol_index::{LibrarySymbolsQuery, FileSymbol},
@@ -158,7 +157,7 @@ impl db::RootDatabase {
158 } 157 }
159 } 158 }
160 159
161 pub(crate) fn diagnostics(&self, file_id: FileId) -> Cancelable<Vec<Diagnostic>> { 160 pub(crate) fn diagnostics(&self, file_id: FileId) -> Vec<Diagnostic> {
162 let syntax = self.source_file(file_id); 161 let syntax = self.source_file(file_id);
163 162
164 let mut res = ra_ide_api_light::diagnostics(&syntax) 163 let mut res = ra_ide_api_light::diagnostics(&syntax)
@@ -219,7 +218,7 @@ impl db::RootDatabase {
219 res.push(diag) 218 res.push(diag)
220 } 219 }
221 }; 220 };
222 Ok(res) 221 res
223 } 222 }
224 223
225 pub(crate) fn assists(&self, frange: FileRange) -> Vec<SourceChange> { 224 pub(crate) fn assists(&self, frange: FileRange) -> Vec<SourceChange> {
diff --git a/crates/ra_ide_api/src/lib.rs b/crates/ra_ide_api/src/lib.rs
index ea5267ad9..3a0d2dbbe 100644
--- a/crates/ra_ide_api/src/lib.rs
+++ b/crates/ra_ide_api/src/lib.rs
@@ -429,7 +429,7 @@ impl Analysis {
429 /// Computes syntax highlighting for the given file. 429 /// Computes syntax highlighting for the given file.
430 pub fn highlight(&self, file_id: FileId) -> Cancelable<Vec<HighlightedRange>> { 430 pub fn highlight(&self, file_id: FileId) -> Cancelable<Vec<HighlightedRange>> {
431 self.db 431 self.db
432 .catch_canceled(|db| syntax_highlighting::highlight(db, file_id))? 432 .catch_canceled(|db| syntax_highlighting::highlight(db, file_id))
433 } 433 }
434 434
435 /// Computes completions at the given position. 435 /// Computes completions at the given position.
@@ -448,7 +448,7 @@ impl Analysis {
448 448
449 /// Computes the set of diagnostics for the given file. 449 /// Computes the set of diagnostics for the given file.
450 pub fn diagnostics(&self, file_id: FileId) -> Cancelable<Vec<Diagnostic>> { 450 pub fn diagnostics(&self, file_id: FileId) -> Cancelable<Vec<Diagnostic>> {
451 self.with_db(|db| db.diagnostics(file_id))? 451 self.with_db(|db| db.diagnostics(file_id))
452 } 452 }
453 453
454 /// Computes the type of the expression at the given position. 454 /// Computes the type of the expression at the given position.
diff --git a/crates/ra_ide_api/src/syntax_highlighting.rs b/crates/ra_ide_api/src/syntax_highlighting.rs
index 480b78dce..a4d3ad005 100644
--- a/crates/ra_ide_api/src/syntax_highlighting.rs
+++ b/crates/ra_ide_api/src/syntax_highlighting.rs
@@ -2,11 +2,11 @@ use ra_syntax::{ast, AstNode,};
2use ra_db::SyntaxDatabase; 2use ra_db::SyntaxDatabase;
3 3
4use crate::{ 4use crate::{
5 FileId, Cancelable, HighlightedRange, 5 FileId, HighlightedRange,
6 db::RootDatabase, 6 db::RootDatabase,
7}; 7};
8 8
9pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Cancelable<Vec<HighlightedRange>> { 9pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Vec<HighlightedRange> {
10 let source_file = db.source_file(file_id); 10 let source_file = db.source_file(file_id);
11 let mut res = ra_ide_api_light::highlight(source_file.syntax()); 11 let mut res = ra_ide_api_light::highlight(source_file.syntax());
12 for macro_call in source_file 12 for macro_call in source_file
@@ -28,7 +28,7 @@ pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Cancelable<Vec<Hi
28 res.extend(mapped_ranges); 28 res.extend(mapped_ranges);
29 } 29 }
30 } 30 }
31 Ok(res) 31 res
32} 32}
33 33
34#[cfg(test)] 34#[cfg(test)]