--- title: Editor Integration - Visual Studio Code permalink: editors-vscode.html created_at: 2021-06-18 22:00:00 +0200 last_modified_at: 2021-06-18 22:00:00 +0200 --- # Integration with Visual Studio Code In order to invoke *boxes* from Visual Studio Code, we need a Visual Studio Code plugin that can invoke filter programs. Several of those exist. For this example, we use [Filter Text](https://marketplace.visualstudio.com/items?itemName=yhirose.FilterText) by *yhirose*. It hasn't been updated for a while, but worked fine for us. 1. Install the [Filter Text](https://marketplace.visualstudio.com/items?itemName=yhirose.FilterText) extension into your Visual Studio Code. 2. In your settings.json, add the following configuration: ```json "filterText.commandList": [ { "name": "Boxes Peek (create)", "description": "Add a 'peek' box around selected text", "command": "boxes -d peek -p h1 -s 118 -i none -n UTF-8" }, { "name": "Boxes Peek (mend)", "description": "Repair a 'peek' box", "command": "boxes -d peek -p h1 -s 118 -i none -n UTF-8 -m" } ] ``` This snippet defines two invocations of *boxes*, one for adding a new box, and one for repairing it. The [options]({{ site.baseurl }}/boxes-man-1.html#OPTIONS) passed to *boxes* do this:
Option | Meaning |
---|---|
-d peek |
Choose the peek box design. |
-p h1 |
Add a space to the left and right of the text. Looks better. |
-s 118 |
Always make the box 118 characters wide. The boxes look better when all are the same width. |
-i none |
Do not indent box or text, always start at the left side. |
-n UTF-8 |
Tell boxes that the input is UTF-8 encoded text. Adjust if you use a different encoding. |
-m |
Mend box. Tells boxes that we want a repair instead of a new box. |