aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-07-11 10:13:10 +0100
committerbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-07-11 10:13:10 +0100
commitfa3716efe67f97929ad1351c9a07cc914e0bdf45 (patch)
tree380f0680aed256d28db5f535d7aa0e480aa489e0
parent46d7b08c5f0440fed43399ffe925e30bfe95e5dd (diff)
parente81a47b8ebce9bcf680b15c6e0c1e879200f75df (diff)
Merge #1520
1520: Ignore workspace/didChangeConfiguration notifications. r=matklad a=bolinfest If the client happens to send a `workspace/didChangeConfiguration` notification, it is nicer if rust-analyzer can just ignore it rather than crash with an "unhandled notification" error. Co-authored-by: Michael Bolin <[email protected]>
-rw-r--r--crates/ra_lsp_server/src/caps.rs10
-rw-r--r--crates/ra_lsp_server/src/main_loop.rs6
-rw-r--r--crates/ra_lsp_server/src/req.rs9
-rw-r--r--docs/dev/lsp-features.md2
4 files changed, 15 insertions, 12 deletions
diff --git a/crates/ra_lsp_server/src/caps.rs b/crates/ra_lsp_server/src/caps.rs
index 3851aadf2..bb9205aed 100644
--- a/crates/ra_lsp_server/src/caps.rs
+++ b/crates/ra_lsp_server/src/caps.rs
@@ -1,8 +1,8 @@
1use lsp_types::{ 1use lsp_types::{
2 CodeActionProviderCapability, CodeLensOptions, CompletionOptions, 2 CodeActionProviderCapability, CodeLensOptions, CompletionOptions,
3 DocumentOnTypeFormattingOptions, ExecuteCommandOptions, FoldingRangeProviderCapability, 3 DocumentOnTypeFormattingOptions, FoldingRangeProviderCapability, GenericCapability,
4 GenericCapability, ImplementationProviderCapability, RenameOptions, RenameProviderCapability, 4 ImplementationProviderCapability, RenameOptions, RenameProviderCapability, ServerCapabilities,
5 ServerCapabilities, SignatureHelpOptions, TextDocumentSyncCapability, TextDocumentSyncKind, 5 SignatureHelpOptions, TextDocumentSyncCapability, TextDocumentSyncKind,
6 TextDocumentSyncOptions, TypeDefinitionProviderCapability, 6 TextDocumentSyncOptions, TypeDefinitionProviderCapability,
7}; 7};
8 8
@@ -44,9 +44,7 @@ pub fn server_capabilities() -> ServerCapabilities {
44 prepare_provider: Some(true), 44 prepare_provider: Some(true),
45 })), 45 })),
46 color_provider: None, 46 color_provider: None,
47 execute_command_provider: Some(ExecuteCommandOptions { 47 execute_command_provider: None,
48 commands: vec!["apply_code_action".to_string()],
49 }),
50 workspace: None, 48 workspace: None,
51 } 49 }
52} 50}
diff --git a/crates/ra_lsp_server/src/main_loop.rs b/crates/ra_lsp_server/src/main_loop.rs
index f7becd8fb..668d2fd72 100644
--- a/crates/ra_lsp_server/src/main_loop.rs
+++ b/crates/ra_lsp_server/src/main_loop.rs
@@ -431,6 +431,12 @@ fn on_notification(
431 } 431 }
432 Err(not) => not, 432 Err(not) => not,
433 }; 433 };
434 let not = match not.cast::<req::DidChangeConfiguration>() {
435 Ok(_params) => {
436 return Ok(());
437 }
438 Err(not) => not,
439 };
434 log::error!("unhandled notification: {:?}", not); 440 log::error!("unhandled notification: {:?}", not);
435 Ok(()) 441 Ok(())
436} 442}
diff --git a/crates/ra_lsp_server/src/req.rs b/crates/ra_lsp_server/src/req.rs
index 27f2deb34..8d39b04a7 100644
--- a/crates/ra_lsp_server/src/req.rs
+++ b/crates/ra_lsp_server/src/req.rs
@@ -5,10 +5,11 @@ use url_serde;
5 5
6pub use lsp_types::{ 6pub use lsp_types::{
7 notification::*, request::*, ApplyWorkspaceEditParams, CodeActionParams, CodeLens, 7 notification::*, request::*, ApplyWorkspaceEditParams, CodeActionParams, CodeLens,
8 CodeLensParams, CompletionParams, CompletionResponse, DocumentOnTypeFormattingParams, 8 CodeLensParams, CompletionParams, CompletionResponse, DidChangeConfigurationParams,
9 DocumentSymbolParams, DocumentSymbolResponse, ExecuteCommandParams, Hover, InitializeResult, 9 DocumentOnTypeFormattingParams, DocumentSymbolParams, DocumentSymbolResponse, Hover,
10 MessageType, PublishDiagnosticsParams, ReferenceParams, ShowMessageParams, SignatureHelp, 10 InitializeResult, MessageType, PublishDiagnosticsParams, ReferenceParams, ShowMessageParams,
11 TextDocumentEdit, TextDocumentPositionParams, TextEdit, WorkspaceEdit, WorkspaceSymbolParams, 11 SignatureHelp, TextDocumentEdit, TextDocumentPositionParams, TextEdit, WorkspaceEdit,
12 WorkspaceSymbolParams,
12}; 13};
13 14
14pub enum AnalyzerStatus {} 15pub enum AnalyzerStatus {}
diff --git a/docs/dev/lsp-features.md b/docs/dev/lsp-features.md
index 28bae59bb..d3e79b8be 100644
--- a/docs/dev/lsp-features.md
+++ b/docs/dev/lsp-features.md
@@ -16,8 +16,6 @@ This list documents LSP features, supported by rust-analyzer.
16- [ ] [workspace/configuration](https://microsoft.github.io/language-server-protocol/specification#workspace_configuration) 16- [ ] [workspace/configuration](https://microsoft.github.io/language-server-protocol/specification#workspace_configuration)
17- [x] [workspace/didChangeWatchedFiles](https://microsoft.github.io/language-server-protocol/specification#workspace_didChangeWatchedFiles) 17- [x] [workspace/didChangeWatchedFiles](https://microsoft.github.io/language-server-protocol/specification#workspace_didChangeWatchedFiles)
18- [x] [workspace/symbol](https://microsoft.github.io/language-server-protocol/specification#workspace_symbol) 18- [x] [workspace/symbol](https://microsoft.github.io/language-server-protocol/specification#workspace_symbol)
19- [x] [workspace/executeCommand](https://microsoft.github.io/language-server-protocol/specification#workspace_executeCommand)
20 - `apply_code_action`
21- [ ] [workspace/applyEdit](https://microsoft.github.io/language-server-protocol/specification#workspace_applyEdit) 19- [ ] [workspace/applyEdit](https://microsoft.github.io/language-server-protocol/specification#workspace_applyEdit)
22 20
23## Text Synchronization 21## Text Synchronization