Advertise support for all the builtin CodeActionKinds

Even thought we don't return all of these we eventually will so might as
well advertise now.
This commit is contained in:
kjeremy 2020-04-26 18:57:33 -04:00
parent e3ee61f5e8
commit e75565c73f

View file

@ -3,13 +3,13 @@
use crate::semantic_tokens; use crate::semantic_tokens;
use lsp_types::{ use lsp_types::{
CallHierarchyServerCapability, CodeActionProviderCapability, CodeLensOptions, CallHierarchyServerCapability, CodeActionOptions, CodeActionProviderCapability,
CompletionOptions, DocumentOnTypeFormattingOptions, FoldingRangeProviderCapability, CodeLensOptions, CompletionOptions, DocumentOnTypeFormattingOptions,
ImplementationProviderCapability, RenameOptions, RenameProviderCapability, SaveOptions, FoldingRangeProviderCapability, ImplementationProviderCapability, RenameOptions,
SelectionRangeProviderCapability, SemanticTokensDocumentProvider, SemanticTokensLegend, RenameProviderCapability, SaveOptions, SelectionRangeProviderCapability,
SemanticTokensOptions, ServerCapabilities, SignatureHelpOptions, TextDocumentSyncCapability, SemanticTokensDocumentProvider, SemanticTokensLegend, SemanticTokensOptions,
TextDocumentSyncKind, TextDocumentSyncOptions, TypeDefinitionProviderCapability, ServerCapabilities, SignatureHelpOptions, TextDocumentSyncCapability, TextDocumentSyncKind,
WorkDoneProgressOptions, TextDocumentSyncOptions, TypeDefinitionProviderCapability, WorkDoneProgressOptions,
}; };
pub fn server_capabilities() -> ServerCapabilities { pub fn server_capabilities() -> ServerCapabilities {
@ -40,7 +40,19 @@ pub fn server_capabilities() -> ServerCapabilities {
document_highlight_provider: Some(true), document_highlight_provider: Some(true),
document_symbol_provider: Some(true), document_symbol_provider: Some(true),
workspace_symbol_provider: Some(true), workspace_symbol_provider: Some(true),
code_action_provider: Some(CodeActionProviderCapability::Simple(true)), code_action_provider: Some(CodeActionProviderCapability::Options(CodeActionOptions {
code_action_kinds: Some(vec![
"".to_string(),
lsp_types::code_action_kind::QUICKFIX.to_string(),
lsp_types::code_action_kind::REFACTOR.to_string(),
lsp_types::code_action_kind::REFACTOR_EXTRACT.to_string(),
lsp_types::code_action_kind::REFACTOR_INLINE.to_string(),
lsp_types::code_action_kind::REFACTOR_REWRITE.to_string(),
lsp_types::code_action_kind::SOURCE.to_string(),
lsp_types::code_action_kind::SOURCE_ORGANIZE_IMPORTS.to_string(),
]),
work_done_progress_options: Default::default(),
})),
code_lens_provider: Some(CodeLensOptions { resolve_provider: Some(true) }), code_lens_provider: Some(CodeLensOptions { resolve_provider: Some(true) }),
document_formatting_provider: Some(true), document_formatting_provider: Some(true),
document_range_formatting_provider: None, document_range_formatting_provider: None,