mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +00:00
Support LSP 3.13
This commit is contained in:
parent
f5808b21a4
commit
e293a16d6b
5 changed files with 51 additions and 45 deletions
|
@ -1,5 +1,7 @@
|
|||
use languageserver_types::{
|
||||
ServerCapabilities,
|
||||
CodeActionProviderCapability,
|
||||
FoldingRangeProviderCapability,
|
||||
TextDocumentSyncCapability,
|
||||
TextDocumentSyncOptions,
|
||||
TextDocumentSyncKind,
|
||||
|
@ -32,7 +34,7 @@ pub fn server_capabilities() -> ServerCapabilities {
|
|||
document_highlight_provider: None,
|
||||
document_symbol_provider: Some(true),
|
||||
workspace_symbol_provider: Some(true),
|
||||
code_action_provider: Some(true),
|
||||
code_action_provider: Some(CodeActionProviderCapability::Simple(true)),
|
||||
code_lens_provider: None,
|
||||
document_formatting_provider: None,
|
||||
document_range_formatting_provider: None,
|
||||
|
@ -40,10 +42,12 @@ pub fn server_capabilities() -> ServerCapabilities {
|
|||
first_trigger_character: "=".to_string(),
|
||||
more_trigger_character: None,
|
||||
}),
|
||||
folding_range_provider: Some(FoldingRangeProviderCapability::Simple(true)),
|
||||
rename_provider: None,
|
||||
color_provider: None,
|
||||
execute_command_provider: Some(ExecuteCommandOptions {
|
||||
commands: vec!["apply_code_action".to_string()],
|
||||
}),
|
||||
workspace: None,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ use std::collections::HashMap;
|
|||
|
||||
use languageserver_types::{
|
||||
Diagnostic, DiagnosticSeverity, DocumentSymbol,
|
||||
Command, TextDocumentIdentifier,
|
||||
CodeActionResponse, Command, TextDocumentIdentifier,
|
||||
SymbolInformation, Position, Location, TextEdit,
|
||||
CompletionItem, InsertTextFormat, CompletionItemKind,
|
||||
};
|
||||
|
@ -369,7 +369,7 @@ pub fn handle_code_action(
|
|||
world: ServerWorld,
|
||||
params: req::CodeActionParams,
|
||||
_token: JobToken,
|
||||
) -> Result<Option<Vec<Command>>> {
|
||||
) -> Result<Option<CodeActionResponse>> {
|
||||
let file_id = params.text_document.try_conv_with(&world)?;
|
||||
let line_index = world.analysis().file_line_index(file_id);
|
||||
let range = params.range.conv_with(&line_index);
|
||||
|
@ -392,7 +392,7 @@ pub fn handle_code_action(
|
|||
res.push(cmd);
|
||||
}
|
||||
|
||||
Ok(Some(res))
|
||||
Ok(Some(CodeActionResponse::Commands(res)))
|
||||
}
|
||||
|
||||
pub fn publish_diagnostics(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue