2
2
* This file mirrors `crates/rust-analyzer/src/req.rs` declarations.
3
3
*/
4
4
5
- import { RequestType , TextDocumentIdentifier , Position , Range , TextDocumentPositionParams , Location , NotificationType , WorkspaceEdit } from "vscode-languageclient" ;
5
+ import * as lc from "vscode-languageclient" ;
6
6
7
7
type Option < T > = null | T ;
8
8
type Vec < T > = T [ ] ;
9
9
type FxHashMap < K extends PropertyKey , V > = Record < K , V > ;
10
10
11
11
function request < TParams , TResult > ( method : string ) {
12
- return new RequestType < TParams , TResult , unknown > ( `rust-analyzer/${ method } ` ) ;
12
+ return new lc . RequestType < TParams , TResult , unknown > ( `rust-analyzer/${ method } ` ) ;
13
13
}
14
14
function notification < TParam > ( method : string ) {
15
- return new NotificationType < TParam > ( method ) ;
15
+ return new lc . NotificationType < TParam > ( method ) ;
16
16
}
17
17
18
18
@@ -23,15 +23,15 @@ export const collectGarbage = request<null, null>("collectGarbage");
23
23
24
24
25
25
export interface SyntaxTreeParams {
26
- textDocument : TextDocumentIdentifier ;
27
- range : Option < Range > ;
26
+ textDocument : lc . TextDocumentIdentifier ;
27
+ range : Option < lc . Range > ;
28
28
}
29
29
export const syntaxTree = request < SyntaxTreeParams , string > ( "syntaxTree" ) ;
30
30
31
31
32
32
export interface ExpandMacroParams {
33
- textDocument : TextDocumentIdentifier ;
34
- position : Option < Position > ;
33
+ textDocument : lc . TextDocumentIdentifier ;
34
+ position : Option < lc . Position > ;
35
35
}
36
36
export interface ExpandedMacro {
37
37
name : string ;
@@ -41,42 +41,42 @@ export const expandMacro = request<ExpandMacroParams, Option<ExpandedMacro>>("ex
41
41
42
42
43
43
export interface FindMatchingBraceParams {
44
- textDocument : TextDocumentIdentifier ;
45
- offsets : Vec < Position > ;
44
+ textDocument : lc . TextDocumentIdentifier ;
45
+ offsets : Vec < lc . Position > ;
46
46
}
47
- export const findMatchingBrace = request < FindMatchingBraceParams , Vec < Position > > ( "findMatchingBrace" ) ;
47
+ export const findMatchingBrace = request < FindMatchingBraceParams , Vec < lc . Position > > ( "findMatchingBrace" ) ;
48
48
49
49
50
50
export interface PublishDecorationsParams {
51
51
uri : string ;
52
52
decorations : Vec < Decoration > ;
53
53
}
54
54
export interface Decoration {
55
- range : Range ;
55
+ range : lc . Range ;
56
56
tag : string ;
57
57
bindingHash : Option < string > ;
58
58
}
59
- export const decorationsRequest = request < TextDocumentIdentifier , Vec < Decoration > > ( "decorationsRequest" ) ;
59
+ export const decorationsRequest = request < lc . TextDocumentIdentifier , Vec < Decoration > > ( "decorationsRequest" ) ;
60
60
61
61
62
- export const parentModule = request < TextDocumentPositionParams , Vec < Location > > ( "parentModule" ) ;
62
+ export const parentModule = request < lc . TextDocumentPositionParams , Vec < lc . Location > > ( "parentModule" ) ;
63
63
64
64
65
65
export interface JoinLinesParams {
66
- textDocument : TextDocumentIdentifier ;
67
- range : Range ;
66
+ textDocument : lc . TextDocumentIdentifier ;
67
+ range : lc . Range ;
68
68
}
69
69
export const joinLines = request < JoinLinesParams , SourceChange > ( "joinLines" ) ;
70
70
71
71
72
- export const onEnter = request < TextDocumentPositionParams , Option < SourceChange > > ( "onEnter" ) ;
72
+ export const onEnter = request < lc . TextDocumentPositionParams , Option < SourceChange > > ( "onEnter" ) ;
73
73
74
74
export interface RunnablesParams {
75
- textDocument : TextDocumentIdentifier ;
76
- position : Option < Position > ;
75
+ textDocument : lc . TextDocumentIdentifier ;
76
+ position : Option < lc . Position > ;
77
77
}
78
78
export interface Runnable {
79
- range : Range ;
79
+ range : lc . Range ;
80
80
label : string ;
81
81
bin : string ;
82
82
args : Vec < string > ;
@@ -91,12 +91,12 @@ export const enum InlayKind {
91
91
ParameterHint = "ParameterHint" ,
92
92
}
93
93
export interface InlayHint {
94
- range : Range ;
94
+ range : lc . Range ;
95
95
kind : InlayKind ;
96
96
label : string ;
97
97
}
98
98
export interface InlayHintsParams {
99
- textDocument : TextDocumentIdentifier ;
99
+ textDocument : lc . TextDocumentIdentifier ;
100
100
}
101
101
export const inlayHints = request < InlayHintsParams , Vec < InlayHint > > ( "inlayHints" ) ;
102
102
@@ -112,6 +112,6 @@ export const publishDecorations = notification<PublishDecorationsParams>("publis
112
112
113
113
export interface SourceChange {
114
114
label : string ;
115
- workspaceEdit : WorkspaceEdit ;
116
- cursorPosition : Option < TextDocumentPositionParams > ;
115
+ workspaceEdit : lc . WorkspaceEdit ;
116
+ cursorPosition : Option < lc . TextDocumentPositionParams > ;
117
117
}
0 commit comments