mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +00:00
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.
This commit is contained in:
parent
4248b39993
commit
33cebe1724
2 changed files with 16 additions and 5 deletions
|
@ -120,6 +120,11 @@ impl RawResponse {
|
||||||
let error = RawResponseError { code, message, data: None };
|
let error = RawResponseError { code, message, data: None };
|
||||||
RawResponse { id, result: None, error: Some(error) }
|
RawResponse { id, result: None, error: Some(error) }
|
||||||
}
|
}
|
||||||
|
/// Returns an "empty" RawResponse
|
||||||
|
/// Empty response still has a value `()` in its `result` field.
|
||||||
|
pub fn empty(id: u64) -> RawResponse {
|
||||||
|
RawResponse { id, result: Some(to_value(&()).unwrap()), error: None }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl RawNotification {
|
impl RawNotification {
|
||||||
|
|
|
@ -416,11 +416,17 @@ impl<'a> PoolDispatcher<'a> {
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
if is_canceled(&e) {
|
if is_canceled(&e) {
|
||||||
RawResponse::err(
|
// FIXME: When https://github.com/Microsoft/vscode-languageserver-node/issues/457
|
||||||
id,
|
// gets fixed, we can return the proper response.
|
||||||
ErrorCode::ContentModified as i32,
|
// This works around the issue where "content modified" error would continuously
|
||||||
"content modified".to_string(),
|
// show an message pop-up in VsCode
|
||||||
)
|
// RawResponse::err(
|
||||||
|
// id,
|
||||||
|
// ErrorCode::ContentModified as i32,
|
||||||
|
// "content modified".to_string(),
|
||||||
|
// )
|
||||||
|
RawResponse::empty(id)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
RawResponse::err(
|
RawResponse::err(
|
||||||
id,
|
id,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue