fix: Remove extra whitespace in the untitled editor label#108039
Merged
bpasero merged 1 commit intomicrosoft:masterfrom Oct 6, 2020
Merged
fix: Remove extra whitespace in the untitled editor label#108039bpasero merged 1 commit intomicrosoft:masterfrom
bpasero merged 1 commit intomicrosoft:masterfrom
Conversation
Contributor
Author
|
Some Updates:
|
Contributor
Author
|
Is there any issue happened in pipline of test? It seems like it cannot process normally. @bpasero |
bpasero
requested changes
Oct 5, 2020
| if (this.configuredLabelFormat === 'content' && !this.hasAssociatedFilePath && this.cachedModelFirstLineWords) { | ||
| return this.cachedModelFirstLineWords; | ||
| // Normalize multiple whitespaces to a single whitespace for the untitled editor label | ||
| const normalizedFirstLineWords = this.cachedModelFirstLineWords ? this.cachedModelFirstLineWords.replace(/\s+/g, ' ') : ''; |
Member
There was a problem hiding this comment.
Why is this not done at the point where we cache the name?
vscode/src/vs/workbench/services/untitled/common/untitledTextEditorModel.ts
Lines 369 to 372 in 50d9f05
Contributor
Author
There was a problem hiding this comment.
Update: Normalized when cached the first line words.
bpasero
requested changes
Oct 5, 2020
| if (modelFirstWordsCandidate !== this.cachedModelFirstLineWords) { | ||
| this.cachedModelFirstLineWords = modelFirstWordsCandidate; | ||
| // Normalize multiple whitespaces to a single whitespace for the untitled editor label | ||
| this.cachedModelFirstLineWords = modelFirstWordsCandidate ? modelFirstWordsCandidate.replace(/\s+/g, ' ') : ''; |
Member
There was a problem hiding this comment.
I would put this after the .trim() call here:
Because then we do a good check modelFirstWordsCandidate !== this.cachedModelFirstLineWords
Thanks!
Contributor
Author
There was a problem hiding this comment.
Update: remove extra spaces after trim first line text.
Member
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.

This PR fixes #107979
Normalize multiple whitespaces to a single whitespace for the untitled editor label:
Before:

After:
