jevogel / SublimeLinter-contrib-modelsim

⚡👌 ModelSim vcom/vlog plugin for SublimeLinter. Linting for VHDL and Verilog/SystemVerilog.
MIT License
5 stars 2 forks source link

Multi-file support #7

Open DeeeeLAN opened 5 years ago

DeeeeLAN commented 5 years ago

This plugin works great until I tried to set it up for linting a testbench. I modified my arguments to compile the full testbench because per-file compiling doesn't work when there are class-based dependencies to be aware of.

Unfortunately, it dumps all the warnings and errors it finds into the current file.

It looks like the linter attempts to track files, but the regex doesn't match the layout of my logs:

** Error: ** while parsing file included at <don't care file>(114)
** at <actual file>(70): (vlog-2730) Undefined variable: 'foo'.

** Error: (vlog-13069) ** while parsing file included at<don't care file>(114)
** at <actual file>(71): near "super": syntax error, unexpected "SystemVerilog keyword 'super'".

** Warning: <other file who's warnings are showing up in my current file>(129): (vlog-2623) Undefined variable: bar.

Obviously this makes the regex more complicated because the vlog error code can go on either side of the file.

I tried editing the regex in linter.py to the following (with multiline on):

        r'\*\* ((?P<error>Error)|(?P<warning>Warning)): '
        r'((\(vlog-\d+\) )?\*\* while .*\n)*'
        r'((\*\* at )?((?P<file>.*)\((?P<line>\d+)\): ))?'
        r'(\(vlog-\d+\) )?'
        r'(?P<message>([^"\'\n]*(?P<quote>["\'])(?P<near>[^"\']+)(?P=quote))?.*)'

This works much better, but I still ended up with all the warning from other files in the main file.

Looking through the SublimeLinter issues, I came across the following: https://github.com/SublimeLinter/SublimeLinter/pull/1528

Changing ?P\<file> to ?P\<filename> fixed the multi-file issue for me.

The only issue that remained was because I am compiling the entire testbench, the tempfile doesn't work for me. A setting to disable that would be nice. It doesn't get in the way, but it creates unnecessary work.

Let me know if you have any questions.

jevogel commented 5 years ago

Hi DeeeeLAN, thanks for filing this issue. I've changed jobs recently and no longer work with these tools, but I welcome any improvements to the plugin. Feel free to create a pull request with the fixes you outlined, and a setting for disabling the tempfile setting if you want, and I will merge it.