3 Tricks on VS Code

I've been using the first one since the last update.

The options are very minimal, but really helpful !! let me know how do you feel using them.

Enabling bracket pair colorization

settings.json
"editor.bracketPairColorization.enabled": true,
react-tables-example

Enabling Auto complete your sentence

settings.json
"editor.suggest.preview": true,
react-tables-example

Sorting code

keybindings.json
{
    "key": "shift+alt+s",
    "command": "editor.action.sortLinesAscending"
}

Running multiple actions using macros

Because this is still not native feature, I'm using the macros extension.

keybindings.json
{
    "key": "shift+alt+f",
    "command": "macros.fixDocumentAndSort",
    "when": "editorHasDocumentFormattingProvider && editorTextFocus && !editorReadonly && !inCompositeEditor"
}
settings.json
"macros": {
    "eslintFixAndFormatDocument": [
        "eslint.executeAutofix",
        "editor.action.formatDocument"
    ],
},

In this binding, vscode is performing two actions

  • formatting the document
  • fixing eslint issues.
0 view