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 <bolinfest@gmail.com>
This commit is contained in:
bors[bot] 2019-07-11 09:13:10 +00:00
commit fa3716efe6
4 changed files with 15 additions and 12 deletions

View file

@ -1,8 +1,8 @@
use lsp_types::{
CodeActionProviderCapability, CodeLensOptions, CompletionOptions,
DocumentOnTypeFormattingOptions, ExecuteCommandOptions, FoldingRangeProviderCapability,
GenericCapability, ImplementationProviderCapability, RenameOptions, RenameProviderCapability,
ServerCapabilities, SignatureHelpOptions, TextDocumentSyncCapability, TextDocumentSyncKind,
DocumentOnTypeFormattingOptions, FoldingRangeProviderCapability, GenericCapability,
ImplementationProviderCapability, RenameOptions, RenameProviderCapability, ServerCapabilities,
SignatureHelpOptions, TextDocumentSyncCapability, TextDocumentSyncKind,
TextDocumentSyncOptions, TypeDefinitionProviderCapability,
};
@ -44,9 +44,7 @@ pub fn server_capabilities() -> ServerCapabilities {
prepare_provider: Some(true),
})),
color_provider: None,
execute_command_provider: Some(ExecuteCommandOptions {
commands: vec!["apply_code_action".to_string()],
}),
execute_command_provider: None,
workspace: None,
}
}

View file

@ -431,6 +431,12 @@ fn on_notification(
}
Err(not) => not,
};
let not = match not.cast::<req::DidChangeConfiguration>() {
Ok(_params) => {
return Ok(());
}
Err(not) => not,
};
log::error!("unhandled notification: {:?}", not);
Ok(())
}

View file

@ -5,10 +5,11 @@ use url_serde;
pub use lsp_types::{
notification::*, request::*, ApplyWorkspaceEditParams, CodeActionParams, CodeLens,
CodeLensParams, CompletionParams, CompletionResponse, DocumentOnTypeFormattingParams,
DocumentSymbolParams, DocumentSymbolResponse, ExecuteCommandParams, Hover, InitializeResult,
MessageType, PublishDiagnosticsParams, ReferenceParams, ShowMessageParams, SignatureHelp,
TextDocumentEdit, TextDocumentPositionParams, TextEdit, WorkspaceEdit, WorkspaceSymbolParams,
CodeLensParams, CompletionParams, CompletionResponse, DidChangeConfigurationParams,
DocumentOnTypeFormattingParams, DocumentSymbolParams, DocumentSymbolResponse, Hover,
InitializeResult, MessageType, PublishDiagnosticsParams, ReferenceParams, ShowMessageParams,
SignatureHelp, TextDocumentEdit, TextDocumentPositionParams, TextEdit, WorkspaceEdit,
WorkspaceSymbolParams,
};
pub enum AnalyzerStatus {}

View file

@ -16,8 +16,6 @@ This list documents LSP features, supported by rust-analyzer.
- [ ] [workspace/configuration](https://microsoft.github.io/language-server-protocol/specification#workspace_configuration)
- [x] [workspace/didChangeWatchedFiles](https://microsoft.github.io/language-server-protocol/specification#workspace_didChangeWatchedFiles)
- [x] [workspace/symbol](https://microsoft.github.io/language-server-protocol/specification#workspace_symbol)
- [x] [workspace/executeCommand](https://microsoft.github.io/language-server-protocol/specification#workspace_executeCommand)
- `apply_code_action`
- [ ] [workspace/applyEdit](https://microsoft.github.io/language-server-protocol/specification#workspace_applyEdit)
## Text Synchronization