'VSCode setting or extension for SCSS to autoformat brackets and place cursor
I recently changed my VSCode settings to stop suggestions and someone disabled a setting for SCSS files, where I could type
.example {}
hit return and this would automatically change to
.example {
//cursor positioned here
}
I cannot figure out how to restore this setting, losing my mind trying to find extensions or suggestions. Please help!
Solution 1:[1]
Specifically about your question
As mentioned in the comments by @Brad, it may be related to settings. However, the disabled setting may be in your settings.json file, which can have configuration not seen in the settings editor.
The easiest way to get to it is by using the command palette. The shortcut is cmd+p on a mac or ctrl+p in windows, and you can search for settings:
in the settings.json file, you can have language-specific settings. Look for something tied to scss, which would have brackets around it. My guess is that you may have one or more of these commands set to false:
You may also need to check your workspace settings as well, because they can have settings active for a single folder. Using the command-palette again, you can find it by typing "workspace"
A more general suggestion
I would recommend against turning off such a broad feature as code suggestions. They can be very helpful, and although this is a personal choice, learning to use them to your advantage can be highly productive in VS Code. One of the perhaps underused features of vscode is the ability to have custom snippets for any given language.
In order to achieve the behavior described in your answer, for example, I would configure a snippet like this:
"StackOverflow Answer": {
"prefix": "dotexample",
"body": [
".example {",
"\t$0",
"}"
],
"description": "Creates a .example selector"
}
Then, in any scss file I would simply type the value found in the prefix property above, and I would see my snippet:
by using the tab key, I would then have those lines of code defined in the snippet, with my cursor placed in the position I want to type in:
This code took me 10 seconds to configure, and three keyboard keys to insert. If you type it often, it can be a huge productivity booster!
Anyway, like I said, personal preferences vary. But the more you learn about your IDE, the better your usage choices will be.
Good luck!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Felipe |





