Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-db/src/assists.rs')
| -rw-r--r-- | crates/ide-db/src/assists.rs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/crates/ide-db/src/assists.rs b/crates/ide-db/src/assists.rs index 7868f6148e..9ff3e10a1e 100644 --- a/crates/ide-db/src/assists.rs +++ b/crates/ide-db/src/assists.rs @@ -107,6 +107,36 @@ impl FromStr for AssistKind { #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub struct AssistId(pub &'static str, pub AssistKind, pub Option<usize>); +impl AssistId { + pub fn none(id: &'static str) -> AssistId { + AssistId(id, AssistKind::None, None) + } + + pub fn quick_fix(id: &'static str) -> AssistId { + AssistId(id, AssistKind::QuickFix, None) + } + + pub fn generate(id: &'static str) -> AssistId { + AssistId(id, AssistKind::Generate, None) + } + + pub fn refactor(id: &'static str) -> AssistId { + AssistId(id, AssistKind::Refactor, None) + } + + pub fn refactor_extract(id: &'static str) -> AssistId { + AssistId(id, AssistKind::RefactorExtract, None) + } + + pub fn refactor_inline(id: &'static str) -> AssistId { + AssistId(id, AssistKind::RefactorInline, None) + } + + pub fn refactor_rewrite(id: &'static str) -> AssistId { + AssistId(id, AssistKind::RefactorRewrite, None) + } +} + /// A way to control how many assist to resolve during the assist resolution. /// When an assist is resolved, its edits are calculated that might be costly to always do by default. #[derive(Debug)] |