aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server/src/req.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_lsp_server/src/req.rs')
-rw-r--r--crates/ra_lsp_server/src/req.rs221
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
3use lsp_types::{Location, Position, Range, TextDocumentIdentifier, Url};
4use rustc_hash::FxHashMap;
5use serde::{Deserialize, Serialize};
6
7pub 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
20pub enum AnalyzerStatus {}
21
22impl Request for AnalyzerStatus {
23 type Params = ();
24 type Result = String;
25 const METHOD: &'static str = "rust-analyzer/analyzerStatus";
26}
27
28pub enum CollectGarbage {}
29
30impl Request for CollectGarbage {
31 type Params = ();
32 type Result = ();
33 const METHOD: &'static str = "rust-analyzer/collectGarbage";
34}
35
36pub enum SyntaxTree {}
37
38impl 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")]
46pub struct SyntaxTreeParams {
47 pub text_document: TextDocumentIdentifier,
48 pub range: Option<Range>,
49}
50
51#[derive(Serialize, Debug)]
52#[serde(rename_all = "camelCase")]
53pub struct ExpandedMacro {
54 pub name: String,
55 pub expansion: String,
56}
57
58pub enum ExpandMacro {}
59
60impl 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")]
68pub struct ExpandMacroParams {
69 pub text_document: TextDocumentIdentifier,
70 pub position: Option<Position>,
71}
72
73pub enum FindMatchingBrace {}
74
75impl 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")]
83pub struct FindMatchingBraceParams {
84 pub text_document: TextDocumentIdentifier,
85 pub offsets: Vec<Position>,
86}
87
88pub enum DecorationsRequest {}
89
90impl Request for DecorationsRequest {
91 type Params = TextDocumentIdentifier;
92 type Result = Vec<Decoration>;
93 const METHOD: &'static str = "rust-analyzer/decorationsRequest";
94}
95
96pub enum PublishDecorations {}
97
98impl 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")]
105pub struct PublishDecorationsParams {
106 pub uri: Url,
107 pub decorations: Vec<Decoration>,
108}
109
110#[derive(Serialize, Debug)]
111#[serde(rename_all = "camelCase")]
112pub struct Decoration {
113 pub range: Range,
114 pub tag: &'static str,
115 pub binding_hash: Option<String>,
116}
117
118pub enum ParentModule {}
119
120impl Request for ParentModule {
121 type Params = TextDocumentPositionParams;
122 type Result = Vec<Location>;
123 const METHOD: &'static str = "rust-analyzer/parentModule";
124}
125
126pub enum JoinLines {}
127
128impl 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")]
136pub struct JoinLinesParams {
137 pub text_document: TextDocumentIdentifier,
138 pub range: Range,
139}
140
141pub enum OnEnter {}
142
143impl Request for OnEnter {
144 type Params = TextDocumentPositionParams;
145 type Result = Option<SourceChange>;
146 const METHOD: &'static str = "rust-analyzer/onEnter";
147}
148
149pub enum Runnables {}
150
151impl 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")]
159pub struct RunnablesParams {
160 pub text_document: TextDocumentIdentifier,
161 pub position: Option<Position>,
162}
163
164#[derive(Serialize, Debug)]
165#[serde(rename_all = "camelCase")]
166pub 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")]
177pub struct SourceChange {
178 pub label: String,
179 pub workspace_edit: WorkspaceEdit,
180 pub cursor_position: Option<TextDocumentPositionParams>,
181}
182
183pub enum InlayHints {}
184
185impl 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")]
193pub struct InlayHintsParams {
194 pub text_document: TextDocumentIdentifier,
195}
196
197#[derive(Debug, PartialEq, Eq, Deserialize, Serialize)]
198pub enum InlayKind {
199 TypeHint,
200 ParameterHint,
201}
202
203#[derive(Debug, Deserialize, Serialize)]
204pub struct InlayHint {
205 pub range: Range,
206 pub kind: InlayKind,
207 pub label: String,
208}
209
210pub enum Ssr {}
211
212impl 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)]
219pub struct SsrParams {
220 pub arg: String,
221}