VScode extended

As I did in the past for Atom, here is a post on extensions for VScode.

More extensions for more powers

I’ll try to list my installed extensions by reverse order of personal use.

Note for Codium users
Some extensions of marketplace.visualstudio are not available in analog Codium store (open-vsx.org)
But 99% of the time you can then download the VSIX if the plugin on the marketplace page
Then in Codium, go to extension toolbar > suspensions dots at upper right ... > Install from VSIX


My top usage

python quick print
AhadCove.python-quick-print

Nothing worse than relentlessly type print(“variable”, variable).
You need to add a shortcut manually in your keybindings (look for extension.print).
I used alt + P, you can add it directly to your keymap.json with this:

1
2
3
4
5
    {
        "key": "alt+p",
        "command": "extension.print",
        "when": "editorTextFocus"
    },

Bracket-select
chunsen.bracket-select

alt + A / alt + Z extend selection to quotes, bracket, parenthesis and other pairs.
Can’t live without it!
Note: When the word is not surrounded by delimiters I use ctrl + shift+ spacebar to extend, but I think it was added by the sublime extension (listed below)

bracket-select demo

Transpose
v4run.transpose

ctrl + T swap two selected words, or two letters around cursor if no selection.

Transpose demo

any-swap
wolray.any-swap

alt + ]/[ swap elements according to their separators, easily flip pair variable = valeur.

any-swap demo

Blender Development
JacquesLucke.blender-development

Launch Blender from VScode console with debugger / break point / clickable error line…
Tick Allow Modify External Python in plugin preferences if package do not install correctly If needed package still ont install (ex: debuggy failed to install ) Blender probably don’t have pip.
In this cases run the following lines in blender text editor or console:

1
2
3
import sys, subprocess
pybin = sys.executable # get blender python
subprocess.call([pybin, '-m', 'ensurepip']) # ensure pip is installed

Tips: In prefs, you can also tick reload on save Ctrl + S

Increment Selection
albymor.increment-selection

Win\Linux: ctrl + alt + i, Mac: cmd + alt + i
More practical than it seems, for example to lay zeros in multi cursors then generate incrementation.

increment selection demo

Selected Lines Count
gurumukhi.selected-lines-count

Show line count in the bottom bar, because this should be default.

GitLens
eamodio.gitlens

A Swiss-army-knife for Git that does too many things to list them here.

Diff
fabiospampinato.vscode-diff

Add right-click menu entry to compare visible editors or current editor with clipboard’s text, and more.
Absolutely needed.

Diff demo

Toggle Boolean alt + B
silesky.toggle-boolean

This might seem pushing the laziness a bit far, but it’s actually enjoyable to flip values with a shortcut: True <-> False, true <-> false, yes <-> no, on <-> off, 0 <-> 1

Insert Date String
jsynowiec.vscode-insertdatestring

Because we always need to insert a date time in a changelog or else.

Todo Tree
Gruntfuggly.todo-tree

A useful extension to use some keywords as bookmark.
A lot of customizations are available, so look at the doc.

Not a big fan of default settings though (like highlighting keywords).
Here are my own preferences, you can add to settings using Ctrl+shift+P > settings.json:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
    "todo-tree.highlights.enabled": false,
    "todo-tree.general.tags": [
        "BUG",
        "HACK",
        "FIXME",
        "TODO",
        "XXX",
        "[ ]",
        "[x]"
    ],
    "todo-tree.regex.regex": "(//|#|<!--|;|/\\*|^|^\\s*(-|\\d+.))\\s*($TAGS)",

Note that extension Bookmarks (alefragnani.Bookmarks) allow to create bookmarks without adding any keywords in to files.

Spell Right
ban.spellright

Ctrl + . to have proposition for underline possible error.
Sometimes we write natural languages in dev oriented editors. Like this post, written in markdown right in VScode! And that’s why it’s nice to enable some dictionaries.

In the same spirit: LTeX – LanguageTool grammar/spell checking (valentjn.vscode-ltex) using language tool.


From time to time

change-case
wmaurer.change-case

Ctrl+Shit+P > change case

you suddenly decide to conform code to pep-8 but you should edit or your Class definitions ?
No worries!

change case demo

awarest-align
awarest.awarest-align

Align elements on a multiline selection. multiple methods are proposed:
First Occurrence, Each Occurrence, Transpose Lines, Transpose List, Transpose HTML

awarest-align demo

For very specific alignement needs, there is also a similar plugin based on regex:

Align by RegEx
janjoerke.align-by-regex

align-by-regex demo

Or an alternative based on multi-cursor alignment.

Cursor Align
yo1dog.cursor-align

Copy Swapper
berickson324.copyswapper

Win/Linux : ctrl + shift + v ; Mac : cmd + shift + v Swap selection with paperclip


Passive utilities

Calc
raidou.calc

Integrated calculator, solve math operation after laying down the =. Not even needed to select text and call eval with Emmet .

change case demo

Draw.io Integration
hediet.vscode-drawio

Create nice diagran to explain things directly in VScode.

draw.io demo

SVG Previewer
vitaliymaz.vscode-svg-previewer

Add SVG preview, so you can read your previously exported diagram ;)

svg previewer demo

Rainbow CSV
mechatroner.rainbow-csv

Separated value coloration for CSV and exports options.

rainbow csv demo

Sublime Text Keymap and Settings Importer
ms-vscode.sublime-keybindings

Because I’m so used to Sublime Text shortcuts.
The extension seem to add some features and/or shortcuts that aren’t in vanilla VScode.

Ctrl + K > Ctrl + U and Ctrl + K > Ctrl + L for Upper / Lower case, super useful.


Alternative method of installation

The simple way is to install using dedicated toolbar search, but extensions can also install through command line interface using plugin’s Id (author.name)

code --install-extension AhadCove.python-quick-print (add --force to avoid prompts).
If you’re on codium (well done!), replace code with codium.

Installation can also happen with a palette command (ctrl+maj+p) in VScode using keyword ext:

ext install AhadCove.python-quick-print

Bonus : A lithe python script you can use to generate a list of name + link to page from installed plugins.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import subprocess
import urllib.request
import re

exts = subprocess.check_output(['code', '--list-extensions'], shell=True) 
ext_l = exts.decode().split()

base_url = 'https://marketplace.visualstudio.com/items?itemName='

for eid in ext_l:
    url = base_url + eid
    with urllib.request.urlopen(url) as response:
        html = response.read().decode()
        res = re.search(r'<meta property="og:title" content="(.*?)&#32;-&#32;Visual&#32;Studio&#32', html)
        if res:
            title = res.group(1)
            title = title.replace('&#32;', ' ')

            ## choose what to print
            # print(title)
            # print(f'{title} -> {url}')
            print(f'{title} -> {eid} -> {url}')
        else:
            print(f'Not found for {eid}')

Thanks to Swann Martinez and Xavier Petit for discussing extensions usage.

Without extensions, it starts faster. But with it goes further (From knowledgeable devs wisdoms).