aboutsummaryrefslogtreecommitdiff
path: root/crates/rust-analyzer
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-05-31 13:42:32 +0100
committerGitHub <[email protected]>2021-05-31 13:42:32 +0100
commite9a797748daa7e25cde66927b8907b2d976201a5 (patch)
tree438bb6e1a2c5e422ee18994d2e045480b429d549 /crates/rust-analyzer
parentb8d269990c57634e77f4702afc91041bacb4816a (diff)
parentacb5c227ed2d2d52d67ab56a61e6944cd4d5de88 (diff)
Merge #8866
8866: Update salsa r=matklad a=jonas-schievink This updates salsa to include https://github.com/salsa-rs/salsa/pull/265, and removes all cancellation-related code from rust-analyzer Co-authored-by: Jonas Schievink <[email protected]>
Diffstat (limited to 'crates/rust-analyzer')
-rw-r--r--crates/rust-analyzer/src/dispatch.rs4
-rw-r--r--crates/rust-analyzer/src/global_state.rs4
-rw-r--r--crates/rust-analyzer/src/lsp_utils.rs6
-rw-r--r--crates/rust-analyzer/src/main_loop.rs4
-rw-r--r--crates/rust-analyzer/src/to_proto.rs6
5 files changed, 12 insertions, 12 deletions
diff --git a/crates/rust-analyzer/src/dispatch.rs b/crates/rust-analyzer/src/dispatch.rs
index baf2199d9..2011a4132 100644
--- a/crates/rust-analyzer/src/dispatch.rs
+++ b/crates/rust-analyzer/src/dispatch.rs
@@ -5,7 +5,7 @@ use serde::{de::DeserializeOwned, Serialize};
5 5
6use crate::{ 6use crate::{
7 global_state::{GlobalState, GlobalStateSnapshot}, 7 global_state::{GlobalState, GlobalStateSnapshot},
8 lsp_utils::is_canceled, 8 lsp_utils::is_cancelled,
9 main_loop::Task, 9 main_loop::Task,
10 LspError, Result, 10 LspError, Result,
11}; 11};
@@ -132,7 +132,7 @@ where
132 Err(e) => match e.downcast::<LspError>() { 132 Err(e) => match e.downcast::<LspError>() {
133 Ok(lsp_error) => lsp_server::Response::new_err(id, lsp_error.code, lsp_error.message), 133 Ok(lsp_error) => lsp_server::Response::new_err(id, lsp_error.code, lsp_error.message),
134 Err(e) => { 134 Err(e) => {
135 if is_canceled(&*e) { 135 if is_cancelled(&*e) {
136 lsp_server::Response::new_err( 136 lsp_server::Response::new_err(
137 id, 137 id,
138 lsp_server::ErrorCode::ContentModified as i32, 138 lsp_server::ErrorCode::ContentModified as i32,
diff --git a/crates/rust-analyzer/src/global_state.rs b/crates/rust-analyzer/src/global_state.rs
index 6a36d29d4..ea9dbf7fc 100644
--- a/crates/rust-analyzer/src/global_state.rs
+++ b/crates/rust-analyzer/src/global_state.rs
@@ -7,7 +7,7 @@ use std::{sync::Arc, time::Instant};
7 7
8use crossbeam_channel::{unbounded, Receiver, Sender}; 8use crossbeam_channel::{unbounded, Receiver, Sender};
9use flycheck::FlycheckHandle; 9use flycheck::FlycheckHandle;
10use ide::{Analysis, AnalysisHost, Cancelable, Change, FileId}; 10use ide::{Analysis, AnalysisHost, Cancellable, Change, FileId};
11use ide_db::base_db::{CrateId, VfsPath}; 11use ide_db::base_db::{CrateId, VfsPath};
12use lsp_types::{SemanticTokens, Url}; 12use lsp_types::{SemanticTokens, Url};
13use parking_lot::{Mutex, RwLock}; 13use parking_lot::{Mutex, RwLock};
@@ -280,7 +280,7 @@ impl GlobalStateSnapshot {
280 file_id_to_url(&self.vfs.read().0, id) 280 file_id_to_url(&self.vfs.read().0, id)
281 } 281 }
282 282
283 pub(crate) fn file_line_index(&self, file_id: FileId) -> Cancelable<LineIndex> { 283 pub(crate) fn file_line_index(&self, file_id: FileId) -> Cancellable<LineIndex> {
284 let endings = self.vfs.read().1[&file_id]; 284 let endings = self.vfs.read().1[&file_id];
285 let index = self.analysis.file_line_index(file_id)?; 285 let index = self.analysis.file_line_index(file_id)?;
286 let res = LineIndex { index, endings, encoding: self.config.offset_encoding() }; 286 let res = LineIndex { index, endings, encoding: self.config.offset_encoding() };
diff --git a/crates/rust-analyzer/src/lsp_utils.rs b/crates/rust-analyzer/src/lsp_utils.rs
index 73c4193e8..8000b5490 100644
--- a/crates/rust-analyzer/src/lsp_utils.rs
+++ b/crates/rust-analyzer/src/lsp_utils.rs
@@ -1,7 +1,7 @@
1//! Utilities for LSP-related boilerplate code. 1//! Utilities for LSP-related boilerplate code.
2use std::{error::Error, ops::Range, sync::Arc}; 2use std::{error::Error, ops::Range, sync::Arc};
3 3
4use ide_db::base_db::Canceled; 4use ide_db::base_db::Cancelled;
5use lsp_server::Notification; 5use lsp_server::Notification;
6 6
7use crate::{ 7use crate::{
@@ -10,8 +10,8 @@ use crate::{
10 line_index::{LineEndings, LineIndex, OffsetEncoding}, 10 line_index::{LineEndings, LineIndex, OffsetEncoding},
11}; 11};
12 12
13pub(crate) fn is_canceled(e: &(dyn Error + 'static)) -> bool { 13pub(crate) fn is_cancelled(e: &(dyn Error + 'static)) -> bool {
14 e.downcast_ref::<Canceled>().is_some() 14 e.downcast_ref::<Cancelled>().is_some()
15} 15}
16 16
17pub(crate) fn notification_is<N: lsp_types::notification::Notification>( 17pub(crate) fn notification_is<N: lsp_types::notification::Notification>(
diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs
index 008758ea0..31d8ea9e7 100644
--- a/crates/rust-analyzer/src/main_loop.rs
+++ b/crates/rust-analyzer/src/main_loop.rs
@@ -22,7 +22,7 @@ use crate::{
22 from_proto, 22 from_proto,
23 global_state::{file_id_to_url, url_to_file_id, GlobalState}, 23 global_state::{file_id_to_url, url_to_file_id, GlobalState},
24 handlers, lsp_ext, 24 handlers, lsp_ext,
25 lsp_utils::{apply_document_changes, is_canceled, notification_is, Progress}, 25 lsp_utils::{apply_document_changes, is_cancelled, notification_is, Progress},
26 reload::{BuildDataProgress, ProjectWorkspaceProgress}, 26 reload::{BuildDataProgress, ProjectWorkspaceProgress},
27 Result, 27 Result,
28}; 28};
@@ -752,7 +752,7 @@ impl GlobalState {
752 .filter_map(|file_id| { 752 .filter_map(|file_id| {
753 handlers::publish_diagnostics(&snapshot, file_id) 753 handlers::publish_diagnostics(&snapshot, file_id)
754 .map_err(|err| { 754 .map_err(|err| {
755 if !is_canceled(&*err) { 755 if !is_cancelled(&*err) {
756 log::error!("failed to compute diagnostics: {:?}", err); 756 log::error!("failed to compute diagnostics: {:?}", err);
757 } 757 }
758 () 758 ()
diff --git a/crates/rust-analyzer/src/to_proto.rs b/crates/rust-analyzer/src/to_proto.rs
index f5c8535a2..85898f495 100644
--- a/crates/rust-analyzer/src/to_proto.rs
+++ b/crates/rust-analyzer/src/to_proto.rs
@@ -6,7 +6,7 @@ use std::{
6}; 6};
7 7
8use ide::{ 8use ide::{
9 Annotation, AnnotationKind, Assist, AssistKind, CallInfo, Cancelable, CompletionItem, 9 Annotation, AnnotationKind, Assist, AssistKind, CallInfo, Cancellable, CompletionItem,
10 CompletionItemKind, CompletionRelevance, Documentation, FileId, FileRange, FileSystemEdit, 10 CompletionItemKind, CompletionRelevance, Documentation, FileId, FileRange, FileSystemEdit,
11 Fold, FoldKind, Highlight, HlMod, HlOperator, HlPunct, HlRange, HlTag, Indel, InlayHint, 11 Fold, FoldKind, Highlight, HlMod, HlOperator, HlPunct, HlRange, HlTag, Indel, InlayHint,
12 InlayKind, InsertTextFormat, Markup, NavigationTarget, ReferenceAccess, RenameError, Runnable, 12 InlayKind, InsertTextFormat, Markup, NavigationTarget, ReferenceAccess, RenameError, Runnable,
@@ -727,7 +727,7 @@ pub(crate) fn snippet_text_document_edit(
727pub(crate) fn snippet_text_document_ops( 727pub(crate) fn snippet_text_document_ops(
728 snap: &GlobalStateSnapshot, 728 snap: &GlobalStateSnapshot,
729 file_system_edit: FileSystemEdit, 729 file_system_edit: FileSystemEdit,
730) -> Cancelable<Vec<lsp_ext::SnippetDocumentChangeOperation>> { 730) -> Cancellable<Vec<lsp_ext::SnippetDocumentChangeOperation>> {
731 let mut ops = Vec::new(); 731 let mut ops = Vec::new();
732 match file_system_edit { 732 match file_system_edit {
733 FileSystemEdit::CreateFile { dst, initial_contents } => { 733 FileSystemEdit::CreateFile { dst, initial_contents } => {
@@ -757,7 +757,7 @@ pub(crate) fn snippet_text_document_ops(
757 let new_uri = snap.anchored_path(&dst); 757 let new_uri = snap.anchored_path(&dst);
758 let mut rename_file = 758 let mut rename_file =
759 lsp_types::RenameFile { old_uri, new_uri, options: None, annotation_id: None }; 759 lsp_types::RenameFile { old_uri, new_uri, options: None, annotation_id: None };
760 if snap.analysis.is_library_file(src) == Ok(true) 760 if snap.analysis.is_library_file(src).ok() == Some(true)
761 && snap.config.change_annotation_support() 761 && snap.config.change_annotation_support()
762 { 762 {
763 rename_file.annotation_id = Some(outside_workspace_annotation_id()) 763 rename_file.annotation_id = Some(outside_workspace_annotation_id())