diff options
Diffstat (limited to 'crates/rust-analyzer/src/lsp_ext.rs')
-rw-r--r-- | crates/rust-analyzer/src/lsp_ext.rs | 68 |
1 files changed, 41 insertions, 27 deletions
diff --git a/crates/rust-analyzer/src/lsp_ext.rs b/crates/rust-analyzer/src/lsp_ext.rs index c25d90a50..ec24ce5e0 100644 --- a/crates/rust-analyzer/src/lsp_ext.rs +++ b/crates/rust-analyzer/src/lsp_ext.rs | |||
@@ -3,8 +3,7 @@ | |||
3 | use std::{collections::HashMap, path::PathBuf}; | 3 | use std::{collections::HashMap, path::PathBuf}; |
4 | 4 | ||
5 | use lsp_types::request::Request; | 5 | use lsp_types::request::Request; |
6 | use lsp_types::{Location, Position, Range, TextDocumentIdentifier}; | 6 | use lsp_types::{Position, Range, TextDocumentIdentifier}; |
7 | use rustc_hash::FxHashMap; | ||
8 | use serde::{Deserialize, Serialize}; | 7 | use serde::{Deserialize, Serialize}; |
9 | 8 | ||
10 | pub enum AnalyzerStatus {} | 9 | pub enum AnalyzerStatus {} |
@@ -38,13 +37,6 @@ pub struct SyntaxTreeParams { | |||
38 | pub range: Option<Range>, | 37 | pub range: Option<Range>, |
39 | } | 38 | } |
40 | 39 | ||
41 | #[derive(Deserialize, Serialize, Debug)] | ||
42 | #[serde(rename_all = "camelCase")] | ||
43 | pub struct ExpandedMacro { | ||
44 | pub name: String, | ||
45 | pub expansion: String, | ||
46 | } | ||
47 | |||
48 | pub enum ExpandMacro {} | 40 | pub enum ExpandMacro {} |
49 | 41 | ||
50 | impl Request for ExpandMacro { | 42 | impl Request for ExpandMacro { |
@@ -57,30 +49,37 @@ impl Request for ExpandMacro { | |||
57 | #[serde(rename_all = "camelCase")] | 49 | #[serde(rename_all = "camelCase")] |
58 | pub struct ExpandMacroParams { | 50 | pub struct ExpandMacroParams { |
59 | pub text_document: TextDocumentIdentifier, | 51 | pub text_document: TextDocumentIdentifier, |
60 | pub position: Option<Position>, | 52 | pub position: Position, |
61 | } | 53 | } |
62 | 54 | ||
63 | pub enum FindMatchingBrace {} | 55 | #[derive(Deserialize, Serialize, Debug)] |
56 | #[serde(rename_all = "camelCase")] | ||
57 | pub struct ExpandedMacro { | ||
58 | pub name: String, | ||
59 | pub expansion: String, | ||
60 | } | ||
61 | |||
62 | pub enum MatchingBrace {} | ||
64 | 63 | ||
65 | impl Request for FindMatchingBrace { | 64 | impl Request for MatchingBrace { |
66 | type Params = FindMatchingBraceParams; | 65 | type Params = MatchingBraceParams; |
67 | type Result = Vec<Position>; | 66 | type Result = Vec<Position>; |
68 | const METHOD: &'static str = "rust-analyzer/findMatchingBrace"; | 67 | const METHOD: &'static str = "experimental/matchingBrace"; |
69 | } | 68 | } |
70 | 69 | ||
71 | #[derive(Deserialize, Serialize, Debug)] | 70 | #[derive(Deserialize, Serialize, Debug)] |
72 | #[serde(rename_all = "camelCase")] | 71 | #[serde(rename_all = "camelCase")] |
73 | pub struct FindMatchingBraceParams { | 72 | pub struct MatchingBraceParams { |
74 | pub text_document: TextDocumentIdentifier, | 73 | pub text_document: TextDocumentIdentifier, |
75 | pub offsets: Vec<Position>, | 74 | pub positions: Vec<Position>, |
76 | } | 75 | } |
77 | 76 | ||
78 | pub enum ParentModule {} | 77 | pub enum ParentModule {} |
79 | 78 | ||
80 | impl Request for ParentModule { | 79 | impl Request for ParentModule { |
81 | type Params = lsp_types::TextDocumentPositionParams; | 80 | type Params = lsp_types::TextDocumentPositionParams; |
82 | type Result = Vec<Location>; | 81 | type Result = Option<lsp_types::GotoDefinitionResponse>; |
83 | const METHOD: &'static str = "rust-analyzer/parentModule"; | 82 | const METHOD: &'static str = "experimental/parentModule"; |
84 | } | 83 | } |
85 | 84 | ||
86 | pub enum JoinLines {} | 85 | pub enum JoinLines {} |
@@ -102,8 +101,8 @@ pub enum OnEnter {} | |||
102 | 101 | ||
103 | impl Request for OnEnter { | 102 | impl Request for OnEnter { |
104 | type Params = lsp_types::TextDocumentPositionParams; | 103 | type Params = lsp_types::TextDocumentPositionParams; |
105 | type Result = Option<SnippetWorkspaceEdit>; | 104 | type Result = Option<Vec<SnippetTextEdit>>; |
106 | const METHOD: &'static str = "rust-analyzer/onEnter"; | 105 | const METHOD: &'static str = "experimental/onEnter"; |
107 | } | 106 | } |
108 | 107 | ||
109 | pub enum Runnables {} | 108 | pub enum Runnables {} |
@@ -111,7 +110,7 @@ pub enum Runnables {} | |||
111 | impl Request for Runnables { | 110 | impl Request for Runnables { |
112 | type Params = RunnablesParams; | 111 | type Params = RunnablesParams; |
113 | type Result = Vec<Runnable>; | 112 | type Result = Vec<Runnable>; |
114 | const METHOD: &'static str = "rust-analyzer/runnables"; | 113 | const METHOD: &'static str = "experimental/runnables"; |
115 | } | 114 | } |
116 | 115 | ||
117 | #[derive(Serialize, Deserialize, Debug)] | 116 | #[derive(Serialize, Deserialize, Debug)] |
@@ -124,13 +123,28 @@ pub struct RunnablesParams { | |||
124 | #[derive(Deserialize, Serialize, Debug)] | 123 | #[derive(Deserialize, Serialize, Debug)] |
125 | #[serde(rename_all = "camelCase")] | 124 | #[serde(rename_all = "camelCase")] |
126 | pub struct Runnable { | 125 | pub struct Runnable { |
127 | pub range: Range, | ||
128 | pub label: String, | 126 | pub label: String, |
129 | pub bin: String, | 127 | #[serde(skip_serializing_if = "Option::is_none")] |
130 | pub args: Vec<String>, | 128 | pub location: Option<lsp_types::LocationLink>, |
131 | pub extra_args: Vec<String>, | 129 | pub kind: RunnableKind, |
132 | pub env: FxHashMap<String, String>, | 130 | pub args: CargoRunnable, |
133 | pub cwd: Option<PathBuf>, | 131 | } |
132 | |||
133 | #[derive(Serialize, Deserialize, Debug)] | ||
134 | #[serde(rename_all = "lowercase")] | ||
135 | pub enum RunnableKind { | ||
136 | Cargo, | ||
137 | } | ||
138 | |||
139 | #[derive(Deserialize, Serialize, Debug)] | ||
140 | #[serde(rename_all = "camelCase")] | ||
141 | pub struct CargoRunnable { | ||
142 | #[serde(skip_serializing_if = "Option::is_none")] | ||
143 | pub workspace_root: Option<PathBuf>, | ||
144 | // command, --package and --lib stuff | ||
145 | pub cargo_args: Vec<String>, | ||
146 | // stuff after -- | ||
147 | pub executable_args: Vec<String>, | ||
134 | } | 148 | } |
135 | 149 | ||
136 | pub enum InlayHints {} | 150 | pub enum InlayHints {} |