microsoft / microsoft/PTVS

Auto commenting lines using LF or CRLF

Open
#7,598 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug P3
Dominant language
C#
Stars
2.6k
Forks
680
Avg merge
39m
Merged PRs (30d)
1

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the behavior in the Visual Studio editor using the LF line-ending setting and the caret positions shown in the issue. Trace the auto-commenting behavior from that reproduction; it is done when pressing Enter does not create mixed line endings or unexpectedly expand indentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.