vsg-bridge-ls/doc/editor-configuration.md

3.1 KiB

Editor configuration

The bridge provides VSG diagnostics over standard-input/standard-output LSP. Formatting is a separate editor command that pipes the current buffer through the companion VSG fork.

Helix is the only actively maintained and tested integration. The Vim and VSCodium recipes are best-effort starting points and may need adjustment. Whichever editor you use, launch it from the activated VSG environment or set absolute paths for both executables.

Helix

Add this configuration to ~/.config/helix/languages.toml:

[language-server.vsg_bridge_ls]
command = "vsg_bridge_ls"

[[language]]
name = "vhdl"
language-servers = ["vsg_bridge_ls"]
auto-format = false
formatter = { command = "vsg", args = ["--stdin", "--stdout", "--fix", "-fp", "7", "--no-failure"] }

To use VSG configuration files, add arguments to the server entry. Repeat -c PATH for multiple files; relative paths are resolved from the project:

args = ["-c", "vhdl/config.yaml"]

If another VHDL server is installed, it can run alongside the bridge:

language-servers = ["vhdl_ls", "vsg_bridge_ls"]

Set auto-format = true only after testing the formatter on the project. Omitting -fp 7 allows more granular fix selection. Test alternate arguments in a terminal first:

vsg --stdin --stdout --fix -fp 7 --no-failure < vhdl/test.vhd

Vim (best-effort)

This example uses vim-lsp. With vim-plug, add the plugin and run :PlugInstall:

Plug 'prabirshrestha/vim-lsp'

Then register the bridge in .vimrc:

if executable('vsg_bridge_ls')
  au User lsp_setup call lsp#register_server({
        \ 'name': 'vsg_bridge_ls',
        \ 'cmd': {server_info->['vsg_bridge_ls']},
        \ 'allowlist': ['vhdl'],
        \ })
endif

Start Vim from the activated .venv. To pass a VSG configuration file, change the command to ['vsg_bridge_ls', '-c', 'vhdl/config.yaml'].

The bridge does not provide LSP document formatting. Configure VSG as an external formatter separately if formatting is required in Vim.

VSCodium (best-effort)

VSCodium has no built-in setting for arbitrary LSP commands. One possible adapter is Generic LSP Proxy, but it is not currently available from Open VSX. Build its VSIX locally:

git clone https://github.com/mjmorales/vscode-generic-lsp-proxy.git
cd vscode-generic-lsp-proxy
npm install
npm run compile
npx vsce package
codium --install-extension generic-lsp-proxy-*.vsix
cd ..

Create .vscode/lsp-proxy.json in the VHDL project:

[
  {
    "languageId": "vhdl",
    "command": "vsg_bridge_ls",
    "transport": "stdio",
    "fileExtensions": [".vhd", ".vhdl"]
  }
]

Launch the project from the activated environment with codium ., then open a VHDL file. If diagnostics do not appear, check Output: Generic LSP Proxy. Desktop and sandboxed VSCodium installations may require an absolute command path or other PATH adjustments.

The bridge does not provide LSP document formatting. Configure VSG as an external formatter separately if formatting is required in VSCodium.