Slang verilog Linter: set default searchpath and output filename (#4999)

* Sets module search path to file directory for slang/verilog linter

Similar to iverilog behaviour.
See 699c0dbe80

Reasonable default behaviour, can be changed by adding '-y%s:h' to
`b:ale_verilog_slang_options` buffer variable.

* Adds filename to slang/verilog linter output

slang can parse other files based on the modules instances names find in
the current file and returns warning/error messages related to those
files that have the same pattern.

Adding the file name to the outputs avoid polluting the active buffer
with those messages.

* Absolute paths in slang/verilog linter messages

Otherwise temp files are not correctly detected
This commit is contained in:
Tarik Graba
2025-07-20 12:27:25 +02:00
committed by GitHub
parent 0d1d0a9f81
commit e670c9781c
3 changed files with 8 additions and 3 deletions

View File

@@ -8,12 +8,14 @@ Execute(The slang handler should parse lines correctly):
AssertEqual
\ [
\ {
\ 'filename' : 'foo.sv',
\ 'lnum': 11,
\ 'col': 1,
\ 'type': 'W',
\ 'text': 'extra '';'' has no effect [-Wempty-member]',
\ },
\ {
\ 'filename' : 'bar.sv',
\ 'lnum': 24,
\ 'col': 12,
\ 'type': 'E',
@@ -22,5 +24,5 @@ Execute(The slang handler should parse lines correctly):
\ ],
\ ale_linters#verilog#slang#Handle(bufnr(''), [
\ 'foo.sv:11:1: warning: extra '';'' has no effect [-Wempty-member]',
\ 'foo.sv:24:12: error: cannot mix continuous and procedural assignments to variable ''data_o''',
\ 'bar.sv:24:12: error: cannot mix continuous and procedural assignments to variable ''data_o''',
\ ])

View File

@@ -5,10 +5,10 @@ After:
call ale#assert#TearDownLinterTest()
Execute(The default slang command should be correct):
AssertLinter 'slang', 'slang -Weverything -I%s:h %t'
AssertLinter 'slang', 'slang -Weverything --diag-abs-paths -I%s:h -y%s:h %t'
Execute(slang options should be configurable):
" Additional args for the linter
let g:ale_verilog_slang_options = '--define-macro DWIDTH=12'
AssertLinter 'slang', 'slang -Weverything -I%s:h --define-macro DWIDTH=12 %t'
AssertLinter 'slang', 'slang -Weverything --diag-abs-paths -I%s:h -y%s:h --define-macro DWIDTH=12 %t'