Skip to content

Conversation

@Neonit
Copy link
Contributor

@Neonit Neonit commented Apr 10, 2020

This fixes two bugs in the parseJSDocCommentWorker().

  1. The initial indent was calculated wrongly. It was set to the
    difference between the index of the last newline or beginning of file
    and the current start marker (position of /**). By calculating it
    this way, the newline character itself is counted as indentation
    character as well. The initial indent is used as margin for the
    whole comment. The margin contains the amount of characters to skip
    before the actual content or payload of a comment line. The algorithm
    does not skip non-whitespace characters at the beginning of the
    content, but it would strip away one whitespace character for
    indented content (which does matter, if there is e.g. a Markdown
    code block with indentation in the comment).

  2. When reducing initial whitespace sequences of comment lines by the
    remaining margin the algorithm cut off one character too much. This
    might have been introduced to fix 1. It had a similar effect as 1.

Fixes #37717

This fixes two bugs in the parseJSDocCommentWorker().

1. The initial indent was calculated wrongly. It was set to the
   difference between the index of the last newline or beginning of file
   and the current start marker (position of /**). By calculating it
   this way, the newline character itself is counted as indentation
   character as well. The initial indent is used as margin for the
   whole comment. The margin contains the amount of characters to skip
   before the actual content or payload of a comment line. The algorithm
   does not skip non-whitespace characters at the beginning of the
   content, but it would strip away one whitespace character for
   indented content (which does matter, if there is e.g. a Markdown
   code block with indentation in the comment).

2. When reducing initial whitespace sequences of comment lines by the
   remaining margin the algorithm cut off one character too much. This
   might have been introduced to fix 1. It had a similar effect as 1.
@msftclas
Copy link

msftclas commented Apr 10, 2020

CLA assistant check
All CLA requirements met.

@sandersn sandersn merged commit c9f05af into microsoft:master Aug 4, 2020
@microsoft microsoft locked as resolved and limited conversation to collaborators Oct 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

For Backlog Bug PRs that fix a backlog bug

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Buggy Indentation in Markdown Code Blocks in IntelliSense Tooltips

4 participants