@@ -108,6 +108,9 @@ macro_rules! lsp_request {
108
108
( "textDocument/typeDefinition" ) => {
109
109
$crate:: request:: GotoTypeDefinition
110
110
} ;
111
+ ( "textDocument/selectionRange" ) => {
112
+ $crate:: request:: SelectionRangeRequest
113
+ }
111
114
( "workspace/workspaceFolders" ) => {
112
115
$crate:: request:: WorkspaceFoldersRequest
113
116
} ;
@@ -561,6 +564,22 @@ impl Request for WorkspaceFoldersRequest {
561
564
const METHOD : & ' static str = "workspace/workspaceFolders" ;
562
565
}
563
566
567
+ ///The selection range request is sent from the client to the server to return
568
+ ///suggested selection ranges at given positions. A selection range is a range
569
+ ///around the cursor position which the user might be interested in selecting.
570
+ ///Typically, but not necessary, selection ranges correspond to the nodes of the
571
+ ///syntax tree.
572
+ /// Selection ranges should be computed independently for each position. Ranges
573
+ /// for a specific position should form hierarchy: each range has an optional,
574
+ /// strictly larger, parent range.
575
+ pub enum SelectionRangeRequest { }
576
+
577
+ impl Request for SelectionRangeRequest {
578
+ type Params = SelectionRangeParams ;
579
+ type Result = Vec < SelectionRange > ;
580
+ const METHOD : & ' static str = "textDocument/selectionRange" ;
581
+ }
582
+
564
583
#[ cfg( test) ]
565
584
mod test {
566
585
use super :: * ;
@@ -602,6 +621,7 @@ mod test {
602
621
check_macro ! ( "textDocument/documentSymbol" ) ;
603
622
check_macro ! ( "textDocument/codeAction" ) ;
604
623
check_macro ! ( "textDocument/codeLens" ) ;
624
+ check_macro ! ( "textDocument/selectionRange" ) ;
605
625
check_macro ! ( "codeLens/resolve" ) ;
606
626
check_macro ! ( "textDocument/documentLink" ) ;
607
627
check_macro ! ( "documentLink/resolve" ) ;
@@ -619,4 +639,4 @@ mod test {
619
639
check_macro ! ( "textDocument/typeDefinition" ) ;
620
640
check_macro ! ( "workspace/configuration" ) ;
621
641
}
622
- }
642
+ }
0 commit comments