Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix double asterisk formatting in JSDoc #42356

Merged
merged 3 commits into from
Jan 25, 2021

Conversation

armanio123
Copy link
Member

Fixes #33386.

It has the problem that still doesn't identify when the documentation starts with a single *. This issue already exists, and fixing it requires more thinking.

Let me know if this is acceptable for now.

@typescript-bot typescript-bot added the For Milestone Bug PRs that fix a bug with a specific milestone label Jan 15, 2021
Copy link
Member

@sandersn sandersn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you found the original reason for trailing tag parsing to start with BeginningOfLine, I think the better fix would be to switch the start state back to SawAsterisk in all cases except that one. Not sure the best way to do that -- maybe passing in initialMargin in almost all cases, or maybe adding some additional to decide what the start state should be, eg let state = isActualBeginningOfLine() ? BeginningOfLine : SawAsterisk

tests/cases/fourslash/quickInfoJsDocTextFormatting1.ts Outdated Show resolved Hide resolved
@@ -129,16 129,16 @@ verify.quickInfos({
3: ["(parameter) param1: string", "first line of param\n\nparam information third line"],

g: ["function g(param1: string): void", "This is firstLine\nThis is second Line"],
4: ["(parameter) param1: string", "param information first line"],
4: ["(parameter) param1: string", " param information first line"],
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Notice how this tests changed. Arguably this should be the right behavior. Let me know if you think otherwise.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think this is a good change, because it's preserving the parent indent.

Copy link
Member

@sandersn sandersn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, this fix further cuts down on the number of calls to parseTagComments, too.

@@ -129,16 129,16 @@ verify.quickInfos({
3: ["(parameter) param1: string", "first line of param\n\nparam information third line"],

g: ["function g(param1: string): void", "This is firstLine\nThis is second Line"],
4: ["(parameter) param1: string", "param information first line"],
4: ["(parameter) param1: string", " param information first line"],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think this is a good change, because it's preserving the parent indent.

@armanio123 armanio123 merged commit 871096b into microsoft:master Jan 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Milestone Bug PRs that fix a bug with a specific milestone
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

JS Doc parameter comment description drops leading star
3 participants