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

Method run

src/actions/operator.ts:509–546  ·  view source on GitHub ↗
(vimState: VimState, start: Position, end: Position)

Source from the content-addressed store, hash-verified

507 keys = ['>'];
508
509 public async run(vimState: VimState, start: Position, end: Position): Promise<void> {
510 /**
511 * Repeating this command with dot should apply the indent to the left edge of the
512 * block formed by extending the cursor start position downward by the number of lines
513 * in the previous visual block selection.
514 */
515 if (
516 vimState.dotCommandStatus === DotCommandStatus.Executing &&
517 vimState.dotCommandPreviousVisualSelection
518 ) {
519 const shiftSelectionByNum = Math.abs(
520 vimState.dotCommandPreviousVisualSelection.end.line -
521 vimState.dotCommandPreviousVisualSelection.start.line,
522 );
523
524 start = vimState.cursorStartPosition;
525 end = vimState.cursorStartPosition.getDown(shiftSelectionByNum);
526
527 vimState.editor.selection = new vscode.Selection(start, end);
528 }
529
530 for (let lineIdx = 0; lineIdx < end.line - start.line + 1; lineIdx++) {
531 const tabSize = Number(vimState.editor.options.tabSize);
532 const currentLineEnd = vimState.document.lineAt(start.line + lineIdx).range.end.character;
533
534 if (currentLineEnd > start.character) {
535 vimState.recordedState.transformer.addTransformation({
536 type: 'insertText',
537 text: ' '.repeat(tabSize).repeat(vimState.recordedState.count || 1),
538 position: start.getDown(lineIdx),
539 manuallySetCursorPositions: true,
540 });
541 }
542 }
543
544 await vimState.setCurrentMode(Mode.Normal);
545 vimState.cursors = [Cursor.atPosition(start)];
546 }
547}
548@RegisterAction
549class OutdentOperator extends BaseOperator {

Callers

nothing calls this directly

Calls 4

getDownMethod · 0.80
addTransformationMethod · 0.80
atPositionMethod · 0.80
setCurrentModeMethod · 0.45

Tested by

no test coverage detected