diff options
Diffstat (limited to 'crates/ra_lsp_server/src/req.rs')
-rw-r--r-- | crates/ra_lsp_server/src/req.rs | 221 |
1 files changed, 0 insertions, 221 deletions
diff --git a/crates/ra_lsp_server/src/req.rs b/crates/ra_lsp_server/src/req.rs deleted file mode 100644 index 7ff7f60b3..000000000 --- a/crates/ra_lsp_server/src/req.rs +++ /dev/null | |||
@@ -1,221 +0,0 @@ | |||
1 | //! Defines `rust-analyzer` specific custom messages. | ||
2 | |||
3 | use lsp_types::{Location, Position, Range, TextDocumentIdentifier, Url}; | ||
4 | use rustc_hash::FxHashMap; | ||
5 | use serde::{Deserialize, Serialize}; | ||
6 | |||
7 | pub use lsp_types::{ | ||
8 | notification::*, request::*, ApplyWorkspaceEditParams, CodeActionParams, CodeLens, | ||
9 | CodeLensParams, CompletionParams, CompletionResponse, DiagnosticTag, | ||
10 | DidChangeConfigurationParams, DidChangeWatchedFilesParams, | ||
11 | DidChangeWatchedFilesRegistrationOptions, DocumentOnTypeFormattingParams, DocumentSymbolParams, | ||
12 | DocumentSymbolResponse, FileSystemWatcher, Hover, InitializeResult, MessageType, | ||
13 | PartialResultParams, ProgressParams, ProgressParamsValue, ProgressToken, | ||
14 | PublishDiagnosticsParams, ReferenceParams, Registration, RegistrationParams, SelectionRange, | ||
15 | SelectionRangeParams, ServerCapabilities, ShowMessageParams, SignatureHelp, SymbolKind, | ||
16 | TextDocumentEdit, TextDocumentPositionParams, TextEdit, WorkDoneProgressParams, WorkspaceEdit, | ||
17 | WorkspaceSymbolParams, | ||
18 | }; | ||
19 | |||
20 | pub enum AnalyzerStatus {} | ||
21 | |||
22 | impl Request for AnalyzerStatus { | ||
23 | type Params = (); | ||
24 | type Result = String; | ||
25 | const METHOD: &'static str = "rust-analyzer/analyzerStatus"; | ||
26 | } | ||
27 | |||
28 | pub enum CollectGarbage {} | ||
29 | |||
30 | impl Request for CollectGarbage { | ||
31 | type Params = (); | ||
32 | type Result = (); | ||
33 | const METHOD: &'static str = "rust-analyzer/collectGarbage"; | ||
34 | } | ||
35 | |||
36 | pub enum SyntaxTree {} | ||
37 | |||
38 | impl Request for SyntaxTree { | ||
39 | type Params = SyntaxTreeParams; | ||
40 | type Result = String; | ||
41 | const METHOD: &'static str = "rust-analyzer/syntaxTree"; | ||
42 | } | ||
43 | |||
44 | #[derive(Deserialize, Debug)] | ||
45 | #[serde(rename_all = "camelCase")] | ||
46 | pub struct SyntaxTreeParams { | ||
47 | pub text_document: TextDocumentIdentifier, | ||
48 | pub range: Option<Range>, | ||
49 | } | ||
50 | |||
51 | #[derive(Serialize, Debug)] | ||
52 | #[serde(rename_all = "camelCase")] | ||
53 | pub struct ExpandedMacro { | ||
54 | pub name: String, | ||
55 | pub expansion: String, | ||
56 | } | ||
57 | |||
58 | pub enum ExpandMacro {} | ||
59 | |||
60 | impl Request for ExpandMacro { | ||
61 | type Params = ExpandMacroParams; | ||
62 | type Result = Option<ExpandedMacro>; | ||
63 | const METHOD: &'static str = "rust-analyzer/expandMacro"; | ||
64 | } | ||
65 | |||
66 | #[derive(Deserialize, Debug)] | ||
67 | #[serde(rename_all = "camelCase")] | ||
68 | pub struct ExpandMacroParams { | ||
69 | pub text_document: TextDocumentIdentifier, | ||
70 | pub position: Option<Position>, | ||
71 | } | ||
72 | |||
73 | pub enum FindMatchingBrace {} | ||
74 | |||
75 | impl Request for FindMatchingBrace { | ||
76 | type Params = FindMatchingBraceParams; | ||
77 | type Result = Vec<Position>; | ||
78 | const METHOD: &'static str = "rust-analyzer/findMatchingBrace"; | ||
79 | } | ||
80 | |||
81 | #[derive(Deserialize, Debug)] | ||
82 | #[serde(rename_all = "camelCase")] | ||
83 | pub struct FindMatchingBraceParams { | ||
84 | pub text_document: TextDocumentIdentifier, | ||
85 | pub offsets: Vec<Position>, | ||
86 | } | ||
87 | |||
88 | pub enum DecorationsRequest {} | ||
89 | |||
90 | impl Request for DecorationsRequest { | ||
91 | type Params = TextDocumentIdentifier; | ||
92 | type Result = Vec<Decoration>; | ||
93 | const METHOD: &'static str = "rust-analyzer/decorationsRequest"; | ||
94 | } | ||
95 | |||
96 | pub enum PublishDecorations {} | ||
97 | |||
98 | impl Notification for PublishDecorations { | ||
99 | type Params = PublishDecorationsParams; | ||
100 | const METHOD: &'static str = "rust-analyzer/publishDecorations"; | ||
101 | } | ||
102 | |||
103 | #[derive(Serialize, Debug)] | ||
104 | #[serde(rename_all = "camelCase")] | ||
105 | pub struct PublishDecorationsParams { | ||
106 | pub uri: Url, | ||
107 | pub decorations: Vec<Decoration>, | ||
108 | } | ||
109 | |||
110 | #[derive(Serialize, Debug)] | ||
111 | #[serde(rename_all = "camelCase")] | ||
112 | pub struct Decoration { | ||
113 | pub range: Range, | ||
114 | pub tag: &'static str, | ||
115 | pub binding_hash: Option<String>, | ||
116 | } | ||
117 | |||
118 | pub enum ParentModule {} | ||
119 | |||
120 | impl Request for ParentModule { | ||
121 | type Params = TextDocumentPositionParams; | ||
122 | type Result = Vec<Location>; | ||
123 | const METHOD: &'static str = "rust-analyzer/parentModule"; | ||
124 | } | ||
125 | |||
126 | pub enum JoinLines {} | ||
127 | |||
128 | impl Request for JoinLines { | ||
129 | type Params = JoinLinesParams; | ||
130 | type Result = SourceChange; | ||
131 | const METHOD: &'static str = "rust-analyzer/joinLines"; | ||
132 | } | ||
133 | |||
134 | #[derive(Deserialize, Debug)] | ||
135 | #[serde(rename_all = "camelCase")] | ||
136 | pub struct JoinLinesParams { | ||
137 | pub text_document: TextDocumentIdentifier, | ||
138 | pub range: Range, | ||
139 | } | ||
140 | |||
141 | pub enum OnEnter {} | ||
142 | |||
143 | impl Request for OnEnter { | ||
144 | type Params = TextDocumentPositionParams; | ||
145 | type Result = Option<SourceChange>; | ||
146 | const METHOD: &'static str = "rust-analyzer/onEnter"; | ||
147 | } | ||
148 | |||
149 | pub enum Runnables {} | ||
150 | |||
151 | impl Request for Runnables { | ||
152 | type Params = RunnablesParams; | ||
153 | type Result = Vec<Runnable>; | ||
154 | const METHOD: &'static str = "rust-analyzer/runnables"; | ||
155 | } | ||
156 | |||
157 | #[derive(Serialize, Deserialize, Debug)] | ||
158 | #[serde(rename_all = "camelCase")] | ||
159 | pub struct RunnablesParams { | ||
160 | pub text_document: TextDocumentIdentifier, | ||
161 | pub position: Option<Position>, | ||
162 | } | ||
163 | |||
164 | #[derive(Serialize, Debug)] | ||
165 | #[serde(rename_all = "camelCase")] | ||
166 | pub struct Runnable { | ||
167 | pub range: Range, | ||
168 | pub label: String, | ||
169 | pub bin: String, | ||
170 | pub args: Vec<String>, | ||
171 | pub env: FxHashMap<String, String>, | ||
172 | pub cwd: Option<String>, | ||
173 | } | ||
174 | |||
175 | #[derive(Serialize, Debug)] | ||
176 | #[serde(rename_all = "camelCase")] | ||
177 | pub struct SourceChange { | ||
178 | pub label: String, | ||
179 | pub workspace_edit: WorkspaceEdit, | ||
180 | pub cursor_position: Option<TextDocumentPositionParams>, | ||
181 | } | ||
182 | |||
183 | pub enum InlayHints {} | ||
184 | |||
185 | impl Request for InlayHints { | ||
186 | type Params = InlayHintsParams; | ||
187 | type Result = Vec<InlayHint>; | ||
188 | const METHOD: &'static str = "rust-analyzer/inlayHints"; | ||
189 | } | ||
190 | |||
191 | #[derive(Serialize, Deserialize, Debug)] | ||
192 | #[serde(rename_all = "camelCase")] | ||
193 | pub struct InlayHintsParams { | ||
194 | pub text_document: TextDocumentIdentifier, | ||
195 | } | ||
196 | |||
197 | #[derive(Debug, PartialEq, Eq, Deserialize, Serialize)] | ||
198 | pub enum InlayKind { | ||
199 | TypeHint, | ||
200 | ParameterHint, | ||
201 | } | ||
202 | |||
203 | #[derive(Debug, Deserialize, Serialize)] | ||
204 | pub struct InlayHint { | ||
205 | pub range: Range, | ||
206 | pub kind: InlayKind, | ||
207 | pub label: String, | ||
208 | } | ||
209 | |||
210 | pub enum Ssr {} | ||
211 | |||
212 | impl Request for Ssr { | ||
213 | type Params = SsrParams; | ||
214 | type Result = SourceChange; | ||
215 | const METHOD: &'static str = "rust-analyzer/ssr"; | ||
216 | } | ||
217 | |||
218 | #[derive(Debug, Deserialize, Serialize)] | ||
219 | pub struct SsrParams { | ||
220 | pub arg: String, | ||
221 | } | ||