Skip to content

Align gutter width with old compiler #517

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

Merged
merged 1 commit into from
Mar 12, 2025

Conversation

haoqixu
Copy link
Contributor

@haoqixu haoqixu commented Mar 12, 2025

tsc 5.8.2:

tsc

Before:

before

After:

after

@haoqixu
Copy link
Contributor Author

haoqixu commented Mar 12, 2025

Comment on lines 92 to +93
hasMoreThanFiveLines := lastLine-firstLine >= 4
gutterWidth := len(strconv.Itoa(lastLineOfFile + 1 + len("")))
gutterWidth := len(strconv.Itoa(lastLine + 1))
Copy link
Member

Choose a reason for hiding this comment

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

For reference, the original code is:

    const hasMoreThanFiveLines = (lastLine - firstLine) >= 4;
    let gutterWidth = (lastLine + 1 + "").length;
    if (hasMoreThanFiveLines) {
        gutterWidth = Math.max(ellipsis.length, gutterWidth);
    }

So your fix is definitely correct; the + "" was a conversion.

@RyanCavanaugh RyanCavanaugh added this pull request to the merge queue Mar 12, 2025
Merged via the queue into microsoft:main with commit 8e79d45 Mar 12, 2025
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants