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

Method execAction

src/textobject/textobject.ts:482–515  ·  view source on GitHub ↗
(position: Position, vimState: VimState)

Source from the content-addressed store, hash-verified

480 keys = ['a', 'p'];
481
482 public async execAction(position: Position, vimState: VimState): Promise<IMovement> {
483 vimState.currentRegisterMode = RegisterMode.LineWise;
484
485 let start: Position;
486 const currentParagraphBegin = getCurrentParagraphBeginning(position, true);
487
488 if (vimState.document.lineAt(position).isEmptyOrWhitespace) {
489 // The cursor is at an empty line, it can be both the start of next paragraph and the end of previous paragraph
490 start = getCurrentParagraphEnd(getCurrentParagraphBeginning(position, true), true);
491 } else {
492 if (
493 currentParagraphBegin.isLineBeginning() &&
494 currentParagraphBegin.isLineEnd(vimState.document)
495 ) {
496 start = currentParagraphBegin.getRightThroughLineBreaks();
497 } else {
498 start = currentParagraphBegin;
499 }
500 }
501
502 // Include additional blank lines.
503 let stop = getCurrentParagraphEnd(position, true);
504 while (
505 stop.line < vimState.document.lineCount - 1 &&
506 vimState.document.lineAt(stop.getDown()).isEmptyOrWhitespace
507 ) {
508 stop = stop.with({ character: 0 }).getDown();
509 }
510
511 return {
512 start,
513 stop,
514 };
515 }
516}
517
518@RegisterAction

Callers

nothing calls this directly

Calls 6

getCurrentParagraphEndFunction · 0.90
isLineBeginningMethod · 0.80
isLineEndMethod · 0.80
getDownMethod · 0.80

Tested by

no test coverage detected