aboutsummaryrefslogtreecommitdiff
path: root/crates/server/src/req.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/server/src/req.rs')
-rw-r--r--crates/server/src/req.rs176
1 files changed, 0 insertions, 176 deletions
diff --git a/crates/server/src/req.rs b/crates/server/src/req.rs
deleted file mode 100644
index 4af61dbbd..000000000
--- a/crates/server/src/req.rs
+++ /dev/null
@@ -1,176 +0,0 @@
1use std::collections::HashMap;
2use languageserver_types::{TextDocumentIdentifier, Range, Url, Position, Location};
3use url_serde;
4
5pub use languageserver_types::{
6 request::*, notification::*,
7 InitializeResult, PublishDiagnosticsParams,
8 DocumentSymbolParams, DocumentSymbolResponse,
9 CodeActionParams, ApplyWorkspaceEditParams,
10 ExecuteCommandParams,
11 WorkspaceSymbolParams,
12 TextDocumentPositionParams,
13 TextEdit,
14 CompletionParams, CompletionResponse,
15 DocumentOnTypeFormattingParams,
16 TextDocumentEdit,
17};
18
19pub enum SyntaxTree {}
20
21impl Request for SyntaxTree {
22 type Params = SyntaxTreeParams;
23 type Result = String;
24 const METHOD: &'static str = "m/syntaxTree";
25}
26
27#[derive(Deserialize, Debug)]
28#[serde(rename_all = "camelCase")]
29pub struct SyntaxTreeParams {
30 pub text_document: TextDocumentIdentifier
31}
32
33pub enum ExtendSelection {}
34
35impl Request for ExtendSelection {
36 type Params = ExtendSelectionParams;
37 type Result = ExtendSelectionResult;
38 const METHOD: &'static str = "m/extendSelection";
39}
40
41#[derive(Deserialize, Debug)]
42#[serde(rename_all = "camelCase")]
43pub struct ExtendSelectionParams {
44 pub text_document: TextDocumentIdentifier,
45 pub selections: Vec<Range>,
46}
47
48#[derive(Serialize, Debug)]
49#[serde(rename_all = "camelCase")]
50pub struct ExtendSelectionResult {
51 pub selections: Vec<Range>,
52}
53
54pub enum FindMatchingBrace {}
55
56impl Request for FindMatchingBrace {
57 type Params = FindMatchingBraceParams;
58 type Result = Vec<Position>;
59 const METHOD: &'static str = "m/findMatchingBrace";
60}
61
62#[derive(Deserialize, Debug)]
63#[serde(rename_all = "camelCase")]
64pub struct FindMatchingBraceParams {
65 pub text_document: TextDocumentIdentifier,
66 pub offsets: Vec<Position>,
67}
68
69pub enum DecorationsRequest {}
70
71impl Request for DecorationsRequest {
72 type Params = TextDocumentIdentifier;
73 type Result = Vec<Decoration>;
74 const METHOD: &'static str = "m/decorationsRequest";
75}
76
77pub enum PublishDecorations {}
78
79impl Notification for PublishDecorations {
80 type Params = PublishDecorationsParams;
81 const METHOD: &'static str = "m/publishDecorations";
82}
83
84#[derive(Serialize, Debug)]
85#[serde(rename_all = "camelCase")]
86pub struct PublishDecorationsParams {
87 #[serde(with = "url_serde")]
88 pub uri: Url,
89 pub decorations: Vec<Decoration>,
90}
91
92#[derive(Serialize, Debug)]
93#[serde(rename_all = "camelCase")]
94pub struct Decoration {
95 pub range: Range,
96 pub tag: &'static str
97}
98
99pub enum ParentModule {}
100
101impl Request for ParentModule {
102 type Params = TextDocumentIdentifier;
103 type Result = Vec<Location>;
104 const METHOD: &'static str = "m/parentModule";
105}
106
107pub enum JoinLines {}
108
109impl Request for JoinLines {
110 type Params = JoinLinesParams;
111 type Result = SourceChange;
112 const METHOD: &'static str = "m/joinLines";
113}
114
115#[derive(Deserialize, Debug)]
116#[serde(rename_all = "camelCase")]
117pub struct JoinLinesParams {
118 pub text_document: TextDocumentIdentifier,
119 pub range: Range,
120}
121
122pub enum Runnables {}
123
124impl Request for Runnables {
125 type Params = RunnablesParams;
126 type Result = Vec<Runnable>;
127 const METHOD: &'static str = "m/runnables";
128}
129
130#[derive(Serialize, Deserialize, Debug)]
131#[serde(rename_all = "camelCase")]
132pub struct RunnablesParams {
133 pub text_document: TextDocumentIdentifier,
134 pub position: Option<Position>,
135}
136
137#[derive(Serialize, Debug)]
138#[serde(rename_all = "camelCase")]
139pub struct Runnable {
140 pub range: Range,
141 pub label: String,
142 pub bin: String,
143 pub args: Vec<String>,
144 pub env: HashMap<String, String>,
145}
146
147#[derive(Serialize, Debug)]
148#[serde(rename_all = "camelCase")]
149pub struct SourceChange {
150 pub label: String,
151 pub source_file_edits: Vec<TextDocumentEdit>,
152 pub file_system_edits: Vec<FileSystemEdit>,
153 pub cursor_position: Option<TextDocumentPositionParams>,
154}
155
156#[derive(Serialize, Debug)]
157#[serde(tag = "type", rename_all = "camelCase")]
158pub enum FileSystemEdit {
159 CreateFile {
160 #[serde(with = "url_serde")]
161 uri: Url
162 },
163 MoveFile {
164 #[serde(with = "url_serde")]
165 src: Url,
166 #[serde(with = "url_serde")]
167 dst: Url,
168 }
169}
170
171pub enum InternalFeedback {}
172
173impl Notification for InternalFeedback {
174 const METHOD: &'static str = "internalFeedback";
175 type Params = String;
176}