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: caret position was incorrect #14984

Merged
merged 5 commits into from
Nov 15, 2023
Merged

Conversation

sapphi-red
Copy link
Member

@sapphi-red sapphi-red commented Nov 14, 2023

Description

generateCodeFrame was generating a incorrect caret position when column was 0.

close #14381
fixes #14312
refs #8747

Also fixes/improves some other things:

  • esbuild error position was a bit wrong:

    Before

    Unterminated string literal
    1  |  export const bar = 'bar
       |                         ^
    2  |  
       |  ^
    

    After

    Unterminated string literal
    1  |  export const bar = 'bar
       |                         ^
    2  |  
    
  • add end position for parse5, postcss, dynamic import warning:

    Before

    1  |  <head>
    2  |    <noscript><noscript></noscript></noscript>
       |              ^
    3  |  
    4  |  </head>
    

    After

    1  |  <head>
    2  |    <noscript><noscript></noscript></noscript>
       |              ^^^^^^^^^^
    3  |  
    4  |  </head>
    

Additional context


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines, especially the Pull Request Guidelines.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Update the corresponding documentation if needed.
  • Ideally, include relevant tests that fail without this PR but pass with it.

@sapphi-red sapphi-red added the p3-minor-bug An edge case that only affects very specific usage (priority) label Nov 14, 2023
@sapphi-red sapphi-red marked this pull request as draft November 14, 2023 15:36
Copy link
Member

@patak-dev patak-dev left a comment

Choose a reason for hiding this comment

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

This is awesome! I think it would be good to still merge it as part of Vite 5 to get all the tests in the major. I'll wait for @bluwy to merge it though in case we want to freeze at the latest beta already.

Copy link
Member

@bluwy bluwy left a comment

Choose a reason for hiding this comment

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

Looks great! I think we can merge it straight away too

@bluwy bluwy merged commit 2b4e793 into vitejs:main Nov 15, 2023
11 checks passed
@sapphi-red sapphi-red deleted the fix/generate-code-frame branch November 15, 2023 07:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Caret in on-screen error output points to the wrong line
3 participants