diff options
author | Veetaha <[email protected]> | 2020-02-24 23:43:52 +0000 |
---|---|---|
committer | Veetaha <[email protected]> | 2020-02-24 23:43:52 +0000 |
commit | 18b97d9d367d5fc1533c48157ebca7bb18b62e3c (patch) | |
tree | f6218ef4a8def297d1da81cd2f3024276cbbe68f /editors | |
parent | 72e81dae71b8d2efbc418cba206b1988727766b7 (diff) |
vscode: migrate rust-analyzer-api to import * as lc as per matklad and kjeremy
Diffstat (limited to 'editors')
-rw-r--r-- | editors/code/src/rust-analyzer-api.ts | 46 |
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 | ||
5 | import { RequestType, TextDocumentIdentifier, Position, Range, TextDocumentPositionParams, Location, NotificationType, WorkspaceEdit } from "vscode-languageclient"; | 5 | import * as lc from "vscode-languageclient"; |
6 | 6 | ||
7 | type Option<T> = null | T; | 7 | type Option<T> = null | T; |
8 | type Vec<T> = T[]; | 8 | type Vec<T> = T[]; |
9 | type FxHashMap<K extends PropertyKey, V> = Record<K, V>; | 9 | type FxHashMap<K extends PropertyKey, V> = Record<K, V>; |
10 | 10 | ||
11 | function request<TParams, TResult>(method: string) { | 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 | function notification<TParam>(method: string) { | 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 | export interface SyntaxTreeParams { | 25 | export interface SyntaxTreeParams { |
26 | textDocument: TextDocumentIdentifier; | 26 | textDocument: lc.TextDocumentIdentifier; |
27 | range: Option<Range>; | 27 | range: Option<lc.Range>; |
28 | } | 28 | } |
29 | export const syntaxTree = request<SyntaxTreeParams, string>("syntaxTree"); | 29 | export const syntaxTree = request<SyntaxTreeParams, string>("syntaxTree"); |
30 | 30 | ||
31 | 31 | ||
32 | export interface ExpandMacroParams { | 32 | export interface ExpandMacroParams { |
33 | textDocument: TextDocumentIdentifier; | 33 | textDocument: lc.TextDocumentIdentifier; |
34 | position: Option<Position>; | 34 | position: Option<lc.Position>; |
35 | } | 35 | } |
36 | export interface ExpandedMacro { | 36 | export interface ExpandedMacro { |
37 | name: string; | 37 | name: string; |
@@ -41,10 +41,10 @@ export const expandMacro = request<ExpandMacroParams, Option<ExpandedMacro>>("ex | |||
41 | 41 | ||
42 | 42 | ||
43 | export interface FindMatchingBraceParams { | 43 | export interface FindMatchingBraceParams { |
44 | textDocument: TextDocumentIdentifier; | 44 | textDocument: lc.TextDocumentIdentifier; |
45 | offsets: Vec<Position>; | 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 | export interface PublishDecorationsParams { | 50 | export interface PublishDecorationsParams { |
@@ -52,31 +52,31 @@ export interface PublishDecorationsParams { | |||
52 | decorations: Vec<Decoration>; | 52 | decorations: Vec<Decoration>; |
53 | } | 53 | } |
54 | export interface Decoration { | 54 | export 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 | } |
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 | export interface JoinLinesParams { | 65 | export interface JoinLinesParams { |
66 | textDocument: TextDocumentIdentifier; | 66 | textDocument: lc.TextDocumentIdentifier; |
67 | range: Range; | 67 | range: lc.Range; |
68 | } | 68 | } |
69 | export const joinLines = request<JoinLinesParams, SourceChange>("joinLines"); | 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 | export interface RunnablesParams { | 74 | export interface RunnablesParams { |
75 | textDocument: TextDocumentIdentifier; | 75 | textDocument: lc.TextDocumentIdentifier; |
76 | position: Option<Position>; | 76 | position: Option<lc.Position>; |
77 | } | 77 | } |
78 | export interface Runnable { | 78 | export 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 | } |
93 | export interface InlayHint { | 93 | export interface InlayHint { |
94 | range: Range; | 94 | range: lc.Range; |
95 | kind: InlayKind; | 95 | kind: InlayKind; |
96 | label: string; | 96 | label: string; |
97 | } | 97 | } |
98 | export interface InlayHintsParams { | 98 | export interface InlayHintsParams { |
99 | textDocument: TextDocumentIdentifier; | 99 | textDocument: lc.TextDocumentIdentifier; |
100 | } | 100 | } |
101 | export const inlayHints = request<InlayHintsParams, Vec<InlayHint>>("inlayHints"); | 101 | export const inlayHints = request<InlayHintsParams, Vec<InlayHint>>("inlayHints"); |
102 | 102 | ||
@@ -112,6 +112,6 @@ export const publishDecorations = notification<PublishDecorationsParams>("publis | |||
112 | 112 | ||
113 | export interface SourceChange { | 113 | export 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 | } |