Pustelto / Bracketeer

VS Code extension for easy and quick manipulation with brackets and quotes.
https://marketplace.visualstudio.com/items?itemName=pustelto.bracketeer
MIT License
34 stars 9 forks source link
brackets editor quotes swap-brackets swap-quotes vscode vscode-extension

Bracketeer

‼️ IMPORTANT INFO

Unfortunately due to family reasons, I don't have time to maintain the extension and react to all the feedback in some reasonable time. The extension is stable and working, but there are bugs and edge cases I would like to address. If you want to help me with it, feel free to contact me. I don't plan to scratch the extension as I use it a lot myself. But I don't have the resources to move it forward and fix the bugs.

Thanks for understanding


Bracketeer gives you brackets and quotes superpowers at the tip of your fingers. Easily swap bracket/quote types, remove them or select their content from within with one command. No need to select content of the bracket/quote or move your cursor. Works even on multiple selections.

Extension should work with different languages, but if you encounter error, please let know and I will try to fix it.

Feedback and PRs are welcome. Enjoy the plugin.

Features

Bracketeer currently provide four commands to manipulate with brackets and their equivalents for quotes. All commands work on multiple selections as well.

Brackets

Swap brackets/Replace brackets with...

Swap brackets: Shift+Cmd+Alt+K Replace brackets with...: Shift+Cmd+Alt+U

This command allows you to switch to different bracket types from within the brackets without need to select them. You can either cycle through them or use Quick pick menu to select correct bracket immediately.

Swap brackets Swap brackets with multiple cursors

Remove brackets

Keyboard shortcut: Shift+Cmd+Alt+I

This command will delete closest brackets

Delete brackets

Select brackets content

Keyboard shortcut: Shift+Cmd+Alt+H

With the help of this command you can easily select content of the brackets, Calling this command again will select brackets as well. This can be chained to select outer brackets (and perform some actions on them).

Select brackets content

Quotes

Swap quotes/Replace quotes with...

Swap quotes: Shift+Cmd+Alt+; Replace quotes with...: not assigned by default

This command allows you to switch to different quote types from within the quotes without need to select them. You can either cycle through them or use Quick pick menu to select correct quote type immediately.

Swap quotes Change quotes to specific type

Remove quotes

Keyboard shortcut: Shift+Cmd+Alt+'

This command will delete enclosing quotes

Delete quotes

Select quotes content

Keyboard shortcut: Shift+Cmd+Alt+0

With the help of this command you can easily select content of the quotes, Calling this command again will select quotes as well. Unlike bracket alternative, selection won't expand more after selection of the quotes.

Select quotes content

How does it work

Since VS Code does not provide extension API for working with language (grammar) tokens. In order to make this extension I'm using Prism.js to parse the documents. This has some edge cases but mostly work pretty well. This extension have language-definitions.json file which contains brackets/quotes sets for given language and token types used to identify brackets/quotes in text (by Prism). For more detail have a look into source code. This file contains only small set of languages I'm using. If there is not language definition for your language of choice extension will default to JS (it works... usually).

If your language of choice is missing in definitions file and you would like to contribute please feel free to submit a PR. But test first that it is working, I will test it myself as well before merging.

Known Issues

Road map

In no particular order:

Release Notes

See changelog

License

MIT