Skip to content

A simple VS Code extension to auto place brackets, semi colons, etc. outside of a string or parenthesis

License

Notifications You must be signed in to change notification settings

VasilVerdouw/smart-brackets

Repository files navigation

Increase your productivity

No more going to the end of the line before placing your semicolon or brackets!

You can easily write code without using your arrow keys like this:

Smart Brackets demo GIF

let example = "placed semicolon;"
void placedBrackets ( {})

Using Smart Brackets this will automatically be replaced to this:

let example "placed semicolon";
let placedBrackets () {} 

Like you intended to! No more manually moving the cursor and no more mistakes because you forgot to use the arrow keys!

Features

Currently Smart Brackets supports te following corrections:

Typing detection

All below operations will only be applied when you're typing! When moving the cursor to the position and deliberately placing the character Smart Brackets won't mess up your code.

If you actually meant to place a character a certain way and Smart Brackets moved it to the wrong position, just press ctrl + z (undo) to keep it your way.

Semicolon in string correction

// User placed
let example = "semicolon;"
example('semicolon;')
// Smart Brackets correction
let example = "semicolon";
example('semicolon');

Curly brackets in parenthesis correction

This operation is experimental and for that reason off by default.

Please provide feedback on GitHub if you encounter any issues with this operation or would like it to be enabled by default.

Only triggered when pressing (spacebar) and {(curly bracket) in that order.

// User placed
void example(bool isTrue {})
if (isTrue() {})
// Smart Brackets correction
void example(bool isTrue) {}

This operation doesn't trigger when you don't want it to. For example the following scenarios will not trigger the operation:

  • function(() {})
  • function(true, () {})
  • function(true, (() {}))
  • function((true, () {}))
  • function(() => {})
  • function(true, {})
  • Button(onPressed: () async {})
  • Button(onPressed: () => {})
  • function(test: {})

Semicolon in parenthesis correction

// User placed
example(;)
// Smart Brackets correction
example();

Other operations are W.I.P.

Extension Settings

Every feature can be turned on or off in the settings. Currently the following settings are available:

Please check the "Feature contributions" tab on this page

Known Issues

Please check all our issues on GitHub.

Contribution

All contributions are welcome and appreciated!

Please contribute new features on GitHub.

Check out the CONTRIBUTING file for more information.

About

A simple VS Code extension to auto place brackets, semi colons, etc. outside of a string or parenthesis

Topics

Resources

License

Stars

Watchers

Forks