mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 06:41:48 +00:00
Use SelectionRange from LSP 3.15
This commit is contained in:
parent
6eab968c60
commit
429199d481
4 changed files with 13 additions and 33 deletions
|
@ -2,10 +2,11 @@
|
|||
|
||||
use lsp_types::{
|
||||
CodeActionProviderCapability, CodeLensOptions, CompletionOptions,
|
||||
DocumentOnTypeFormattingOptions, FoldingRangeProviderCapability, GenericCapability,
|
||||
ImplementationProviderCapability, RenameOptions, RenameProviderCapability, ServerCapabilities,
|
||||
SignatureHelpOptions, TextDocumentSyncCapability, TextDocumentSyncKind,
|
||||
TextDocumentSyncOptions, TypeDefinitionProviderCapability, WorkDoneProgressOptions,
|
||||
DocumentOnTypeFormattingOptions, FoldingRangeProviderCapability,
|
||||
ImplementationProviderCapability, RenameOptions, RenameProviderCapability,
|
||||
SelectionRangeProviderCapability, ServerCapabilities, SignatureHelpOptions,
|
||||
TextDocumentSyncCapability, TextDocumentSyncKind, TextDocumentSyncOptions,
|
||||
TypeDefinitionProviderCapability, WorkDoneProgressOptions,
|
||||
};
|
||||
|
||||
pub fn server_capabilities() -> ServerCapabilities {
|
||||
|
@ -44,7 +45,7 @@ pub fn server_capabilities() -> ServerCapabilities {
|
|||
first_trigger_character: "=".to_string(),
|
||||
more_trigger_character: Some(vec![".".to_string(), ">".to_string()]),
|
||||
}),
|
||||
selection_range_provider: Some(GenericCapability::default()),
|
||||
selection_range_provider: Some(SelectionRangeProviderCapability::Simple(true)),
|
||||
folding_range_provider: Some(FoldingRangeProviderCapability::Simple(true)),
|
||||
rename_provider: Some(RenameProviderCapability::Options(RenameOptions {
|
||||
prepare_provider: Some(true),
|
||||
|
|
|
@ -10,8 +10,9 @@ pub use lsp_types::{
|
|||
DidChangeWatchedFilesParams, DidChangeWatchedFilesRegistrationOptions,
|
||||
DocumentOnTypeFormattingParams, DocumentSymbolParams, DocumentSymbolResponse,
|
||||
FileSystemWatcher, Hover, InitializeResult, MessageType, PublishDiagnosticsParams,
|
||||
ReferenceParams, Registration, RegistrationParams, ShowMessageParams, SignatureHelp,
|
||||
TextDocumentEdit, TextDocumentPositionParams, TextEdit, WorkspaceEdit, WorkspaceSymbolParams,
|
||||
ReferenceParams, Registration, RegistrationParams, SelectionRange, SelectionRangeParams,
|
||||
ShowMessageParams, SignatureHelp, TextDocumentEdit, TextDocumentPositionParams, TextEdit,
|
||||
WorkspaceEdit, WorkspaceSymbolParams,
|
||||
};
|
||||
|
||||
pub enum AnalyzerStatus {}
|
||||
|
@ -67,28 +68,6 @@ pub struct ExpandMacroParams {
|
|||
pub position: Option<Position>,
|
||||
}
|
||||
|
||||
pub enum SelectionRangeRequest {}
|
||||
|
||||
impl Request for SelectionRangeRequest {
|
||||
type Params = SelectionRangeParams;
|
||||
type Result = Vec<SelectionRange>;
|
||||
const METHOD: &'static str = "textDocument/selectionRange";
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct SelectionRangeParams {
|
||||
pub text_document: TextDocumentIdentifier,
|
||||
pub positions: Vec<Position>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Debug)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct SelectionRange {
|
||||
pub range: Range,
|
||||
pub parent: Option<Box<SelectionRange>>,
|
||||
}
|
||||
|
||||
pub enum FindMatchingBrace {}
|
||||
|
||||
impl Request for FindMatchingBrace {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue