Skip to content

Commit

Permalink
verilator: show only diagnostics for current buffer (#668)
Browse files Browse the repository at this point in the history
Co-authored-by: Naveen <[email protected]>
Co-authored-by: Mathias Fussenegger <[email protected]>
  • Loading branch information
3 people authored Oct 3, 2024
1 parent 5cda078 commit 27f44d1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lua/lint/linters/verilator.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local pattern = "^%%(.-)-?(%u*): .-:(%d+):(%d+): (.*)"
local pattern = "^%%(.-)-?(%u*): (.-):(%d+):(%d+): (.*)"

local groups = { "severity", "code", "lnum", "col", "message" }
local groups = { "severity", "code", "file", "lnum", "col", "message" }

local severities = {
["Error"] = vim.diagnostic.severity.ERROR,
Expand Down
7 changes: 4 additions & 3 deletions tests/verilator_spec.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
describe('linter.verilator', function()
it('can parse the output', function()
local parser = require('lint.linters.verilator').parser
local bufnr = vim.uri_to_bufnr('file:///t.v')
local result = parser([[
%Warning-DECLFILENAME: t.v:24:8: Filename 't' does not match MODULE name: 'uart'
24 | module uart
Expand Down Expand Up @@ -30,7 +31,7 @@ describe('linter.verilator', function()
64 | uart_tx
| ^~~~~~~
%Error: Exiting due to 3 error(s), 3 warning(s)
]], vim.api.nvim_get_current_buf())
]], bufnr, '')
assert.are.same(6, #result)

local expected = {
Expand Down Expand Up @@ -66,5 +67,5 @@ describe('linter.verilator', function()
},
}
assert.are.same(expected, result[5])
end)
end)
end)
end)

0 comments on commit 27f44d1

Please sign in to comment.