vivekmalneedi / veridian

A SystemVerilog Language Server
MIT License
134 stars 15 forks source link
language-server lsp-server systemverilog verilog

veridian

build GitHub

A SystemVerilog Language Server\

Installation

Pre-Installation

Install from Release

Install from Source

# install with slang feature, if C++17 compiler is available
cargo install --git https://github.com/vivekmalneedi/veridian.git --all-features
# install if C++17 compiler is not available
cargo install --git https://github.com/vivekmalneedi/veridian.git

Usage

neovim

local lspconfutil = require 'lspconfig/util'
local root_pattern = lspconfutil.root_pattern("veridian.yml", ".git")
require('lspconfig').veridian.setup {
    cmd = { 'veridian' },
    root_dir = function(fname)
        local filename = lspconfutil.path.is_absolute(fname) and fname
        or lspconfutil.path.join(vim.loop.cwd(), fname)
        return root_pattern(filename) or lspconfutil.path.dirname(filename)
    end;
}

vscode

coc.nvim

In coc-settings.json:

{
  "languageserver": {
    "veridian": {
      "command": "veridian",
      "filetypes": ["systemverilog", "verilog"]
    }
}

Emacs

(require 'verilog-ext)
(verilog-ext-mode-setup)
(verilog-ext-eglot-set-server 've-veridian) ;`eglot' config
(verilog-ext-lsp-set-server 've-veridian)   ; `lsp' config

The full list is on the wiki

Configuration

In veridian.yml:

# list of directories with header files
include_dirs:
  - inc1
  - inc2
# list of directories to recursively search for SystemVerilog/Verilog sources
source_dirs:
  - src
  - src2
# if true, recursively search the working directory for files to run diagnostics on
# default: true
auto_search_workdir: true|false,
# verible tool configuration
verible:
  # verible-verilog-syntax configuration
  syntax:
    # default: true if in path
    enabled: true|false,
    path: "verible-verilog-syntax"
    # default: none
    args:
      - arg1
      - arg2
  # verible-verilog-format configuration
  format:
    # default: true if in path
    enabled: true|false,
    path: "verible-verilog-format"
    # default: none
    args:
      - arg1
      - arg2
verilator:
  # verilator configuration
  syntax:
    # default: true if in path
    enabled: true|false,
    path: "verilator"
    # default: specified below
    args:
      - --lint-only
      - --sv
      - -Wall
# set log level
# default: Info
log_level: Error|Warn|Info|Debug|Trace

LSP Support

See the LSP Specification for more details

Alternatives

The Verible project is working on a language server for SystemVerilog, check it out here