mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-30 03:27:44 +00:00
Merge pull request #19704 from Veykril/push-wrvznvvpvtvp
Add expression fill mode variant for filling with underscore expressions
This commit is contained in:
commit
0fee71065b
31 changed files with 172 additions and 125 deletions
|
|
@ -175,7 +175,7 @@ impl flags::AnalysisStats {
|
|||
UsizeWithUnderscore(dep_loc),
|
||||
UsizeWithUnderscore(dep_item_trees),
|
||||
);
|
||||
eprintln!(" dependency item stats: {}", dep_item_stats);
|
||||
eprintln!(" dependency item stats: {dep_item_stats}");
|
||||
|
||||
// FIXME(salsa-transition): bring back stats for ParseQuery (file size)
|
||||
// and ParseMacroExpansionQuery (macro expansion "file") size whenever we implement
|
||||
|
|
@ -295,7 +295,7 @@ impl flags::AnalysisStats {
|
|||
UsizeWithUnderscore(workspace_loc),
|
||||
UsizeWithUnderscore(workspace_item_trees),
|
||||
);
|
||||
eprintln!(" usages: {}", workspace_item_stats);
|
||||
eprintln!(" usages: {workspace_item_stats}");
|
||||
|
||||
eprintln!(" Dependencies:");
|
||||
eprintln!(
|
||||
|
|
@ -303,7 +303,7 @@ impl flags::AnalysisStats {
|
|||
UsizeWithUnderscore(dep_loc),
|
||||
UsizeWithUnderscore(dep_item_trees),
|
||||
);
|
||||
eprintln!(" declarations: {}", dep_item_stats);
|
||||
eprintln!(" declarations: {dep_item_stats}");
|
||||
|
||||
let crate_def_map_time = crate_def_map_sw.elapsed();
|
||||
eprintln!("{:<20} {}", "Item Collection:", crate_def_map_time);
|
||||
|
|
@ -1294,7 +1294,7 @@ impl fmt::Display for UsizeWithUnderscore {
|
|||
let num_str = self.0.to_string();
|
||||
|
||||
if num_str.len() <= 3 {
|
||||
return write!(f, "{}", num_str);
|
||||
return write!(f, "{num_str}");
|
||||
}
|
||||
|
||||
let mut result = String::new();
|
||||
|
|
@ -1307,7 +1307,7 @@ impl fmt::Display for UsizeWithUnderscore {
|
|||
}
|
||||
|
||||
let result = result.chars().rev().collect::<String>();
|
||||
write!(f, "{}", result)
|
||||
write!(f, "{result}")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -265,10 +265,10 @@ impl flags::Scip {
|
|||
};
|
||||
|
||||
if !duplicate_symbol_errors.is_empty() {
|
||||
eprintln!("{}", DUPLICATE_SYMBOLS_MESSAGE);
|
||||
eprintln!("{DUPLICATE_SYMBOLS_MESSAGE}");
|
||||
for (source_location, symbol) in duplicate_symbol_errors {
|
||||
eprintln!("{}", source_location);
|
||||
eprintln!(" Duplicate symbol: {}", symbol);
|
||||
eprintln!("{source_location}");
|
||||
eprintln!(" Duplicate symbol: {symbol}");
|
||||
eprintln!();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,13 +9,14 @@ use cfg::{CfgAtom, CfgDiff};
|
|||
use hir::Symbol;
|
||||
use ide::{
|
||||
AssistConfig, CallHierarchyConfig, CallableSnippets, CompletionConfig,
|
||||
CompletionFieldsToResolve, DiagnosticsConfig, ExprFillDefaultMode, GenericParameterHints,
|
||||
HighlightConfig, HighlightRelatedConfig, HoverConfig, HoverDocFormat, InlayFieldsToResolve,
|
||||
InlayHintsConfig, JoinLinesConfig, MemoryLayoutHoverConfig, MemoryLayoutHoverRenderKind,
|
||||
Snippet, SnippetScope, SourceRootId,
|
||||
CompletionFieldsToResolve, DiagnosticsConfig, GenericParameterHints, HighlightConfig,
|
||||
HighlightRelatedConfig, HoverConfig, HoverDocFormat, InlayFieldsToResolve, InlayHintsConfig,
|
||||
JoinLinesConfig, MemoryLayoutHoverConfig, MemoryLayoutHoverRenderKind, Snippet, SnippetScope,
|
||||
SourceRootId,
|
||||
};
|
||||
use ide_db::{
|
||||
SnippetCap,
|
||||
assists::ExprFillDefaultMode,
|
||||
imports::insert_use::{ImportGranularity, InsertUseConfig, PrefixKind},
|
||||
};
|
||||
use itertools::{Either, Itertools};
|
||||
|
|
@ -1493,6 +1494,11 @@ impl Config {
|
|||
term_search_fuel: self.assist_termSearch_fuel(source_root).to_owned() as u64,
|
||||
term_search_borrowck: self.assist_termSearch_borrowcheck(source_root).to_owned(),
|
||||
code_action_grouping: self.code_action_group(),
|
||||
expr_fill_default: match self.assist_expressionFillDefault(source_root) {
|
||||
ExprFillDefaultDef::Todo => ExprFillDefaultMode::Todo,
|
||||
ExprFillDefaultDef::Default => ExprFillDefaultMode::Default,
|
||||
ExprFillDefaultDef::Underscore => ExprFillDefaultMode::Underscore,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1577,6 +1583,7 @@ impl Config {
|
|||
expr_fill_default: match self.assist_expressionFillDefault(source_root) {
|
||||
ExprFillDefaultDef::Todo => ExprFillDefaultMode::Todo,
|
||||
ExprFillDefaultDef::Default => ExprFillDefaultMode::Default,
|
||||
ExprFillDefaultDef::Underscore => ExprFillDefaultMode::Underscore,
|
||||
},
|
||||
snippet_cap: self.snippet_cap(),
|
||||
insert_use: self.insert_use_config(source_root),
|
||||
|
|
@ -2527,6 +2534,7 @@ where
|
|||
enum ExprFillDefaultDef {
|
||||
Todo,
|
||||
Default,
|
||||
Underscore,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue