VS Code Config
This is how I setup my VS Code. I mostly use it for reading/writing markdown and Go.
Note: This guide is heavily inspired by https://parsiya.io/configs/vscode/ and was originally made in early 2019. I have adopted it and changed it to my needs. Feel free to use as much as you like. Here you can download my vs-code-settings.json is always updated, regardless.
Quick Start Guide
- Install Go:
sudo pacman -S go
- Download and install VSCodium (optionally install Git when Codium asks).
- Copy paste the
settings.json
from the Github repository to user config (shortcutctrl + ,
). - Install
Go
extension and reload. - Open any file with
go
extension. When prompted, selectInstall All
. Wait until all tools are installed. - Optionally install the
Markdown All in One
extension and reload. - Now intellisense should work for Go and Markdown.
Extensions
Some useful extensions.
Go
golangci-lint
To enable golangci-lint set the following in config:
|
|
The next step might not be needed as VSCodium should ask you to do it when you open a go file.
run go get -v github.com/golangci/golangci-lint/cmd/golangci-lint
to install golangci-lint
by hand.
Next, open up any Go file and the extension will prompt you to install tools. Select all and tools will be installed.
Go Snippets
Go extension comes with some snippets. These snippets are at:
Markdown All in One
Helps with editing markdown.
|
|
Table of Content
Add the initial table of content: Press ctrl+shift+p
and type ctoc
in the
palette.
To ignore a heading and all its subheadings, add <!-- omit in toc -->
at the
end of the heading. This is useful for eliminating the top-level Github heading.
Just be sure that the rest of your headings are not subheadings for the top one
(e.g. if top heading is h1
, next heading should also be h1
). In this
document I have ignored the top heading VS Code Config
.
MarkdownLint
Linter for markdown.
You can disable specific rules in config:
|
|
GitLens
Adds Git Integration from eamodo. There is another one from entepe85, but who knows what that contains.
I have disabled some clutter:
|
|
LanguageTool for Visual Studio Code
This extension enables some grammar and spelling rules.
You must also install specific language supports. E.g. English:
Code Spell Checker
Enables spell check. You can add new words to it (they will be stored in user settings file):
VS Notes
VS Notes is a simple tool that takes care of the creation and management of plain text notes and harnesses the power of VS Code via the Command Palette.
General Settings
Press ctrl + ,
to open the config file. It supports intellisense/suggestions.
Disable git
Helps with performance inside VMs where I do not need git integration.
|
|
Markdown Settings
These settings only affect markdown files. VS Code has a recent bug where some
universal settings (e.g. quickSuggestions
) are not automatically applied to
some languages such as Markdown. These are added here.
|
|
Word Separator Note
Unlike Sublime, VS Code counts -
as word separator. In VS Code this is called
word pattern
. This means you will not get suggestions for this-long-word
.
The editor.wordSeparators
config setting does not have any effect on word
patterns:
|
|
Creating Snippets
Similar to other editors, you can create snippets in VS Code. Snippets are
stored in JSON files. To create a snippet for a specific language use File (menu) > Preferences > User Snippets
. Then select the language. In this case, I
will create some Markdown snippets, so I will select markdown.json
.
The JSON object is easy to read. The important parts are prefix
(which is the
trigger) and body
. Note that you do not need to enter new lines with \n
.
Simply create a new cell in the body array and it will be printed in a new line.
The following snippet will create a codefence.
|
|
${1:language}
means:
- It’s the first place where your cursor is after the snippet is activated.
- The default text is
language
.
After pressing tab, cursor will go to $2
and so on. After running out of
placeholders, final tab will land at $0
which is useful for leaving the
snippet without having to manually placing the cursor.
As another example, I have created two snippets for my Hugo shortcodes:
|
|