1 use lsp_types::{Location, Position, Range, TextDocumentIdentifier, Url};
2 use rustc_hash::FxHashMap;
3 use serde::{Deserialize, Serialize};
7 notification::*, request::*, ApplyWorkspaceEditParams, CodeActionParams, CodeLens, CodeLensParams,
8 CompletionParams, CompletionResponse, DocumentOnTypeFormattingParams, DocumentSymbolParams,
9 DocumentSymbolResponse, ExecuteCommandParams, Hover, InitializeResult,
10 PublishDiagnosticsParams, ReferenceParams, SignatureHelp, TextDocumentEdit,
11 TextDocumentPositionParams, TextEdit, WorkspaceEdit, WorkspaceSymbolParams,
12 MessageType, ShowMessageParams,
15 pub enum AnalyzerStatus {}
17 impl Request for AnalyzerStatus {
20 const METHOD: &'static str = "rust-analyzer/analyzerStatus";
23 pub enum CollectGarbage {}
25 impl Request for CollectGarbage {
28 const METHOD: &'static str = "rust-analyzer/collectGarbage";
31 pub enum SyntaxTree {}
33 impl Request for SyntaxTree {
34 type Params = SyntaxTreeParams;
36 const METHOD: &'static str = "rust-analyzer/syntaxTree";
39 #[derive(Deserialize, Debug)]
40 #[serde(rename_all = "camelCase")]
41 pub struct SyntaxTreeParams {
42 pub text_document: TextDocumentIdentifier,
43 pub range: Option<Range>,
46 pub enum ExtendSelection {}
48 impl Request for ExtendSelection {
49 type Params = ExtendSelectionParams;
50 type Result = ExtendSelectionResult;
51 const METHOD: &'static str = "rust-analyzer/extendSelection";
54 #[derive(Deserialize, Debug)]
55 #[serde(rename_all = "camelCase")]
56 pub struct ExtendSelectionParams {
57 pub text_document: TextDocumentIdentifier,
58 pub selections: Vec<Range>,
61 #[derive(Serialize, Debug)]
62 #[serde(rename_all = "camelCase")]
63 pub struct ExtendSelectionResult {
64 pub selections: Vec<Range>,
67 pub enum FindMatchingBrace {}
69 impl Request for FindMatchingBrace {
70 type Params = FindMatchingBraceParams;
71 type Result = Vec<Position>;
72 const METHOD: &'static str = "rust-analyzer/findMatchingBrace";
75 #[derive(Deserialize, Debug)]
76 #[serde(rename_all = "camelCase")]
77 pub struct FindMatchingBraceParams {
78 pub text_document: TextDocumentIdentifier,
79 pub offsets: Vec<Position>,
82 pub enum DecorationsRequest {}
84 impl Request for DecorationsRequest {
85 type Params = TextDocumentIdentifier;
86 type Result = Vec<Decoration>;
87 const METHOD: &'static str = "rust-analyzer/decorationsRequest";
90 pub enum PublishDecorations {}
92 impl Notification for PublishDecorations {
93 type Params = PublishDecorationsParams;
94 const METHOD: &'static str = "rust-analyzer/publishDecorations";
97 #[derive(Serialize, Debug)]
98 #[serde(rename_all = "camelCase")]
99 pub struct PublishDecorationsParams {
100 #[serde(with = "url_serde")]
102 pub decorations: Vec<Decoration>,
105 #[derive(Serialize, Debug)]
106 #[serde(rename_all = "camelCase")]
107 pub struct Decoration {
109 pub tag: &'static str,
112 pub enum ParentModule {}
114 impl Request for ParentModule {
115 type Params = TextDocumentPositionParams;
116 type Result = Vec<Location>;
117 const METHOD: &'static str = "rust-analyzer/parentModule";
120 pub enum JoinLines {}
122 impl Request for JoinLines {
123 type Params = JoinLinesParams;
124 type Result = SourceChange;
125 const METHOD: &'static str = "rust-analyzer/joinLines";
128 #[derive(Deserialize, Debug)]
129 #[serde(rename_all = "camelCase")]
130 pub struct JoinLinesParams {
131 pub text_document: TextDocumentIdentifier,
137 impl Request for OnEnter {
138 type Params = TextDocumentPositionParams;
139 type Result = Option<SourceChange>;
140 const METHOD: &'static str = "rust-analyzer/onEnter";
143 pub enum Runnables {}
145 impl Request for Runnables {
146 type Params = RunnablesParams;
147 type Result = Vec<Runnable>;
148 const METHOD: &'static str = "rust-analyzer/runnables";
151 #[derive(Serialize, Deserialize, Debug)]
152 #[serde(rename_all = "camelCase")]
153 pub struct RunnablesParams {
154 pub text_document: TextDocumentIdentifier,
155 pub position: Option<Position>,
158 #[derive(Serialize, Debug)]
159 #[serde(rename_all = "camelCase")]
160 pub struct Runnable {
164 pub args: Vec<String>,
165 pub env: FxHashMap<String, String>,
166 pub cwd: Option<String>,
169 #[derive(Serialize, Debug)]
170 #[serde(rename_all = "camelCase")]
171 pub struct SourceChange {
173 pub workspace_edit: WorkspaceEdit,
174 pub cursor_position: Option<TextDocumentPositionParams>,