|
5 | 5 |
|
6 | 6 | use std::{collections::hash_map::Entry, iter, mem}; |
7 | 7 |
|
8 | | -use crate::SnippetCap; |
| 8 | +use crate::{assists::Command, SnippetCap}; |
9 | 9 | use base_db::{AnchoredPathBuf, FileId}; |
10 | 10 | use itertools::Itertools; |
11 | 11 | use nohash_hasher::IntMap; |
@@ -194,7 +194,7 @@ pub struct SourceChangeBuilder { |
194 | 194 | pub edit: TextEditBuilder, |
195 | 195 | pub file_id: FileId, |
196 | 196 | pub source_change: SourceChange, |
197 | | - pub trigger_signature_help: bool, |
| 197 | + pub command: Option<Command>, |
198 | 198 |
|
199 | 199 | /// Maps the original, immutable `SyntaxNode` to a `clone_for_update` twin. |
200 | 200 | pub mutated_tree: Option<TreeMutator>, |
@@ -236,7 +236,7 @@ impl SourceChangeBuilder { |
236 | 236 | edit: TextEdit::builder(), |
237 | 237 | file_id, |
238 | 238 | source_change: SourceChange::default(), |
239 | | - trigger_signature_help: false, |
| 239 | + command: None, |
240 | 240 | mutated_tree: None, |
241 | 241 | snippet_builder: None, |
242 | 242 | } |
@@ -304,8 +304,15 @@ impl SourceChangeBuilder { |
304 | 304 | let file_system_edit = FileSystemEdit::MoveFile { src, dst }; |
305 | 305 | self.source_change.push_file_system_edit(file_system_edit); |
306 | 306 | } |
| 307 | + |
| 308 | + /// Triggers the parameter hint popup after the assist is applied |
307 | 309 | pub fn trigger_signature_help(&mut self) { |
308 | | - self.trigger_signature_help = true; |
| 310 | + self.command = Some(Command::TriggerSignatureHelp); |
| 311 | + } |
| 312 | + |
| 313 | + /// Renames the item at the cursor position after the assist is applied |
| 314 | + pub fn rename(&mut self) { |
| 315 | + self.command = Some(Command::Rename); |
309 | 316 | } |
310 | 317 |
|
311 | 318 | /// Adds a tabstop snippet to place the cursor before `node` |
|
0 commit comments