Each language should have the following 3 components:
- The language server.
- The formatter.
- The linter.
Each component has a binary and a vscode extension.
First of all, install the go compiler by following the official doc https://go.dev/doc/install.
Install the official go language server binanry gopls
:
go install golang.org/x/tools/gopls@latest
Install the official vscode plugin vscode-go. This plugin can automatically install the gopls
binary too.
We are going to use gofumpt
-style formatting instead of the default gofmt
, first install it:
go install mvdan.cc/gofumpt@latest
Then add the following configuration to settings.json
:
"editor.formatOnSave": true,
"files.autoSave": "onFocusChange",
"go.formatTool": "gofumpt",
"gopls": {
"formatting.gofumpt": true
}
Choose staticcheck
as the Go linter. First install it:
go install honnef.co/go/tools/cmd/staticcheck@latest
Then add the following configuration to settings.go
:
"go.lintTool": "staticcheck",
"go.lintOnSave": "file",
First of all, install the Rust compiler and cargo:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly
Choose rust-analyzer
because it is much better than the official language server rls
.
First install its binary:
rustup component add rust-src rust-analyzer-preview
Then install its vscode extension matklad.rust-analyzer. This plugin can automatically install the rust-analyzer
binary too.
rust-analyzer
is the formatter by default.
rust-analyzer
is the linter by default.
First of all, install the solc
:
brew install solidity
The solc
has a --lsp
parameter, which makes it a language server.
So we only need to install the vscode extension JuanBlanco.solidity.
"[solidity]": {
"editor.defaultFormatter": "JuanBlanco.solidity"
},
First, install the binary solhint
,
brew install solhint
Then add the following configuration to settings.json
:
"solidity.linter": "solhint",
First of all, we need to install a Python interpreter, I prefer anaconda::
brew install --cask anaconda
We choose the Microsoft pylance
as the Python language server.
First, install the ms-python.python extension.
This extension can automatically install the Pylance
binary, and it also install the Pylance and Jupyter extensions.
Then add the following configuration to settings.json
:
"python.languageServer": "Pylance",
"python.analysis.typeCheckingMode": "strict",
Use black
as the formatter, install it first:
conda install black -c conda-forge
Then add the following configuration to settings.json
:
"python.formatting.provider": "black",
Use pylint
as the linter, install it first:
conda install pylint -c conda-forge
Then add the following configuration to settings.json
:
"python.linting.pylintEnabled": true,