Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Update 'convert to raw string' to help cleanup strings with leading whitespace #60936
Update 'convert to raw string' to help cleanup strings with leading whitespace #60936
Changes from 2 commits
3ccb3ab
3dea3af
1bb19c8
e903b0c
e321516
3e03360
5a27103
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Large diffs are not rendered by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this check be moved up and prevent the fix from being offered? I can't think of why someone would have a bunch of whitespace is a verbatim string, but offering to convert it to an empty string is probably not what they want to happen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fair point. Updated to not offer in that case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wasn't this done here?
https://github.com/dotnet/roslyn/pull/60936/files#diff-0428e947f9429e42713669adec6cd527db6d211b4197c9fdf2b6af0cf55cd77aR190
We can't add more trailing whitespace as part of skipping the common ones can we?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's slightly different. the first loop is removing entirely blank lines. The last loop is removing any trailing newline from the last line (which is not an allwhitespace line (since htat would have already been removed)).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could this just be an int?
Where you consume the current line text up until either the current 'common' index or a non-whitespace char?
Or maybe just a simple extension to virtual char that is
GetFirstNonWhitespaceIndex
and then compare the indices? Think that could replace some other helpers (AllWhitespace
) as wellThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'll see if i can do that! :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, this can't be an int. if it's an int, we can't distinguish spaces/tabs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we care about cases of mixed tabs/spaces?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm ok with thsi only trimming off the part it is certain is shared across the files. If you mix tabs/spaces... well... that's either rare or bizarre, and i'm ok ignoring :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should virtualcharsequence have a split extension that takes in the characters to split on?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
possibly. though
\r\n
would be a PITA to have to deal with :(There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah good point
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.