From 27f44d1cc3d733a38a736acb902f94879d99c76c Mon Sep 17 00:00:00 2001 From: Navee <77710362+DinDjarins@users.noreply.github.com> Date: Thu, 3 Oct 2024 14:22:16 +0530 Subject: [PATCH] verilator: show only diagnostics for current buffer (#668) Co-authored-by: Naveen Co-authored-by: Mathias Fussenegger --- lua/lint/linters/verilator.lua | 4 ++-- tests/verilator_spec.lua | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lua/lint/linters/verilator.lua b/lua/lint/linters/verilator.lua index fc01af59..0eea76b8 100644 --- a/lua/lint/linters/verilator.lua +++ b/lua/lint/linters/verilator.lua @@ -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, diff --git a/tests/verilator_spec.lua b/tests/verilator_spec.lua index 789779b4..59cbf004 100644 --- a/tests/verilator_spec.lua +++ b/tests/verilator_spec.lua @@ -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 @@ -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 = { @@ -66,5 +67,5 @@ describe('linter.verilator', function() }, } assert.are.same(expected, result[5]) - end) - end) + end) +end)