diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/rust-analyzer/src/cli/analysis_bench.rs | 7 | ||||
-rw-r--r-- | crates/rust-analyzer/src/cli/analysis_stats.rs | 7 | ||||
-rw-r--r-- | crates/rust-analyzer/src/cli/diagnostics.rs | 2 | ||||
-rw-r--r-- | crates/rust-analyzer/src/cli/load_cargo.rs | 5 | ||||
-rw-r--r-- | crates/rust-analyzer/src/cli/ssr.rs | 4 |
5 files changed, 18 insertions, 7 deletions
diff --git a/crates/rust-analyzer/src/cli/analysis_bench.rs b/crates/rust-analyzer/src/cli/analysis_bench.rs index a01b49822..f4068937e 100644 --- a/crates/rust-analyzer/src/cli/analysis_bench.rs +++ b/crates/rust-analyzer/src/cli/analysis_bench.rs | |||
@@ -59,7 +59,12 @@ impl BenchCmd { | |||
59 | 59 | ||
60 | let start = Instant::now(); | 60 | let start = Instant::now(); |
61 | eprint!("loading: "); | 61 | eprint!("loading: "); |
62 | let (mut host, vfs) = load_cargo(&self.path, self.load_output_dirs, self.with_proc_macro)?; | 62 | let (mut host, vfs) = load_cargo( |
63 | &self.path, | ||
64 | &Default::default(), | ||
65 | self.load_output_dirs, | ||
66 | self.with_proc_macro, | ||
67 | )?; | ||
63 | eprintln!("{:?}\n", start.elapsed()); | 68 | eprintln!("{:?}\n", start.elapsed()); |
64 | 69 | ||
65 | let file_id = { | 70 | let file_id = { |
diff --git a/crates/rust-analyzer/src/cli/analysis_stats.rs b/crates/rust-analyzer/src/cli/analysis_stats.rs index 66416f709..f0852d125 100644 --- a/crates/rust-analyzer/src/cli/analysis_stats.rs +++ b/crates/rust-analyzer/src/cli/analysis_stats.rs | |||
@@ -57,7 +57,12 @@ impl AnalysisStatsCmd { | |||
57 | }; | 57 | }; |
58 | 58 | ||
59 | let mut db_load_sw = self.stop_watch(); | 59 | let mut db_load_sw = self.stop_watch(); |
60 | let (host, vfs) = load_cargo(&self.path, self.load_output_dirs, self.with_proc_macro)?; | 60 | let (host, vfs) = load_cargo( |
61 | &self.path, | ||
62 | &Default::default(), | ||
63 | self.load_output_dirs, | ||
64 | self.with_proc_macro, | ||
65 | )?; | ||
61 | let db = host.raw_database(); | 66 | let db = host.raw_database(); |
62 | eprintln!("{:<20} {}", "Database loaded:", db_load_sw.elapsed()); | 67 | eprintln!("{:<20} {}", "Database loaded:", db_load_sw.elapsed()); |
63 | 68 | ||
diff --git a/crates/rust-analyzer/src/cli/diagnostics.rs b/crates/rust-analyzer/src/cli/diagnostics.rs index 0090fd2c2..6646e417c 100644 --- a/crates/rust-analyzer/src/cli/diagnostics.rs +++ b/crates/rust-analyzer/src/cli/diagnostics.rs | |||
@@ -26,7 +26,7 @@ fn all_modules(db: &dyn HirDatabase) -> Vec<Module> { | |||
26 | } | 26 | } |
27 | 27 | ||
28 | pub fn diagnostics(path: &Path, load_output_dirs: bool, with_proc_macro: bool) -> Result<()> { | 28 | pub fn diagnostics(path: &Path, load_output_dirs: bool, with_proc_macro: bool) -> Result<()> { |
29 | let (host, _vfs) = load_cargo(path, load_output_dirs, with_proc_macro)?; | 29 | let (host, _vfs) = load_cargo(path, &Default::default(), load_output_dirs, with_proc_macro)?; |
30 | let db = host.raw_database(); | 30 | let db = host.raw_database(); |
31 | let analysis = host.analysis(); | 31 | let analysis = host.analysis(); |
32 | 32 | ||
diff --git a/crates/rust-analyzer/src/cli/load_cargo.rs b/crates/rust-analyzer/src/cli/load_cargo.rs index e12e87180..4669c9bc3 100644 --- a/crates/rust-analyzer/src/cli/load_cargo.rs +++ b/crates/rust-analyzer/src/cli/load_cargo.rs | |||
@@ -15,12 +15,13 @@ use crate::reload::{ProjectFolders, SourceRootConfig}; | |||
15 | 15 | ||
16 | pub fn load_cargo( | 16 | pub fn load_cargo( |
17 | root: &Path, | 17 | root: &Path, |
18 | config: &CargoConfig, | ||
18 | load_out_dirs_from_check: bool, | 19 | load_out_dirs_from_check: bool, |
19 | with_proc_macro: bool, | 20 | with_proc_macro: bool, |
20 | ) -> Result<(AnalysisHost, vfs::Vfs)> { | 21 | ) -> Result<(AnalysisHost, vfs::Vfs)> { |
21 | let root = AbsPathBuf::assert(std::env::current_dir()?.join(root)); | 22 | let root = AbsPathBuf::assert(std::env::current_dir()?.join(root)); |
22 | let root = ProjectManifest::discover_single(&root)?; | 23 | let root = ProjectManifest::discover_single(&root)?; |
23 | let ws = ProjectWorkspace::load(root, &CargoConfig::default(), &|_| {})?; | 24 | let ws = ProjectWorkspace::load(root, config, &|_| {})?; |
24 | 25 | ||
25 | let (sender, receiver) = unbounded(); | 26 | let (sender, receiver) = unbounded(); |
26 | let mut vfs = vfs::Vfs::default(); | 27 | let mut vfs = vfs::Vfs::default(); |
@@ -116,7 +117,7 @@ mod tests { | |||
116 | #[test] | 117 | #[test] |
117 | fn test_loading_rust_analyzer() { | 118 | fn test_loading_rust_analyzer() { |
118 | let path = Path::new(env!("CARGO_MANIFEST_DIR")).parent().unwrap().parent().unwrap(); | 119 | let path = Path::new(env!("CARGO_MANIFEST_DIR")).parent().unwrap().parent().unwrap(); |
119 | let (host, _vfs) = load_cargo(path, false, false).unwrap(); | 120 | let (host, _vfs) = load_cargo(path, &Default::default(), false, false).unwrap(); |
120 | let n_crates = Crate::all(host.raw_database()).len(); | 121 | let n_crates = Crate::all(host.raw_database()).len(); |
121 | // RA has quite a few crates, but the exact count doesn't matter | 122 | // RA has quite a few crates, but the exact count doesn't matter |
122 | assert!(n_crates > 20); | 123 | assert!(n_crates > 20); |
diff --git a/crates/rust-analyzer/src/cli/ssr.rs b/crates/rust-analyzer/src/cli/ssr.rs index bbb550ec9..8ab43e0f7 100644 --- a/crates/rust-analyzer/src/cli/ssr.rs +++ b/crates/rust-analyzer/src/cli/ssr.rs | |||
@@ -5,7 +5,7 @@ use ssr::{MatchFinder, SsrPattern, SsrRule}; | |||
5 | 5 | ||
6 | pub fn apply_ssr_rules(rules: Vec<SsrRule>) -> Result<()> { | 6 | pub fn apply_ssr_rules(rules: Vec<SsrRule>) -> Result<()> { |
7 | use ide_db::base_db::SourceDatabaseExt; | 7 | use ide_db::base_db::SourceDatabaseExt; |
8 | let (host, vfs) = load_cargo(&std::env::current_dir()?, true, true)?; | 8 | let (host, vfs) = load_cargo(&std::env::current_dir()?, &Default::default(), true, true)?; |
9 | let db = host.raw_database(); | 9 | let db = host.raw_database(); |
10 | let mut match_finder = MatchFinder::at_first_file(db)?; | 10 | let mut match_finder = MatchFinder::at_first_file(db)?; |
11 | for rule in rules { | 11 | for rule in rules { |
@@ -28,7 +28,7 @@ pub fn apply_ssr_rules(rules: Vec<SsrRule>) -> Result<()> { | |||
28 | pub fn search_for_patterns(patterns: Vec<SsrPattern>, debug_snippet: Option<String>) -> Result<()> { | 28 | pub fn search_for_patterns(patterns: Vec<SsrPattern>, debug_snippet: Option<String>) -> Result<()> { |
29 | use ide_db::base_db::SourceDatabaseExt; | 29 | use ide_db::base_db::SourceDatabaseExt; |
30 | use ide_db::symbol_index::SymbolsDatabase; | 30 | use ide_db::symbol_index::SymbolsDatabase; |
31 | let (host, _vfs) = load_cargo(&std::env::current_dir()?, true, true)?; | 31 | let (host, _vfs) = load_cargo(&std::env::current_dir()?, &Default::default(), true, true)?; |
32 | let db = host.raw_database(); | 32 | let db = host.raw_database(); |
33 | let mut match_finder = MatchFinder::at_first_file(db)?; | 33 | let mut match_finder = MatchFinder::at_first_file(db)?; |
34 | for pattern in patterns { | 34 | for pattern in patterns { |