I have spent a lot of time by aligning the table columns in the Gherkin files. This new feature tries to address this problem: whenever you type a pipe (|) character in a table that has at least two rows, it realigns the table columns. Here are the rules for the aligning:
- the column widths are calculated based on the cell texts (header and body) without starting/ending whitespaces
- the cell values are aligned to the left with a single padding space
- there is at least one padding space on the right
- the indentation whitespaces of the header row are repeated for the subsequent rows
- comment lines between table rows are handled
The formatting is applied only to the table (parts) before the typed pipe character, simply because of technical reasons: it was easier to preserve the current cursor position this way. Though this sounds a bit weird, this should be still natural if you type in the table row-by-row. If you want to reformat an existing table, just simply re-type the last pipe character.
If the automatic formatting is not something you like, you can either press “Undo” after you typed in the pipe, or you can disable this feature from Tools / Options / SpecFlow.