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

PostCSS syntax highlighting is broken since v0.25.5 #191

Closed
sto3psl opened this issue May 19, 2021 · 13 comments
Closed

PostCSS syntax highlighting is broken since v0.25.5 #191

sto3psl opened this issue May 19, 2021 · 13 comments
Labels
question Further information is requested

Comments

@sto3psl
Copy link

sto3psl commented May 19, 2021

I noticed that since version 0.25.5 of Volar, the syntax highlighting of <style lang="postcss"></style> blocks is broken and doesn't highlight anything anymore.

When I remove lang="postcss" the highlighting works again (I assume because the block is now considered normal CSS), but now I get linting errors from Stylelint (because it assumes normal CSS).

I noticed in the changelog that you made a bunch of changes with language support, maybe that's why it broke for PostCSS.

v0.25.4 v0.25.7

0 25 4

0 25 7

@johnsoncodehk
Copy link
Member

johnsoncodehk commented May 19, 2021

You need to install additional extension for postcss syntax highlighting, because vscode do not built-in support postcss syntax highlighting, see https://github.com/johnsoncodehk/volar#note.

If you have not, in version 0.25.4 it's show incorrect syntax highlighting and it's bug.

@johnsoncodehk johnsoncodehk added the question Further information is requested label May 19, 2021
@sto3psl
Copy link
Author

sto3psl commented May 19, 2021

I know and have csstools.postcss installed. Since it's the first search result and has pretty big usage, I thought it would work.

Do you recommend another one?

@sto3psl
Copy link
Author

sto3psl commented May 19, 2021

I tried out ricard.postcss and cpylua.language-postcss just now. Only cpylua.language-postcss seems to work but it isn't maintained anymore. Maybe it keeps working but no idea why the other ones work fine with everything except .vue files.

@sto3psl sto3psl closed this as completed May 19, 2021
@johnsoncodehk
Copy link
Member

I'm not sure why, it seems to be related to this issue csstools/postcss-language#6.

@christhofer
Copy link

christhofer commented Sep 3, 2021

I'm switching to Volar now, and notice this issue too.

But when I try lang="pcss", it seems to be working just fine.

image

I don't know if there's any side effect using lang="pcss"instead of lang="postcss"
My program seems to be working fine in npm run dev

@johnsoncodehk
Copy link
Member

@christhofer <style lang="pcss"> just rollback to <style>, so it's syntax highlighting of lang="css".

@christhofer
Copy link

@johnsoncodehk
Seems to be different though
I got error with @apply using lang="css"

image

@johnsoncodehk
Copy link
Member

Syntax highlighting and language support is deal with separately.

<style> = css syntax highlighting + css language support
<style lang="postcss"> = postcss syntax highlighting + postcss language support
<style lang="pcss"> = css syntax highlighting + unknown style language support (no any supports)

@xymopen
Copy link

xymopen commented Jun 4, 2022

Sorry for bring up this thread. The reason for this seems to be that csstools.postcss uses source.css instead of source.postcss (which is used by vue.volar) as scope for PostCSS grammar.

@johnsoncodehk
Copy link
Member

johnsoncodehk commented Jun 4, 2022

@xymopen Can you remove lang="postcss" to resolve?

@xymopen
Copy link

xymopen commented Jun 4, 2022

@xymopen Can you remove lang="postcss" to resolve?

Yes. Using <style> alone does bring tokens defined by csstools.postcss. However CSS Language Server is not happy about that.

@johnsoncodehk
Copy link
Member

johnsoncodehk commented Jun 4, 2022

@xymopen Please try change css.lint.* settings in vscode and it may helps.

@me-vlad-k
Copy link

I still have the same problem in November 2024. In a Vue file with lang="postcss", everything is shown in plain white.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants