4
4
5
5
import * as lc from "vscode-languageclient" ;
6
6
7
- export interface AnalyzerStatusParams {
8
- textDocument ?: lc . TextDocumentIdentifier ;
9
- }
7
+ // rust-analyzer overrides
8
+
9
+ export const hover = new lc . RequestType <
10
+ HoverParams ,
11
+ ( lc . Hover & { actions : CommandLinkGroup [ ] } ) | null ,
12
+ void
13
+ > ( "textDocument/hover" ) ;
14
+ export type HoverParams = { position : lc . Position | lc . Range } & Omit <
15
+ lc . TextDocumentPositionParams ,
16
+ "position"
17
+ > &
18
+ lc . WorkDoneProgressParams ;
19
+ export type CommandLink = {
20
+ /**
21
+ * A tooltip for the command, when represented in the UI.
22
+ */
23
+ tooltip ?: string ;
24
+ } & lc . Command ;
25
+ export type CommandLinkGroup = {
26
+ title ?: string ;
27
+ commands : CommandLink [ ] ;
28
+ } ;
29
+
30
+ // rust-analyzer extensions
31
+
10
32
export const analyzerStatus = new lc . RequestType < AnalyzerStatusParams , string , void > (
11
33
"rust-analyzer/analyzerStatus"
12
34
) ;
13
- export const memoryUsage = new lc . RequestType0 < string , void > ( "rust-analyzer/memoryUsage" ) ;
14
- export const shuffleCrateGraph = new lc . RequestType0 < null , void > ( "rust-analyzer/shuffleCrateGraph" ) ;
15
-
16
- export interface ServerStatusParams {
17
- health : "ok" | "warning" | "error" ;
18
- quiescent : boolean ;
19
- message ?: string ;
20
- }
21
- export const serverStatus = new lc . NotificationType < ServerStatusParams > (
22
- "experimental/serverStatus"
35
+ export const cancelFlycheck = new lc . NotificationType0 ( "rust-analyzer/cancelFlycheck" ) ;
36
+ export const clearFlycheck = new lc . NotificationType0 ( "rust-analyzer/clearFlycheck" ) ;
37
+ export const expandMacro = new lc . RequestType < ExpandMacroParams , ExpandedMacro | null , void > (
38
+ "rust-analyzer/expandMacro"
23
39
) ;
40
+ export const memoryUsage = new lc . RequestType0 < string , void > ( "rust-analyzer/memoryUsage" ) ;
24
41
export const openServerLogs = new lc . NotificationType0 ( "rust-analyzer/openServerLogs" ) ;
25
-
42
+ export const relatedTests = new lc . RequestType < lc . TextDocumentPositionParams , TestInfo [ ] , void > (
43
+ "rust-analyzer/relatedTests"
44
+ ) ;
26
45
export const reloadWorkspace = new lc . RequestType0 < null , void > ( "rust-analyzer/reloadWorkspace" ) ;
27
-
28
- export const hover = new lc . RequestType < HoverParams , lc . Hover | null , void > ( "textDocument/hover" ) ;
29
-
30
- export interface HoverParams extends lc . WorkDoneProgressParams {
31
- textDocument : lc . TextDocumentIdentifier ;
32
- position : lc . Range | lc . Position ;
33
- }
34
-
35
- export interface SyntaxTreeParams {
36
- textDocument : lc . TextDocumentIdentifier ;
37
- range : lc . Range | null ;
38
- }
46
+ export const runFlycheck = new lc . NotificationType < {
47
+ textDocument : lc . TextDocumentIdentifier | null ;
48
+ } > ( "rust-analyzer/runFlycheck" ) ;
49
+ export const shuffleCrateGraph = new lc . RequestType0 < null , void > ( "rust-analyzer/shuffleCrateGraph" ) ;
39
50
export const syntaxTree = new lc . RequestType < SyntaxTreeParams , string , void > (
40
51
"rust-analyzer/syntaxTree"
41
52
) ;
42
-
43
- export const viewHir = new lc . RequestType < lc . TextDocumentPositionParams , string , void > (
44
- "rust-analyzer/viewHir"
53
+ export const viewCrateGraph = new lc . RequestType < ViewCrateGraphParams , string , void > (
54
+ "rust-analyzer/viewCrateGraph"
45
55
) ;
46
-
47
56
export const viewFileText = new lc . RequestType < lc . TextDocumentIdentifier , string , void > (
48
57
"rust-analyzer/viewFileText"
49
58
) ;
50
-
51
- export interface ViewItemTreeParams {
52
- textDocument : lc . TextDocumentIdentifier ;
53
- }
54
-
59
+ export const viewHir = new lc . RequestType < lc . TextDocumentPositionParams , string , void > (
60
+ "rust-analyzer/viewHir"
61
+ ) ;
55
62
export const viewItemTree = new lc . RequestType < ViewItemTreeParams , string , void > (
56
63
"rust-analyzer/viewItemTree"
57
64
) ;
58
65
59
- export interface ViewCrateGraphParams {
60
- full : boolean ;
61
- }
62
-
63
- export const viewCrateGraph = new lc . RequestType < ViewCrateGraphParams , string , void > (
64
- "rust-analyzer/viewCrateGraph"
65
- ) ;
66
+ export type AnalyzerStatusParams = { textDocument ?: lc . TextDocumentIdentifier } ;
66
67
67
- export interface ExpandMacroParams {
68
+ export type ExpandMacroParams = {
68
69
textDocument : lc . TextDocumentIdentifier ;
69
70
position : lc . Position ;
70
- }
71
- export interface ExpandedMacro {
71
+ } ;
72
+ export type ExpandedMacro = {
72
73
name : string ;
73
74
expansion : string ;
74
- }
75
- export const expandMacro = new lc . RequestType < ExpandMacroParams , ExpandedMacro | null , void > (
76
- "rust-analyzer/expandMacro"
77
- ) ;
78
-
79
- export const relatedTests = new lc . RequestType < lc . TextDocumentPositionParams , TestInfo [ ] , void > (
80
- "rust-analyzer/relatedTests"
81
- ) ;
82
-
83
- export const cancelFlycheck = new lc . NotificationType0 ( "rust-analyzer/cancelFlycheck" ) ;
84
- export const clearFlycheck = new lc . NotificationType0 ( "rust-analyzer/clearFlycheck" ) ;
85
- export const runFlycheck = new lc . NotificationType < {
86
- textDocument : lc . TextDocumentIdentifier | null ;
87
- } > ( "rust-analyzer/runFlycheck" ) ;
88
-
89
- // Experimental extensions
90
-
91
- export interface SsrParams {
92
- query : string ;
93
- parseOnly : boolean ;
75
+ } ;
76
+ export type TestInfo = { runnable : Runnable } ;
77
+ export type SyntaxTreeParams = {
94
78
textDocument : lc . TextDocumentIdentifier ;
95
- position : lc . Position ;
96
- selections : readonly lc . Range [ ] ;
97
- }
98
- export const ssr = new lc . RequestType < SsrParams , lc . WorkspaceEdit , void > ( "experimental/ssr" ) ;
79
+ range : lc . Range | null ;
80
+ } ;
81
+ export type ViewCrateGraphParams = { full : boolean } ;
82
+ export type ViewItemTreeParams = { textDocument : lc . TextDocumentIdentifier } ;
99
83
100
- export interface MatchingBraceParams {
101
- textDocument : lc . TextDocumentIdentifier ;
102
- positions : lc . Position [ ] ;
103
- }
84
+ // experimental extensions
85
+
86
+ export const joinLines = new lc . RequestType < JoinLinesParams , lc . TextEdit [ ] , void > (
87
+ "experimental/joinLines"
88
+ ) ;
104
89
export const matchingBrace = new lc . RequestType < MatchingBraceParams , lc . Position [ ] , void > (
105
90
"experimental/matchingBrace"
106
91
) ;
107
-
92
+ export const moveItem = new lc . RequestType < MoveItemParams , lc . TextEdit [ ] , void > (
93
+ "experimental/moveItem"
94
+ ) ;
95
+ export const onEnter = new lc . RequestType < lc . TextDocumentPositionParams , lc . TextEdit [ ] , void > (
96
+ "experimental/onEnter"
97
+ ) ;
98
+ export const openCargoToml = new lc . RequestType < OpenCargoTomlParams , lc . Location , void > (
99
+ "experimental/openCargoToml"
100
+ ) ;
101
+ export const openDocs = new lc . RequestType < lc . TextDocumentPositionParams , string | void , void > (
102
+ "experimental/externalDocs"
103
+ ) ;
108
104
export const parentModule = new lc . RequestType <
109
105
lc . TextDocumentPositionParams ,
110
106
lc . LocationLink [ ] | null ,
111
107
void
112
108
> ( "experimental/parentModule" ) ;
113
-
114
- export interface JoinLinesParams {
115
- textDocument : lc . TextDocumentIdentifier ;
116
- ranges : lc . Range [ ] ;
117
- }
118
- export const joinLines = new lc . RequestType < JoinLinesParams , lc . TextEdit [ ] , void > (
119
- "experimental/joinLines"
109
+ export const runnables = new lc . RequestType < RunnablesParams , Runnable [ ] , void > (
110
+ "experimental/runnables"
120
111
) ;
121
-
122
- export const onEnter = new lc . RequestType < lc . TextDocumentPositionParams , lc . TextEdit [ ] , void > (
123
- "experimental/onEnter"
112
+ export const serverStatus = new lc . NotificationType < ServerStatusParams > (
113
+ "experimental/serverStatus"
124
114
) ;
115
+ export const ssr = new lc . RequestType < SsrParams , lc . WorkspaceEdit , void > ( "experimental/ssr" ) ;
125
116
126
- export interface RunnablesParams {
117
+ export type JoinLinesParams = {
127
118
textDocument : lc . TextDocumentIdentifier ;
128
- position : lc . Position | null ;
129
- }
130
-
131
- export interface Runnable {
119
+ ranges : lc . Range [ ] ;
120
+ } ;
121
+ export type MatchingBraceParams = {
122
+ textDocument : lc . TextDocumentIdentifier ;
123
+ positions : lc . Position [ ] ;
124
+ } ;
125
+ export type MoveItemParams = {
126
+ textDocument : lc . TextDocumentIdentifier ;
127
+ range : lc . Range ;
128
+ direction : Direction ;
129
+ } ;
130
+ export type Direction = "Up" | "Down" ;
131
+ export type OpenCargoTomlParams = {
132
+ textDocument : lc . TextDocumentIdentifier ;
133
+ } ;
134
+ export type Runnable = {
132
135
label : string ;
133
136
location ?: lc . LocationLink ;
134
137
kind : "cargo" ;
@@ -140,50 +143,20 @@ export interface Runnable {
140
143
expectTest ?: boolean ;
141
144
overrideCargo ?: string ;
142
145
} ;
143
- }
144
- export const runnables = new lc . RequestType < RunnablesParams , Runnable [ ] , void > (
145
- "experimental/runnables"
146
- ) ;
147
-
148
- export interface TestInfo {
149
- runnable : Runnable ;
150
- }
151
-
152
- export interface CommandLink extends lc . Command {
153
- /**
154
- * A tooltip for the command, when represented in the UI.
155
- */
156
- tooltip ?: string ;
157
- }
158
-
159
- export interface CommandLinkGroup {
160
- title ?: string ;
161
- commands : CommandLink [ ] ;
162
- }
163
-
164
- export const openDocs = new lc . RequestType < lc . TextDocumentPositionParams , string | void , void > (
165
- "experimental/externalDocs"
166
- ) ;
167
-
168
- export const openCargoToml = new lc . RequestType < OpenCargoTomlParams , lc . Location , void > (
169
- "experimental/openCargoToml"
170
- ) ;
171
-
172
- export interface OpenCargoTomlParams {
146
+ } ;
147
+ export type RunnablesParams = {
173
148
textDocument : lc . TextDocumentIdentifier ;
174
- }
175
-
176
- export const moveItem = new lc . RequestType < MoveItemParams , lc . TextEdit [ ] , void > (
177
- "experimental/moveItem"
178
- ) ;
179
-
180
- export interface MoveItemParams {
149
+ position : lc . Position | null ;
150
+ } ;
151
+ export type ServerStatusParams = {
152
+ health : "ok" | "warning" | "error" ;
153
+ quiescent : boolean ;
154
+ message ?: string ;
155
+ } ;
156
+ export type SsrParams = {
157
+ query : string ;
158
+ parseOnly : boolean ;
181
159
textDocument : lc . TextDocumentIdentifier ;
182
- range : lc . Range ;
183
- direction : Direction ;
184
- }
185
-
186
- export const enum Direction {
187
- Up = "Up" ,
188
- Down = "Down" ,
189
- }
160
+ position : lc . Position ;
161
+ selections : readonly lc . Range [ ] ;
162
+ } ;
0 commit comments