aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_lsp_server/src/main_loop.rs17
-rw-r--r--crates/ra_mbe/src/syntax_bridge.rs8
2 files changed, 17 insertions, 8 deletions
diff --git a/crates/ra_lsp_server/src/main_loop.rs b/crates/ra_lsp_server/src/main_loop.rs
index 06443bb76..ce50fb301 100644
--- a/crates/ra_lsp_server/src/main_loop.rs
+++ b/crates/ra_lsp_server/src/main_loop.rs
@@ -416,11 +416,20 @@ impl<'a> PoolDispatcher<'a> {
416 } 416 }
417 Err(e) => { 417 Err(e) => {
418 if is_canceled(&e) { 418 if is_canceled(&e) {
419 RawResponse::err( 419 // FIXME: When https://github.com/Microsoft/vscode-languageserver-node/issues/457
420 // gets fixed, we can return the proper response.
421 // This works around the issue where "content modified" error would continuously
422 // show an message pop-up in VsCode
423 // RawResponse::err(
424 // id,
425 // ErrorCode::ContentModified as i32,
426 // "content modified".to_string(),
427 // )
428 RawResponse {
420 id, 429 id,
421 ErrorCode::ContentModified as i32, 430 result: Some(serde_json::to_value(&()).unwrap()),
422 "content modified".to_string(), 431 error: None,
423 ) 432 }
424 } else { 433 } else {
425 RawResponse::err( 434 RawResponse::err(
426 id, 435 id,
diff --git a/crates/ra_mbe/src/syntax_bridge.rs b/crates/ra_mbe/src/syntax_bridge.rs
index c1472bbe5..4b1d1d3ca 100644
--- a/crates/ra_mbe/src/syntax_bridge.rs
+++ b/crates/ra_mbe/src/syntax_bridge.rs
@@ -8,7 +8,7 @@ use ra_syntax::{
8#[derive(Default)] 8#[derive(Default)]
9pub struct TokenMap { 9pub struct TokenMap {
10 /// Maps `tt::TokenId` to the *relative* source range. 10 /// Maps `tt::TokenId` to the *relative* source range.
11 toknes: Vec<TextRange>, 11 tokens: Vec<TextRange>,
12} 12}
13 13
14/// Convert the syntax tree (what user has written) to a `TokenTree` (what macro 14/// Convert the syntax tree (what user has written) to a `TokenTree` (what macro
@@ -32,12 +32,12 @@ pub fn token_tree_to_ast_item_list(tt: &tt::Subtree) -> TreeArc<ast::SourceFile>
32impl TokenMap { 32impl TokenMap {
33 pub fn relative_range_of(&self, tt: tt::TokenId) -> Option<TextRange> { 33 pub fn relative_range_of(&self, tt: tt::TokenId) -> Option<TextRange> {
34 let idx = tt.0 as usize; 34 let idx = tt.0 as usize;
35 self.toknes.get(idx).map(|&it| it) 35 self.tokens.get(idx).map(|&it| it)
36 } 36 }
37 37
38 fn alloc(&mut self, relative_range: TextRange) -> tt::TokenId { 38 fn alloc(&mut self, relative_range: TextRange) -> tt::TokenId {
39 let id = self.toknes.len(); 39 let id = self.tokens.len();
40 self.toknes.push(relative_range); 40 self.tokens.push(relative_range);
41 tt::TokenId(id as u32) 41 tt::TokenId(id as u32)
42 } 42 }
43} 43}