This tool is a Verilog IEEE 1364-2005 language
server written in
Nim. The parsing is handled by the
vparse
library.
Visual Studio Code using the vls-vscode
extension.
- Supported protocol features
- Installation
- Editor integration
- Configuration
- Building
- Version numbers
- Reporting a bug
- License
- Third-party dependencies
- workspace/executeCommand
- workspace/configuration
- workspace/didChangeConfiguration
- textDocument/didChange
- textDocument/didClose
- textDocument/didOpen
- textDocument/completion
- textDocument/hover
- textDocument/signatureHelp
- textDocument/declaration
- textDocument/definition
- textDocument/references
- textDocument/documentHighlight
- textDocument/documentSymbol
- textDocument/rename
-
Download the latest release archive that targets your platform.
-
Extract the archive to a persistent location and make the binary file available on the system path.
If you're on Linux and your distribution supports
.deb
packages, choosing that method (installing viadpkg
) takes care of this for you. -
Set up your editor (which will need to have a built-in language server client) to use
vls
as the language server for Verilog files. There's a few examples on how to do this in the section on editor integration.
If none of the release packages targets your platform, refer to this section for information on how to build the language server from the source code.
To update to a later release, perform steps 1 and 2 above. Make sure to replace
the old binary file (the dpkg
method handles this for you).
Install the vls-vscode
extension.
https://github.com/prabirshrestha/vim-lsp
augroup vim_lsp_vls
autocmd!
autocmd User lsp_setup call lsp#register_server(
\ {
\ 'name': 'vls',
\ 'cmd': {server_info->['vls', '--force-diagnostics']},
\ 'whitelist': ['verilog'],
\ })
augroup END
https://github.com/natebosch/vim-lsc
let g:lsc_server_commands['verilog'] = 'vls --force-diagnostics'
Emacs (lsp-mode)
(use-package lsp-mode
:hook (verilog-mode . lsp)
:commands lsp)
(use-package company-capf
:config (push 'company-capf company-backends))
(use-package verilog-mode
:defer t
:config
(require 'lsp)
(lsp-register-client
(make-lsp-client :new-connection (lsp-stdio-connection '("vls"))
:major-modes '(verilog-mode)
:priority -1
))
:hook (verilog-mode . (lambda()
(lsp)
(flycheck-mode t)
(add-to-list 'lsp-language-id-configuration '(verilog-mode . "verilog")))
Emacs (Eglot)
(defun verilog-eglot-hook ()
(company-mode)
(yas-minor-mode 1)
(eglot-ensure)
(add-to-list 'eglot-server-programs '(verilog-mode . ("vls"))))
(add-hook 'verilog-mode-hook 'verilog-eglot-hook)
The language server is configured with a
TOML file that's parsed by the
vltoml
library.
When a text document is opened by the client (textDocument/didOpen
request),
the server looks for a configuration file. The search process walks from the
directory of the input file up to the root directory looking for one of the
following files (listed in the order of precedence):
.vl.toml
vl.toml
.vl/.vl.toml
.vl/vl.toml
vl/.vl.toml
vl/vl.toml
In short, the configuration file can have two different names: .vl.toml
or
vl.toml
and can reside immediately on the ascended path, or inside a directory
named: .vl/
or vl/
. Refer to the README of the
vltoml
library for information about the
structure and contents of the configuration file.
The instructions below won't work until I've made the dependencies available via Nim's package manager.
If none of the release packages targets your platform, you can still build and use this tool provided that you have a C compiler that targets your platform.
-
Download and install the Nim compiler and its tools.
-
Clone this repository and run
nimble install
This will build the binary and add it to the path.
Releases follow semantic versioning to determine how the version number is incremented. If the specification is ever broken by a release, this will be documented in the changelog.
If you discover a bug or what you believe is unintended behavior, please submit an issue on the issue board. A minimal working example and a short description of the context is appreciated and goes a long way towards being able to fix the problem quickly.
This tool is free software released under the MIT license.