MCPcopy
hub / github.com/VSCodeVim/Vim / insert

Method insert

src/textEditor.ts:20–41  ·  view source on GitHub ↗

* @deprecated Use InsertTextTransformation (or InsertTextVSCodeTransformation) instead.

(
    editor: vscode.TextEditor,
    text: string,
    at?: Position,
    letVSCodeHandleKeystrokes?: boolean,
  )

Source from the content-addressed store, hash-verified

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.

Callers 3

setupTestWithLinesFunction · 0.45
remapper.test.tsFile · 0.45
isPanelVisibleFunction · 0.45

Calls 1

editMethod · 0.80

Tested by 2

setupTestWithLinesFunction · 0.36
isPanelVisibleFunction · 0.36