Stylus blocks are treated as CSS
See original GitHub issueHey! 👋
Describe the bug
I want to use stylus in my svelte components. Syntax highlighting is correct, but it seems the code is still treated as CSS. The code-completion is confused and I get a lot of errors regarding braces, like css(css-lcurlyexpected)
.
I followed this guide but that didn’t help and neither did disabling everything style-related in VS Code and the language tools.
It seems to me that the language tools don’t recognize stylus as a language yet.
To Reproduce
- Install “Svelte for VS Code” extension (svelte.svelte-vscode)
- Install “language-stylus” extension (sysoev.language-stylus)
- Create new svelte file with
<style lang="stylus">
tag
For example:
<style lang="stylus">
div
background #FFFFFF
width 290px
</style>
Expected behavior
- No errors or stylus related errors.
- No syntax completion or stylus syntax completion.
I don’t necessarily need all language features within this block (although it would be nice), but the css errors make working with svelte and stylus really hard.
Screenshots
System (please complete the following information):
- OS: macOS
- IDE: VSCode
- Plugin/Package: sveltePreprocess and the others mentioned above
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Stylus mixins block - css - Stack Overflow
I have a list of class paired with colors, I would like to set different properties ( color , background , border-color ,...
Read more >Getting To Know Stylus - SitePoint
Like Sass, Stylus is a CSS preprocessor which is written in Node.js. ... the width property of the current block, treating it as...
Read more >An Introduction to CSS Pre-Processors: SASS, LESS and Stylus
Browsers apply these specs while they are in proposal state with their special vendor prefixes. In some cases (as in background gradient), coding...
Read more >Why I Choose Stylus (And You Should Too)
Stylus Syntax · You can write in regular CSS syntax with curly brackets and the works if that's how you feel comfortable. ·...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yay, that did the trick! 🎉
I don’t know if you want to close this. IMHO some support for stylus would be nice, because svelte-preprocess supports it. But looking at veturs code, it seems adding full support for stylus might be comparatively complicated.
But maybe it’s possible to at least disable CSS language features, by as you said, adding ‘stylus’ here and add a check here as well, like:
TL;DR for humans that get CSS errors when using stylus in VS Code:
Diagnostics and autocompletion is now turned off when
lang="stylus"
.