44
55import * as lc from "vscode-languageclient" ;
66
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+
1032export const analyzerStatus = new lc . RequestType < AnalyzerStatusParams , string , void > (
1133 "rust-analyzer/analyzerStatus"
1234) ;
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"
2339) ;
40+ export const memoryUsage = new lc . RequestType0 < string , void > ( "rust-analyzer/memoryUsage" ) ;
2441export 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+ ) ;
2645export 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" ) ;
3950export const syntaxTree = new lc . RequestType < SyntaxTreeParams , string , void > (
4051 "rust-analyzer/syntaxTree"
4152) ;
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"
4555) ;
46-
4756export const viewFileText = new lc . RequestType < lc . TextDocumentIdentifier , string , void > (
4857 "rust-analyzer/viewFileText"
4958) ;
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+ ) ;
5562export const viewItemTree = new lc . RequestType < ViewItemTreeParams , string , void > (
5663 "rust-analyzer/viewItemTree"
5764) ;
5865
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 } ;
6667
67- export interface ExpandMacroParams {
68+ export type ExpandMacroParams = {
6869 textDocument : lc . TextDocumentIdentifier ;
6970 position : lc . Position ;
70- }
71- export interface ExpandedMacro {
71+ } ;
72+ export type ExpandedMacro = {
7273 name : string ;
7374 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 = {
9478 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 } ;
9983
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+ ) ;
10489export const matchingBrace = new lc . RequestType < MatchingBraceParams , lc . Position [ ] , void > (
10590 "experimental/matchingBrace"
10691) ;
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+ ) ;
108104export const parentModule = new lc . RequestType <
109105 lc . TextDocumentPositionParams ,
110106 lc . LocationLink [ ] | null ,
111107 void
112108> ( "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"
120111) ;
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"
124114) ;
115+ export const ssr = new lc . RequestType < SsrParams , lc . WorkspaceEdit , void > ( "experimental/ssr" ) ;
125116
126- export interface RunnablesParams {
117+ export type JoinLinesParams = {
127118 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 = {
132135 label : string ;
133136 location ?: lc . LocationLink ;
134137 kind : "cargo" ;
@@ -140,50 +143,20 @@ export interface Runnable {
140143 expectTest ?: boolean ;
141144 overrideCargo ?: string ;
142145 } ;
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 = {
173148 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 ;
181159 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