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

Do not show full screen error dialog for syntax errors and HMR #13220

Closed
4 tasks done
cpojer opened this issue May 16, 2023 · 5 comments
Closed
4 tasks done

Do not show full screen error dialog for syntax errors and HMR #13220

cpojer opened this issue May 16, 2023 · 5 comments
Labels
enhancement New feature or request

Comments

@cpojer
Copy link
Contributor

cpojer commented May 16, 2023

Description

I auto-save while typing in VS Code with a 30ms debounce delay. When I have VS Code and my browser side-by-side, the error dialog flashes a lot while typing because in-progress typing usually contains syntax errors. This can be a jarring and distracting experience, especially since VS Code already highlights syntax errors.

Suggested solution

Show a smaller secondary banner near the window edges when an HMR update cannot be applied due to a syntax error.

Alternative

Do not process HMR updates when there are syntax errors and silently hide them – this may be confusing to some people.

Additional context

This was discussed on Discord and it was recommended that I create an issue for it.

Validations

@patak-dev
Copy link
Member

I think this is a good idea. We may need to introduce a new option to let people choose the overlay style. For reference, we started to discuss about the need for alternative error overlay designs in the context of runtime errors before: #6274 (comment)

@bluwy
Copy link
Member

bluwy commented May 17, 2023

You could also disable the error overlay with server.hmr.overlay to hide it entirely. The errors will still be shown in the terminal. I'm not really sure if we need to maintain a separate overlay style for this case, ideally Vite should stick to one.

Maybe we could consider redesigning it in a next major if a less intrusive overlay is more desirable. (but I feel like the current one is also fine)

@patak-dev
Copy link
Member

That is a good point. I completely overlooked setting server.hmr.overlay to false. Let's try then to redesign the overlay for Vite 5 to be less intrusive and we may not need the option as you suggest. @manucorporat also wanted to propose a few more additions to the current component to make it fully customizable so as you proposed in Discord, instead of the option, there could be userland plugins with different styles as we aren't going to be able to please everyone.

@bluwy
Copy link
Member

bluwy commented Sep 19, 2023

Closing this in favour of server.hmr.overlay: false

@bluwy bluwy closed this as not planned Won't fix, can't repro, duplicate, stale Sep 19, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Oct 4, 2023
@patak-dev
Copy link
Member

For future reference, the next VS Code version will have files.autoSaveWhenNoErrors that will fix the original issue:

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants