mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-04 19:29:07 +00:00
move assists to subdir
This commit is contained in:
parent
d9b4835625
commit
f32081fa18
@ -17,6 +17,7 @@ use ra_syntax::{TextRange, TextUnit};
|
||||
use ra_text_edit::TextEdit;
|
||||
|
||||
pub(crate) use crate::assist_ctx::{Assist, AssistCtx};
|
||||
pub use crate::assists::auto_import::auto_import_text_edit;
|
||||
|
||||
/// Unique identifier of the assist, should not be shown to the user
|
||||
/// directly.
|
||||
@ -46,7 +47,7 @@ where
|
||||
H: HirDatabase + 'static,
|
||||
{
|
||||
AssistCtx::with_ctx(db, range, false, |ctx| {
|
||||
all_assists()
|
||||
assists::all()
|
||||
.iter()
|
||||
.filter_map(|f| f(ctx.clone()))
|
||||
.map(|a| match a {
|
||||
@ -68,7 +69,7 @@ where
|
||||
use std::cmp::Ordering;
|
||||
|
||||
AssistCtx::with_ctx(db, range, true, |ctx| {
|
||||
let mut a = all_assists()
|
||||
let mut a = assists::all()
|
||||
.iter()
|
||||
.filter_map(|f| f(ctx.clone()))
|
||||
.map(|a| match a {
|
||||
@ -86,6 +87,10 @@ where
|
||||
})
|
||||
}
|
||||
|
||||
mod assists {
|
||||
use crate::{Assist, AssistCtx};
|
||||
use hir::db::HirDatabase;
|
||||
|
||||
mod add_derive;
|
||||
mod add_explicit_type;
|
||||
mod add_impl;
|
||||
@ -100,12 +105,12 @@ mod raw_string;
|
||||
mod replace_if_let_with_match;
|
||||
mod split_import;
|
||||
mod remove_dbg;
|
||||
pub mod auto_import;
|
||||
pub(crate) mod auto_import;
|
||||
mod add_missing_impl_members;
|
||||
mod move_guard;
|
||||
mod move_bounds;
|
||||
|
||||
fn all_assists<DB: HirDatabase>() -> &'static [fn(AssistCtx<DB>) -> Option<Assist>] {
|
||||
pub(crate) fn all<DB: HirDatabase>() -> &'static [fn(AssistCtx<DB>) -> Option<Assist>] {
|
||||
&[
|
||||
add_derive::add_derive,
|
||||
add_explicit_type::add_explicit_type,
|
||||
@ -132,6 +137,7 @@ fn all_assists<DB: HirDatabase>() -> &'static [fn(AssistCtx<DB>) -> Option<Assis
|
||||
raw_string::remove_hash,
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod helpers {
|
||||
|
@ -1,4 +1,4 @@
|
||||
use ra_assists::auto_import;
|
||||
use ra_assists::auto_import_text_edit;
|
||||
use ra_syntax::{ast, AstNode, SmolStr};
|
||||
use ra_text_edit::TextEditBuilder;
|
||||
use rustc_hash::FxHashMap;
|
||||
@ -23,7 +23,7 @@ pub(super) fn complete_scope(acc: &mut Completions, ctx: &CompletionContext) {
|
||||
let edit = {
|
||||
let mut builder = TextEditBuilder::default();
|
||||
builder.replace(ctx.source_range(), name.to_string());
|
||||
auto_import::auto_import_text_edit(
|
||||
auto_import_text_edit(
|
||||
&ctx.token.parent(),
|
||||
&ctx.token.parent(),
|
||||
&path,
|
||||
|
Loading…
Reference in New Issue
Block a user