vsg-bridge-ls/README.md

2.8 KiB

vsg_bridge_ls

A very featureless VSG to lsp bridge, allowing to use vsg as a linting lsp instead of an external diagnostic tool.

Install

Installing VSG

Install vsg either via pip on pip in your venv:

python -m venv venv
source venv/bin/activate (or activate.fish if you use fish etc...)
pip install vsg

Please note that if you decide to use a venv, you will need to activate your venv every time.

Installing VSG for formatting

You can instead install a fork of vsg allowing the use of vsg for piped formatting (with --stdout)

python -m venv venv
source venv/activate (or activate.fish if you use fish etc...)
# use either
pip install git+https://proxy.dandaedre.com/gitea/Dandaedre/vhdl-style-guide.git
# or
pip install https://proxy.dandaedre.com/gitea/Dandaedre/vhdl-style-guide/archive/master.zip
# or
pip install --index-url https://proxy.dandaedre.com/gitea/api/packages/Dandaedre/pypi/simple/ vsg

Older python version

There is a rebased version of the patch at:

pip install https://proxy.dandaedre.com/gitea/Dandaedre/vhdl-style-guide/archive/patch-garret.zip
# or
pip install --index-url https://proxy.dandaedre.com/gitea/api/packages/Dandaedre/pypi/simple/ vsg

Installing vsg_bridge_ls

cargo install --git https://proxy.dandaedre.com/gitea/Dandaedre/vsg_bridge_ls.git

Adding the lsp bridge to your editor

Helix

Add the following to your ~/.config/helix/language.toml (create this file if it doesn't exist)

[language-server.vsg_bridge_ls]
command = "vsg_bridge_ls"
args = ["-c", "vhdl/config.yaml"] # Optionnal config, note that the path is relative to your project

[[language]]
name = "vhdl"
scope = "source.vhdl"
file-types = ["vhd", "vhdl"]
comment-token = "--"
language-servers = [ "vhdl_ls", "vsg_bridge_ls" ]
indent = { tab-width = 2, unit = "  " }
injection-regex = "vhdl"

Formatting

Add the following lines at the end of the [[language]] entry to allow formatting with :format

auto-format = false  # true will autoformat
# Skipping -fp <1-7> will allow for a more granular fix
# Please note that -ap will not work with --fix, try this command out in your terminal first: cat vhdl/test.vhd | vsg --stdin --stdout --fix <your parameters>
formatter = { command = "vsg" , args = ["--stdin", "--stdout", "--fix", "-fp", "7", "--no-failure"] } 

Others

Check your editor documentation on how to add a lsp. Untested.

Developper Documentation