aboutsummaryrefslogtreecommitdiff
path: root/editors/code
diff options
context:
space:
mode:
Diffstat (limited to 'editors/code')
-rw-r--r--editors/code/src/rust-analyzer-api.ts46
1 files changed, 23 insertions, 23 deletions
diff --git a/editors/code/src/rust-analyzer-api.ts b/editors/code/src/rust-analyzer-api.ts
index d2738fef3..c5a010e94 100644
--- a/editors/code/src/rust-analyzer-api.ts
+++ b/editors/code/src/rust-analyzer-api.ts
@@ -2,17 +2,17 @@
2 * This file mirrors `crates/rust-analyzer/src/req.rs` declarations. 2 * This file mirrors `crates/rust-analyzer/src/req.rs` declarations.
3 */ 3 */
4 4
5import { RequestType, TextDocumentIdentifier, Position, Range, TextDocumentPositionParams, Location, NotificationType, WorkspaceEdit } from "vscode-languageclient"; 5import * as lc from "vscode-languageclient";
6 6
7type Option<T> = null | T; 7type Option<T> = null | T;
8type Vec<T> = T[]; 8type Vec<T> = T[];
9type FxHashMap<K extends PropertyKey, V> = Record<K, V>; 9type FxHashMap<K extends PropertyKey, V> = Record<K, V>;
10 10
11function request<TParams, TResult>(method: string) { 11function 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}
14function notification<TParam>(method: string) { 14function 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
25export interface SyntaxTreeParams { 25export interface SyntaxTreeParams {
26 textDocument: TextDocumentIdentifier; 26 textDocument: lc.TextDocumentIdentifier;
27 range: Option<Range>; 27 range: Option<lc.Range>;
28} 28}
29export const syntaxTree = request<SyntaxTreeParams, string>("syntaxTree"); 29export const syntaxTree = request<SyntaxTreeParams, string>("syntaxTree");
30 30
31 31
32export interface ExpandMacroParams { 32export interface ExpandMacroParams {
33 textDocument: TextDocumentIdentifier; 33 textDocument: lc.TextDocumentIdentifier;
34 position: Option<Position>; 34 position: Option<lc.Position>;
35} 35}
36export interface ExpandedMacro { 36export interface ExpandedMacro {
37 name: string; 37 name: string;
@@ -41,10 +41,10 @@ export const expandMacro = request<ExpandMacroParams, Option<ExpandedMacro>>("ex
41 41
42 42
43export interface FindMatchingBraceParams { 43export interface FindMatchingBraceParams {
44 textDocument: TextDocumentIdentifier; 44 textDocument: lc.TextDocumentIdentifier;
45 offsets: Vec<Position>; 45 offsets: Vec<lc.Position>;
46} 46}
47export const findMatchingBrace = request<FindMatchingBraceParams, Vec<Position>>("findMatchingBrace"); 47export const findMatchingBrace = request<FindMatchingBraceParams, Vec<lc.Position>>("findMatchingBrace");
48 48
49 49
50export interface PublishDecorationsParams { 50export interface PublishDecorationsParams {
@@ -52,31 +52,31 @@ export interface PublishDecorationsParams {
52 decorations: Vec<Decoration>; 52 decorations: Vec<Decoration>;
53} 53}
54export interface Decoration { 54export interface Decoration {
55 range: Range; 55 range: lc.Range;
56 tag: string; 56 tag: string;
57 bindingHash: Option<string>; 57 bindingHash: Option<string>;
58} 58}
59export const decorationsRequest = request<TextDocumentIdentifier, Vec<Decoration>>("decorationsRequest"); 59export const decorationsRequest = request<lc.TextDocumentIdentifier, Vec<Decoration>>("decorationsRequest");
60 60
61 61
62export const parentModule = request<TextDocumentPositionParams, Vec<Location>>("parentModule"); 62export const parentModule = request<lc.TextDocumentPositionParams, Vec<lc.Location>>("parentModule");
63 63
64 64
65export interface JoinLinesParams { 65export interface JoinLinesParams {
66 textDocument: TextDocumentIdentifier; 66 textDocument: lc.TextDocumentIdentifier;
67 range: Range; 67 range: lc.Range;
68} 68}
69export const joinLines = request<JoinLinesParams, SourceChange>("joinLines"); 69export const joinLines = request<JoinLinesParams, SourceChange>("joinLines");
70 70
71 71
72export const onEnter = request<TextDocumentPositionParams, Option<SourceChange>>("onEnter"); 72export const onEnter = request<lc.TextDocumentPositionParams, Option<SourceChange>>("onEnter");
73 73
74export interface RunnablesParams { 74export interface RunnablesParams {
75 textDocument: TextDocumentIdentifier; 75 textDocument: lc.TextDocumentIdentifier;
76 position: Option<Position>; 76 position: Option<lc.Position>;
77} 77}
78export interface Runnable { 78export interface Runnable {
79 range: Range; 79 range: lc.Range;
80 label: string; 80 label: string;
81 bin: string; 81 bin: string;
82 args: Vec<string>; 82 args: Vec<string>;
@@ -91,12 +91,12 @@ export const enum InlayKind {
91 ParameterHint = "ParameterHint", 91 ParameterHint = "ParameterHint",
92} 92}
93export interface InlayHint { 93export interface InlayHint {
94 range: Range; 94 range: lc.Range;
95 kind: InlayKind; 95 kind: InlayKind;
96 label: string; 96 label: string;
97} 97}
98export interface InlayHintsParams { 98export interface InlayHintsParams {
99 textDocument: TextDocumentIdentifier; 99 textDocument: lc.TextDocumentIdentifier;
100} 100}
101export const inlayHints = request<InlayHintsParams, Vec<InlayHint>>("inlayHints"); 101export const inlayHints = request<InlayHintsParams, Vec<InlayHint>>("inlayHints");
102 102
@@ -112,6 +112,6 @@ export const publishDecorations = notification<PublishDecorationsParams>("publis
112 112
113export interface SourceChange { 113export interface SourceChange {
114 label: string; 114 label: string;
115 workspaceEdit: WorkspaceEdit; 115 workspaceEdit: lc.WorkspaceEdit;
116 cursorPosition: Option<TextDocumentPositionParams>; 116 cursorPosition: Option<lc.TextDocumentPositionParams>;
117} 117}