Difficulty with Autocompletion for SCSS Variables in Visual Studio Code
I'm facing challenges with getting proper autocompletion for SCSS variables in Visual Studio Code. I have a separate SCSS file where I store all my variables (_variables.scss), and I'm importing them into another file (style.scss). However, despite using @use access these variables, the autocomplete doesn't seem to work efficiently.
Is there a recommended extension or configuration to enable accurate autocompletion for SCSS variables across files in Visual Studio Code? Currently, I'm manually referencing variables like variables.$variableName, which becomes cumbersome with a growing number of variables.
Any guidance or suggestions to streamline the autocompletion process for SCSS variables would be greatly appreciated!
If someone could provide an example of how to use SCSS and CSS variables in separate files while ensuring autocomplete works in VSCode, I'd greatly appreciate it.
3 Replies
i use this extension: mrmlnc.vscode-scss
also, if you use sass/scss, i recommend you to use index files
you have a
_variables.scss
file
instead, have a config
folder, and add an index.scss
file which @import
your variables (yes, yes, i know), then you just @import
the config file in your top most file that you compile to a css fileThank you very much for the quick response. I'm really grateful for your help; it finally works, something I've looked into several times but never managed to find the answer to. Isn't '@import' an outdated feature that's not widely supported anymore? I see '@use' as the replacement in the documentation. However, as you mentioned, I've created a 'config' folder within 'styles' in Next.js and named it 'index.scss'.
_variables.scss
config/index.scss
global.scss
What are your thoughts on this? Thank you in advance for the assistance! Have a wonderful day! 🔥
honestly? you didn't reduce the components folder as well
and don't use something called "config" to include typography and components