Skip to content

Trim trailing whitespace #5023

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

Closed
wants to merge 1 commit into from
Closed

Trim trailing whitespace #5023

wants to merge 1 commit into from

Conversation

MartyIX
Copy link
Contributor

@MartyIX MartyIX commented Sep 29, 2015

Proposed fix for #4629

@msftclas
Copy link

Hi @MartyIX, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!

In order for us to evaluate and accept your PR, we ask that you sign a contribution license agreement. It's all electronic and will take just minutes. I promise there's no faxing. https://cla.microsoft.com.

TTYL, MSBOT;

@@ -53,3 +53,4 @@ internal/
.settings
.vscode/*
!.vscode/tasks.json
.idea/*
Copy link
Member

Choose a reason for hiding this comment

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

Is this for WebStorm?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it is actually for the family of IDEs from JetBrains - PhpStorm, WebStorm, etc.

@msftclas
Copy link

@MartyIX, Thanks for signing the contribution license agreement so quickly! Actual humans will now validate the agreement and then evaluate the PR.

Thanks, MSBOT;


let comments = getLeadingCommentsToEmit(node);

if (!comments || !comments[0].hasTrailingNewLine) {
Copy link
Member

Choose a reason for hiding this comment

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

Could you not just check multiLine for roughly the same emit?

Copy link
Member

Choose a reason for hiding this comment

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

Maybe @yuit could weigh in on this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the variable comments contains data like this [ { pos: 131, end: 177, hasTrailingNewLine: true, kind: 3 } ]. That's why I used hasTrailingNewLine.

@DanielRosenwasser
Copy link
Member

Hey @MartyIX, I'm not sure about this solution because we don't want to recalculate the leading comments for every list item (which involves a rescan and an array allocation for each node).

@yuit and I spent a good bit of time looking into alternative approaches, and while we got something that works decently, the complexity didn't seem worth it.

Overall, I think the gain from any sort of fix here is marginal. While I appreciate that you put the time into it, I think I'm going to mark the original issue as Won't Fix. If you'd like, there are a couple of useful bugs that we'd really appreciate fixes for like #3886.

@MartyIX
Copy link
Contributor Author

MartyIX commented Sep 30, 2015

I see

@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants