5

With Visual Studio Code's multiline edit functionality, is there a way to easily align all cursors in a column at the end of a line if the whitespace doesn't already exist (similar to what is possible with Notepad++)?

From this:

enter image description here

To this:

enter image description here

Nicholas
  • 127
  • 2
  • 8
  • as far as I know the multi cursors can only be set where a single cursor could be. go to the end of the line(s), add a bunch of spaces, go to the begin of line and move the cursors to the required location, select to end of line and delete – rioV8 Mar 28 '20 at 03:43
  • There is no built-in way to do what you want. But see https://stackoverflow.com/questions/59793465/pad-selected-lines-to-cursor-position-in-vscode/59794113#59794113 for a pretty easy workaround. Let me know if you have any questions. – Mark Mar 28 '20 at 04:08
  • Thank you rioV8 and Mark. Those are both helpful suggestions – Nicholas Mar 30 '20 at 16:27

1 Answers1

6

There is this extension by Mike Moore

https://marketplace.visualstudio.com/items?itemName=yo1dog.cursor-align

First I install the above extension.

Test Test               <- Space here
even longer test text
testing

Selected multiple cursor as shown by |

Test Test               |
even longer test text|
testing|

Then in command pallet (ctrl+p) and (shift+>) I type Align Cusor. Else I use Alt+A. Giving you this desired result

Test Test               |
even longer test text   |
testing                 |
Brian
  • 494
  • 6
  • 8