From 33cebe172459d1ae46556c7808411f1f539aa7cf Mon Sep 17 00:00:00 2001 From: Ville Penttinen Date: Wed, 27 Feb 2019 12:49:04 +0200 Subject: Work around for issue in vscode reporting a failure in request vscode would report "A request has failed" when it got "Content modified" message and this would cause a pop-up to appear. This works around the issue by returning an "empty" response that vscode can ignore. --- crates/ra_lsp_server/src/main_loop.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'crates/ra_lsp_server') diff --git a/crates/ra_lsp_server/src/main_loop.rs b/crates/ra_lsp_server/src/main_loop.rs index 06443bb76..1baeff266 100644 --- a/crates/ra_lsp_server/src/main_loop.rs +++ b/crates/ra_lsp_server/src/main_loop.rs @@ -416,11 +416,17 @@ impl<'a> PoolDispatcher<'a> { } Err(e) => { if is_canceled(&e) { - RawResponse::err( - id, - ErrorCode::ContentModified as i32, - "content modified".to_string(), - ) + // FIXME: When https://github.com/Microsoft/vscode-languageserver-node/issues/457 + // gets fixed, we can return the proper response. + // This works around the issue where "content modified" error would continuously + // show an message pop-up in VsCode + // RawResponse::err( + // id, + // ErrorCode::ContentModified as i32, + // "content modified".to_string(), + // ) + RawResponse::empty(id) + } else { RawResponse::err( id, -- cgit v1.2.3 From 6eb45c1c2be0fb780c4160aaa93c8d3d81e607e2 Mon Sep 17 00:00:00 2001 From: Ville Penttinen Date: Wed, 27 Feb 2019 12:57:59 +0200 Subject: Remove RawResponse::empty() --- crates/ra_lsp_server/src/main_loop.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'crates/ra_lsp_server') diff --git a/crates/ra_lsp_server/src/main_loop.rs b/crates/ra_lsp_server/src/main_loop.rs index 1baeff266..ce50fb301 100644 --- a/crates/ra_lsp_server/src/main_loop.rs +++ b/crates/ra_lsp_server/src/main_loop.rs @@ -425,8 +425,11 @@ impl<'a> PoolDispatcher<'a> { // ErrorCode::ContentModified as i32, // "content modified".to_string(), // ) - RawResponse::empty(id) - + RawResponse { + id, + result: Some(serde_json::to_value(&()).unwrap()), + error: None, + } } else { RawResponse::err( id, -- cgit v1.2.3