//! in release mode in VS Code. There's however "Rust Analyzer: Copy Run Command Line"
//! which you can use to paste the command in terminal and add `--release` manually.
-use std::{convert::TryFrom, sync::Arc};
+use std::sync::Arc;
use ide::{Change, CompletionConfig, FilePosition, TextSize};
-use ide_db::helpers::{insert_use::InsertUseConfig, merge_imports::MergeBehavior, SnippetCap};
+use ide_db::helpers::{
+ insert_use::{ImportGranularity, InsertUseConfig},
+ SnippetCap,
+};
+use project_model::CargoConfig;
use test_utils::project_root;
use vfs::{AbsPathBuf, VfsPath};
let workspace_to_load = project_root();
let file = "./crates/ide_db/src/apply_change.rs";
- let cargo_config = Default::default();
+ let cargo_config = CargoConfig::default();
let load_cargo_config = LoadCargoConfig {
load_out_dirs_from_check: true,
- wrap_rustc: false,
with_proc_macro: false,
+ prefill_caches: false,
};
let (mut host, vfs, _proc_macro) = {
let workspace_to_load = project_root();
let file = "./crates/hir/src/lib.rs";
- let cargo_config = Default::default();
+ let cargo_config = CargoConfig::default();
let load_cargo_config = LoadCargoConfig {
load_out_dirs_from_check: true,
- wrap_rustc: false,
with_proc_macro: false,
+ prefill_caches: true,
};
let (mut host, vfs, _proc_macro) = {
};
{
- let _it = stdx::timeit("unqualified path completion");
+ let _p = profile::span("unqualified path completion");
let _span = profile::cpu_span();
let analysis = host.analysis();
let config = CompletionConfig {
enable_postfix_completions: true,
enable_imports_on_the_fly: true,
+ enable_self_on_the_fly: true,
add_call_parenthesis: true,
add_call_argument_snippets: true,
snippet_cap: SnippetCap::new(true),
insert_use: InsertUseConfig {
- merge: Some(MergeBehavior::Full),
+ granularity: ImportGranularity::Crate,
prefix_kind: hir::PrefixKind::ByCrate,
+ enforce_granularity: true,
group: true,
+ skip_glob_imports: true,
},
+ snippets: Vec::new(),
};
let position =
FilePosition { file_id, offset: TextSize::try_from(completion_offset).unwrap() };
};
{
- let _it = stdx::timeit("dot completion");
+ let _p = profile::span("dot completion");
let _span = profile::cpu_span();
let analysis = host.analysis();
let config = CompletionConfig {
enable_postfix_completions: true,
enable_imports_on_the_fly: true,
+ enable_self_on_the_fly: true,
add_call_parenthesis: true,
add_call_argument_snippets: true,
snippet_cap: SnippetCap::new(true),
insert_use: InsertUseConfig {
- merge: Some(MergeBehavior::Full),
+ granularity: ImportGranularity::Crate,
prefix_kind: hir::PrefixKind::ByCrate,
+ enforce_granularity: true,
group: true,
+ skip_glob_imports: true,
},
+ snippets: Vec::new(),
};
let position =
FilePosition { file_id, offset: TextSize::try_from(completion_offset).unwrap() };