question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Stylus blocks are treated as CSS

See original GitHub issue

Hey! 👋

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

  1. Install “Svelte for VS Code” extension (svelte.svelte-vscode)
  2. Install “language-stylus” extension (sysoev.language-stylus)
  3. 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 Screenshot of Problem

System (please complete the following information):

  • OS: macOS
  • IDE: VSCode
  • Plugin/Package: sveltePreprocess and the others mentioned above

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
JulianGaiblercommented, Oct 4, 2020

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:

if (shouldExcludeCompletion(kind)) {
    return null;
}

TL;DR for humans that get CSS errors when using stylus in VS Code:

"svelte.plugin.css.completions.enable": false
"svelte.plugin.css.diagnostics.enable": false
0reactions
dummdidummcommented, Oct 15, 2020

Diagnostics and autocompletion is now turned off when lang="stylus".

Read more comments on GitHub >

github_iconTop Results From Across the Web

@block | Stylus
Expressive, robust, feature-rich CSS language built for nodejs.
Read more >
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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found