-
-
Notifications
You must be signed in to change notification settings - Fork 209
VSCode Extension: Errors/Warnings don't refresh (or are incorrect) if there is an unused CSS selector, when using PostCSS #1019
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
Comments
The cause of this seems to be because some svelte diagnostics, like unused-export-let or css-unused-selector, can't be source mapped back to the original position. But there might be multiple causes of the source mapping issue. I think we can at least place it at the start of the file to avoid diagnostics not getting updates. |
I can't reproduce this yet. What I see though is that because of |
A preprocess without a source map might reproduce the problem I mentioned. |
Try to catch some cases of invalid ranges which may cause the LSP to get confused and not update diagnostics anymore sveltejs#1019
Try to catch some cases of invalid ranges which may cause the LSP to get confused and not update diagnostics anymore #1019
Version 105 of the extension was released where I tried to be more robust about possibly invalid mappings. Please let me know if that fixed it or if the issue still persists. |
Version 105 seeems to fix my issue too. Thanks for the quick fix |
Describe the bug
I stumbled over a weird error, where the errors/warnings (aka the yellow and red squiggly lines in the editor) are not updated (or are incorrect), if I use
svelte-preprocess
with PostCSS and have an unused Selector in the CSS.Screenshot so it's a bit clearer what I'm talking about:
My
svelte.config.js
:Example component:
The bug doesn't happen if I comment out
postcss: true
. I tried removing all my PostCSS plugins, but that didn't change the behavior. Additionally, I noticed that I don't actually get a warning for the unused CSS selector in VSCode at all. (I do get it when I runsvelte-check
, so the basic functionality should be there?)I hope I provided any relevant information here, but I'm glad to clarify anything that's unclear.
To Reproduce
Steps to reproduce the behavior:
svelte-preprocess
withpostcss: true
<style>
tag that contains at least one unused CSS selectorUnexpected token
error in unexpected placesExpected behavior
<style>
tagScreenshots
Toggle, because they are pretty large
I start from this working example: Svelte can correctly identify that I did in fact define
a
before using it. It can also tell that thediv
is a used selector in this context.And if I change the variable name from
a
tob
, it correctly warns me:If I then change the CSS selector to something that's not used in the component, it still warns me:
But if I then change the variable name back from
b
toa
, it still warns me:In fact, it will not correctly refresh the warnings/errors and be pretty confused, no matter what I do:
System
The text was updated successfully, but these errors were encountered: