cursor-alignAligns all of the cursors/selections into a vertical line by inserting whitespace. A very simple, quick, easy, and agnostic way to align code/text however you want. Spaces are used by default, but tabs can also be used. The "auto" version will automatically use tabs or spaces based on your indentation settings. Consider rebinding the default Extension Commands
Implementation DetailsNote: A "cursor" is actually a selection with a length of 0. Inserts whitespace to the left of selections until all the selection starts are aligned with the right-most selection start. Adds whitespace to the end of selections until all selections are the same length as the longest selection. If there are multiple selections per line. Selections are grouped into columns from left to right. All selections within a column are aligned with each other. If tabs are used for alignment, the start and end of all selections are aligned with tab stops. CaveatsMultiline selections don't make much sense with this tool. As such they are ignored. alt+a Not Working?If instead of aligning cursors a character is inserted or nothing happens, the default If you continue to have problems, please open a new issue here. Known IssuesSee Issues. Why are extra tabs being inserted?Aligning using tabs is a bit more complicated than spaces due to the requirement that tabs must start and end at tab stops in order to be aligned. As such, in some scenarios it may seem as though unneeded tabs are being inserted. However, these tabs are indeed necessary to ensure the rule "the start and end of all selections are aligned with tab stops." Emojis/nonstandard characters mess up alignment.This is due to an underlying issue with vscode: microsoft/vscode#100730 There is no way to know how wide a character will be when displayed in vscode. It is completely up to the render engine with many environmental variables involved (font, ligatures, grapheme clustering, etc.). A character may even have a fractional width! Thus, there are some scenarios that are simply impossible to align correctly. For example, this emoji 👨👩👦👦 is actually 7 characters: On the flip side, the Japanese Kanji for man 男 is the single character Release NotesSee CHANGELOG.md |