Skip to content
| Marketplace
Sign in
Visual Studio Code>Keymaps>Auto Add Brackets in String InterpolationNew to Visual Studio Code? Get it now.
Auto Add Brackets in String Interpolation

Auto Add Brackets in String Interpolation

Ali Ariff

|
136,038 installs
| (13) | Free
Automatically add complete brackets when writing interpolated string
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

vscode-auto-add-brackets

Test Release

This extension will automatically add complete brackets when writing interpolated string.

This solution inspired from sublime text behaviour.

Demo GIF

Language Support

By default the following languages are enabled:

  • Coffeescript
  • Crystal
  • Dart
  • Elixir
  • Embedded Crystal
  • ERB
  • Groovy
  • Haml
  • Javascript
  • Javascript React
  • Javascript Vue
  • Kotlin
  • Ruby
  • Scala
  • Slim
  • Typescript
  • Typescript React

Adding other languages

You can enable other languages yourself by doing the following:

{
  // VSCode settings ...

  "auto.languages": {
    // The key is the languageId for the language (see notes)
    "typescript": {
      // Symbol used for string interpolations in the language
      "symbol": "$",
      // Type of quotes that surround strings that can be interpolated in the language
      "stringWrapper": "`"
    },
    "ruby": {
      "symbol": "#",
      "stringWrapper": "\""
    }
  }
}

note that the key in the configuration object should be a languageId supported by VSCode

Then add the keybind for the language:

{
  // Keybindings ...

  {
    "command": "auto.addInterpolation",
    "key": "shift+3",
    "when": "editorTextFocus && editorLangId == 'YOUR_LANGUAGE_ID'"
  },
}

If you are a Vim mode user you should also add vim.mode != 'Normal' && vim.mode != 'Visual' && vim.mode != 'VisualBlock' && vim.mode != 'VisualLine' to your "when" clause

Related issue:

vscode-ruby/#200

vscode-ruby/#210

Credits

Icons made by Icon Monk from www.flaticon.com is licensed by CC 3.0 BY

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft