diff options
Diffstat (limited to 'crates/rust-analyzer/src/bin/flags.rs')
-rw-r--r-- | crates/rust-analyzer/src/bin/flags.rs | 53 |
1 files changed, 2 insertions, 51 deletions
diff --git a/crates/rust-analyzer/src/bin/flags.rs b/crates/rust-analyzer/src/bin/flags.rs index d8987633d..b05fc00b9 100644 --- a/crates/rust-analyzer/src/bin/flags.rs +++ b/crates/rust-analyzer/src/bin/flags.rs | |||
@@ -1,10 +1,9 @@ | |||
1 | //! Grammar for the command-line arguments. | 1 | //! Grammar for the command-line arguments. |
2 | #![allow(unreachable_pub)] | 2 | #![allow(unreachable_pub)] |
3 | use std::{env, path::PathBuf}; | 3 | use std::path::PathBuf; |
4 | 4 | ||
5 | use ide_ssr::{SsrPattern, SsrRule}; | 5 | use ide_ssr::{SsrPattern, SsrRule}; |
6 | use rust_analyzer::cli::{BenchWhat, Position, Verbosity}; | 6 | use rust_analyzer::cli::Verbosity; |
7 | use vfs::AbsPathBuf; | ||
8 | 7 | ||
9 | xflags::xflags! { | 8 | xflags::xflags! { |
10 | src "./src/bin/flags.rs" | 9 | src "./src/bin/flags.rs" |
@@ -74,27 +73,6 @@ xflags::xflags! { | |||
74 | optional --with-proc-macro | 73 | optional --with-proc-macro |
75 | } | 74 | } |
76 | 75 | ||
77 | /// Benchmark specific analysis operation | ||
78 | cmd analysis-bench | ||
79 | /// Directory with Cargo.toml. | ||
80 | required path: PathBuf | ||
81 | { | ||
82 | /// Collect memory usage statistics. | ||
83 | optional --memory-usage | ||
84 | |||
85 | /// Compute syntax highlighting for this file | ||
86 | optional --highlight path: PathBuf | ||
87 | /// Compute completions at file:line:column location. | ||
88 | optional --complete location: Position | ||
89 | /// Compute goto definition at file:line:column location. | ||
90 | optional --goto-def location: Position | ||
91 | |||
92 | /// Load OUT_DIR values by running `cargo check` before analysis. | ||
93 | optional --load-output-dirs | ||
94 | /// Use proc-macro-srv for proc-macro expanding. | ||
95 | optional --with-proc-macro | ||
96 | } | ||
97 | |||
98 | cmd diagnostics | 76 | cmd diagnostics |
99 | /// Directory with Cargo.toml. | 77 | /// Directory with Cargo.toml. |
100 | required path: PathBuf | 78 | required path: PathBuf |
@@ -142,7 +120,6 @@ pub enum RustAnalyzerCmd { | |||
142 | Symbols(Symbols), | 120 | Symbols(Symbols), |
143 | Highlight(Highlight), | 121 | Highlight(Highlight), |
144 | AnalysisStats(AnalysisStats), | 122 | AnalysisStats(AnalysisStats), |
145 | AnalysisBench(AnalysisBench), | ||
146 | Diagnostics(Diagnostics), | 123 | Diagnostics(Diagnostics), |
147 | Ssr(Ssr), | 124 | Ssr(Ssr), |
148 | Search(Search), | 125 | Search(Search), |
@@ -184,18 +161,6 @@ pub struct AnalysisStats { | |||
184 | } | 161 | } |
185 | 162 | ||
186 | #[derive(Debug)] | 163 | #[derive(Debug)] |
187 | pub struct AnalysisBench { | ||
188 | pub path: PathBuf, | ||
189 | |||
190 | pub memory_usage: bool, | ||
191 | pub highlight: Option<PathBuf>, | ||
192 | pub complete: Option<Position>, | ||
193 | pub goto_def: Option<Position>, | ||
194 | pub load_output_dirs: bool, | ||
195 | pub with_proc_macro: bool, | ||
196 | } | ||
197 | |||
198 | #[derive(Debug)] | ||
199 | pub struct Diagnostics { | 164 | pub struct Diagnostics { |
200 | pub path: PathBuf, | 165 | pub path: PathBuf, |
201 | 166 | ||
@@ -239,17 +204,3 @@ impl RustAnalyzer { | |||
239 | } | 204 | } |
240 | } | 205 | } |
241 | } | 206 | } |
242 | |||
243 | impl AnalysisBench { | ||
244 | pub(crate) fn what(&self) -> BenchWhat { | ||
245 | match (&self.highlight, &self.complete, &self.goto_def) { | ||
246 | (Some(path), None, None) => { | ||
247 | let path = env::current_dir().unwrap().join(path); | ||
248 | BenchWhat::Highlight { path: AbsPathBuf::assert(path) } | ||
249 | } | ||
250 | (None, Some(position), None) => BenchWhat::Complete(position.clone()), | ||
251 | (None, None, Some(position)) => BenchWhat::GotoDef(position.clone()), | ||
252 | _ => panic!("exactly one of `--highlight`, `--complete` or `--goto-def` must be set"), | ||
253 | } | ||
254 | } | ||
255 | } | ||