/wrap

📦 vscode extension to wrap selection with symbols/pattern

Primary LanguageTypeScriptMIT LicenseMIT

Wrap selection

This plugin allows you to wrap one or multiple selections with symbol/combination of symbols. You can find it in marketplace

Installation

Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter:

ext install konstantin.wrapSelection

Usage

Select something → ctrl+shift+P → «Wrap selected text»

or

press ', ", «, ], < or ) — both opening or closing symbol would work

features

Predefined patterns

Through «Wrap selected text» you can also use multiple symbols, i.e.:

  • {{ → {{text}}
  • <!-- → <!--text-->
  • <% → <%text%>

Custom user patterns

user patterns

You can also do custom patterns through your settings:

{
	"wrapSelection.patterns": {
		"log": "console.log(`${text}`, ${text})",
		"promise": "new Promise((yeah, nah) => yeah(${text}))",
		"=>": "() => ${text}"
	}
}

And then you can do ctrl+shift+P → «Wrap selected text» → log:

selection

will become

console.log(`selection`, selection);

Found a bug?

Create a ticket here or insult me at mail[at]konstantin[dot]io