feat: verilog lsp

This commit is contained in:
DACHXY 2025-04-26 21:15:41 +08:00
parent d6e8e23d3b
commit 8772b124fa
4 changed files with 39 additions and 5 deletions

View file

@ -5,6 +5,18 @@ return {
formatters_by_ft = {
json = { "prettierd", "prettier", stop_after_first = true },
jsonc = { "prettierd", "prettier", stop_after_first = true },
verilog = { "verible" },
},
formatters = {
verible = {
command = "verible-verilog-format",
args = { "-" },
range_args = function(self, ctx)
return { "--lines", ctx.range.start[1] .. "-" .. ctx.range["end"][1] }
end,
stdin = true,
cwd = require("conform.util").root_file({ ".git" }),
},
},
},
},

View file

@ -100,7 +100,7 @@ return {
root_dir = function(fname)
return vim.fs.dirname(vim.fs.find(".git", { path = fname, upward = true })[1])
end,
cmd = { "svls" },
cmd = { "verible-verilog-ls", "--rules_config_search" },
filetypes = { "verilog", "systemverilog" },
},
},

View file

@ -0,0 +1,24 @@
local pattern = "[^:]+:(%d+):(%d+):(%w+):(.+)"
local groups = { "lnum", "col", "code", "message" }
return {
{
"mfussenegger/nvim-lint",
opts = {
linters_by_ft = {
-- verilog = { "verible" },
},
linters = {
verible = {
cmd = "verible-verilog-lint",
stdin = false,
args = { "--rules_config_search" },
stream = nil,
ignore_exitcode = false,
env = nil,
parser = require("lint.parser").from_pattern(pattern, groups),
},
},
},
},
}

View file

@ -44,6 +44,8 @@ in
prettierd
black
# SystemVerilog
verible
];
programs.neovim = {
@ -87,10 +89,6 @@ in
taplo
zls
vscode-js-debug
# SystemVerilog
svls
svlint
];
plugins = with pkgs.vimPlugins; [