diff options
Diffstat (limited to 'crates/rust-analyzer/src/lsp_ext.rs')
-rw-r--r-- | crates/rust-analyzer/src/lsp_ext.rs | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/crates/rust-analyzer/src/lsp_ext.rs b/crates/rust-analyzer/src/lsp_ext.rs index 173c23b9e..ec24ce5e0 100644 --- a/crates/rust-analyzer/src/lsp_ext.rs +++ b/crates/rust-analyzer/src/lsp_ext.rs | |||
@@ -4,7 +4,6 @@ use std::{collections::HashMap, path::PathBuf}; | |||
4 | 4 | ||
5 | use lsp_types::request::Request; | 5 | use lsp_types::request::Request; |
6 | use lsp_types::{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 {} |
@@ -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)] |
@@ -121,25 +120,31 @@ pub struct RunnablesParams { | |||
121 | pub position: Option<Position>, | 120 | pub position: Option<Position>, |
122 | } | 121 | } |
123 | 122 | ||
124 | // Must strictly correspond to the executable name | 123 | #[derive(Deserialize, Serialize, Debug)] |
124 | #[serde(rename_all = "camelCase")] | ||
125 | pub struct Runnable { | ||
126 | pub label: String, | ||
127 | #[serde(skip_serializing_if = "Option::is_none")] | ||
128 | pub location: Option<lsp_types::LocationLink>, | ||
129 | pub kind: RunnableKind, | ||
130 | pub args: CargoRunnable, | ||
131 | } | ||
132 | |||
125 | #[derive(Serialize, Deserialize, Debug)] | 133 | #[derive(Serialize, Deserialize, Debug)] |
126 | #[serde(rename_all = "lowercase")] | 134 | #[serde(rename_all = "lowercase")] |
127 | pub enum RunnableKind { | 135 | pub enum RunnableKind { |
128 | Cargo, | 136 | Cargo, |
129 | Rustc, | ||
130 | Rustup, | ||
131 | } | 137 | } |
132 | 138 | ||
133 | #[derive(Deserialize, Serialize, Debug)] | 139 | #[derive(Deserialize, Serialize, Debug)] |
134 | #[serde(rename_all = "camelCase")] | 140 | #[serde(rename_all = "camelCase")] |
135 | pub struct Runnable { | 141 | pub struct CargoRunnable { |
136 | pub range: Range, | 142 | #[serde(skip_serializing_if = "Option::is_none")] |
137 | pub label: String, | 143 | pub workspace_root: Option<PathBuf>, |
138 | pub kind: RunnableKind, | 144 | // command, --package and --lib stuff |
139 | pub args: Vec<String>, | 145 | pub cargo_args: Vec<String>, |
140 | pub extra_args: Vec<String>, | 146 | // stuff after -- |
141 | pub env: FxHashMap<String, String>, | 147 | pub executable_args: Vec<String>, |
142 | pub cwd: Option<PathBuf>, | ||
143 | } | 148 | } |
144 | 149 | ||
145 | pub enum InlayHints {} | 150 | pub enum InlayHints {} |