* @deprecated Use InsertTextTransformation (or InsertTextVSCodeTransformation) instead.
(
editor: vscode.TextEditor,
text: string,
at?: Position,
letVSCodeHandleKeystrokes?: boolean,
)
| 18 | * @deprecated Use InsertTextTransformation (or InsertTextVSCodeTransformation) instead. |
| 19 | */ |
| 20 | static async insert( |
| 21 | editor: vscode.TextEditor, |
| 22 | text: string, |
| 23 | at?: Position, |
| 24 | letVSCodeHandleKeystrokes?: boolean, |
| 25 | ): Promise<void> { |
| 26 | // If we insert "blah(" with default:type, VSCode will insert the closing ). |
| 27 | // We *probably* don't want that to happen if we're inserting a lot of text. |
| 28 | letVSCodeHandleKeystrokes ??= text.length === 1; |
| 29 | |
| 30 | if (!letVSCodeHandleKeystrokes) { |
| 31 | await editor.edit((editBuilder) => { |
| 32 | if (!at) { |
| 33 | at = editor.selection.active; |
| 34 | } |
| 35 | |
| 36 | editBuilder.insert(at, text); |
| 37 | }); |
| 38 | } else { |
| 39 | await vscode.commands.executeCommand('default:type', { text }); |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * @deprecated. Use ReplaceTextTransformation instead. |