diff options
author | Mikhail Rakhmanov <[email protected]> | 2020-06-03 19:10:54 +0100 |
---|---|---|
committer | Mikhail Rakhmanov <[email protected]> | 2020-06-03 19:10:54 +0100 |
commit | eefa10bc6bff3624ddd0bbb6bc89d8beb4bed186 (patch) | |
tree | 15c38c2993c52f4065d338090ca9185cc1fcd3da /editors/code/src/lsp_ext.ts | |
parent | a9d567584857b1be4ca8eaa5ef2c7d85f7b2845e (diff) | |
parent | 794f6da821c5d6e2490b996baffe162e4753262d (diff) |
Merge branch 'master' into assists_extract_enum
Diffstat (limited to 'editors/code/src/lsp_ext.ts')
-rw-r--r-- | editors/code/src/lsp_ext.ts | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/editors/code/src/lsp_ext.ts b/editors/code/src/lsp_ext.ts new file mode 100644 index 000000000..c51acfccb --- /dev/null +++ b/editors/code/src/lsp_ext.ts | |||
@@ -0,0 +1,86 @@ | |||
1 | /** | ||
2 | * This file mirrors `crates/rust-analyzer/src/req.rs` declarations. | ||
3 | */ | ||
4 | |||
5 | import * as lc from "vscode-languageclient"; | ||
6 | |||
7 | export const analyzerStatus = new lc.RequestType<null, string, void>("rust-analyzer/analyzerStatus"); | ||
8 | |||
9 | export const collectGarbage = new lc.RequestType<null, null, void>("rust-analyzer/collectGarbage"); | ||
10 | |||
11 | export interface SyntaxTreeParams { | ||
12 | textDocument: lc.TextDocumentIdentifier; | ||
13 | range: lc.Range | null; | ||
14 | } | ||
15 | export const syntaxTree = new lc.RequestType<SyntaxTreeParams, string, void>("rust-analyzer/syntaxTree"); | ||
16 | |||
17 | |||
18 | export interface ExpandMacroParams { | ||
19 | textDocument: lc.TextDocumentIdentifier; | ||
20 | position: lc.Position; | ||
21 | } | ||
22 | export interface ExpandedMacro { | ||
23 | name: string; | ||
24 | expansion: string; | ||
25 | } | ||
26 | export const expandMacro = new lc.RequestType<ExpandMacroParams, ExpandedMacro | null, void>("rust-analyzer/expandMacro"); | ||
27 | |||
28 | export interface MatchingBraceParams { | ||
29 | textDocument: lc.TextDocumentIdentifier; | ||
30 | positions: lc.Position[]; | ||
31 | } | ||
32 | export const matchingBrace = new lc.RequestType<MatchingBraceParams, lc.Position[], void>("experimental/matchingBrace"); | ||
33 | |||
34 | export const parentModule = new lc.RequestType<lc.TextDocumentPositionParams, lc.LocationLink[], void>("experimental/parentModule"); | ||
35 | |||
36 | export interface JoinLinesParams { | ||
37 | textDocument: lc.TextDocumentIdentifier; | ||
38 | ranges: lc.Range[]; | ||
39 | } | ||
40 | export const joinLines = new lc.RequestType<JoinLinesParams, lc.TextEdit[], void>("experimental/joinLines"); | ||
41 | |||
42 | export const onEnter = new lc.RequestType<lc.TextDocumentPositionParams, lc.TextEdit[], void>("experimental/onEnter"); | ||
43 | |||
44 | export interface RunnablesParams { | ||
45 | textDocument: lc.TextDocumentIdentifier; | ||
46 | position: lc.Position | null; | ||
47 | } | ||
48 | |||
49 | export interface Runnable { | ||
50 | label: string; | ||
51 | location?: lc.LocationLink; | ||
52 | kind: "cargo"; | ||
53 | args: { | ||
54 | workspaceRoot?: string; | ||
55 | cargoArgs: string[]; | ||
56 | executableArgs: string[]; | ||
57 | }; | ||
58 | } | ||
59 | export const runnables = new lc.RequestType<RunnablesParams, Runnable[], void>("experimental/runnables"); | ||
60 | |||
61 | export type InlayHint = InlayHint.TypeHint | InlayHint.ParamHint | InlayHint.ChainingHint; | ||
62 | |||
63 | export namespace InlayHint { | ||
64 | export const enum Kind { | ||
65 | TypeHint = "TypeHint", | ||
66 | ParamHint = "ParameterHint", | ||
67 | ChainingHint = "ChainingHint", | ||
68 | } | ||
69 | interface Common { | ||
70 | range: lc.Range; | ||
71 | label: string; | ||
72 | } | ||
73 | export type TypeHint = Common & { kind: Kind.TypeHint }; | ||
74 | export type ParamHint = Common & { kind: Kind.ParamHint }; | ||
75 | export type ChainingHint = Common & { kind: Kind.ChainingHint }; | ||
76 | } | ||
77 | export interface InlayHintsParams { | ||
78 | textDocument: lc.TextDocumentIdentifier; | ||
79 | } | ||
80 | export const inlayHints = new lc.RequestType<InlayHintsParams, InlayHint[], void>("rust-analyzer/inlayHints"); | ||
81 | |||
82 | export interface SsrParams { | ||
83 | query: string; | ||
84 | parseOnly: boolean; | ||
85 | } | ||
86 | export const ssr = new lc.RequestType<SsrParams, lc.WorkspaceEdit, void>('experimental/ssr'); | ||