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

Highlighting "flickering" while applying formatting #64

Open
jonkri opened this issue May 24, 2020 · 2 comments
Open

Highlighting "flickering" while applying formatting #64

jonkri opened this issue May 24, 2020 · 2 comments

Comments

@jonkri
Copy link

jonkri commented May 24, 2020

Under some circumstances, lines lose their syntax highlighting for a while when formatting is applied.

The attached image illustrates it.

demo

I would like for the text not to temporarily turn to the foreground color.

@keithgabryelski
Copy link

prettier mode needs to request re-highlighting after changing the buffer. If you execute: M-x web-mode when highlights are broken, it will fix the highlights. To do this automatically after prettier does its thing:

(eval-after-load 'web-mode
    '(progn
       (add-hook 'web-mode-hook #'add-node-modules-path)
       (add-hook 'after-save-hook #'web-mode)
       (add-hook 'web-mode-hook #'prettier-js-mode)))

@jonkri
Copy link
Author

jonkri commented Jul 2, 2020

@keithgabryelski:

Thanks for your suggestion, but my problem isn't that the highlight becames broken in a way that the code snippet above fixes. My problem is the "flickering". For a fraction of a second, all the text turns to the foreground color (after which the syntax highlighting is restored automatically, with or without the code snippet that you posted). I would like to avoid this "flickering", if possible, so that the code is always rendered using the correct syntax highlighting, during all milliseconds. 🙂

I hope that clarifies my problem!

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

No branches or pull requests

2 participants