microsoft / PTVS

Python Tools for Visual Studio
https://aka.ms/PTVS
Apache License 2.0
2.53k stars 676 forks source link

Auto commenting lines using LF or CRLF #7598

Open cwebster-99 opened 1 year ago

cwebster-99 commented 1 year ago

When typing a comment and Enter is pressed when there's text following the caret position, the next line is automatically commented, but these lines are inserted using CRLF, creating a mess when various IDEs that find this mix and convert it implicitly to LF or CRLF, so the entire file is changed, creating numerous merge conflicts.

Here's an example. Select LF as the line ending in the bottom right corner in the editor and place the caret as shown below and press Enter.

#    v-- place typing caret here, press Enter
# ABC <-- may be a space without this comment - same behavior
#

Observe how line endings in the bottom right corner are changed to MIXED. If there is no text following the caret, it ignores multiple levels of indentation and jumps to the first position, so in a class with methods, a ton of indentation needs to be introduced.

cwebster-99 commented 1 year ago

Ref https://github.com/microsoft/PTVS/issues/7594