Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for different linter command #192

Open
rkshthrmsh opened this issue Feb 23, 2023 · 1 comment
Open

Support for different linter command #192

rkshthrmsh opened this issue Feb 23, 2023 · 1 comment

Comments

@rkshthrmsh
Copy link

rkshthrmsh commented Feb 23, 2023

Currently, the configuration only has an option to enable or disable the linter:

# linter can be enabled (true) or disabled (false)
[option]
linter = true

Is there support for passing a different linter command to svls? For example, maximum line length checks are enabled using a shell wrapper to svlint: https://github.com/dalance/svlint/blob/master/MANUAL.md#test-each-file-for-excessively-long-lines. How can this feature be used from svls?

@DaveMcEwan
Copy link
Contributor

This isn't exactly part of svls, but you can do something like this.

I am using Vim with the vim-lsp plugin, so this is normally in my ~/.vimrc:

if executable('svls')
    au User lsp_setup call lsp#register_server({
        \ 'name': 'svls',
        \ 'cmd': {server_info->['svls']},
        \ 'whitelist': ['systemverilog'],
        \ })
endif

When I want to use a different command, like svls --debug or with the SVLINT_CONFIG environment variable, I create a small wrapper script.

First, let's call it /path/to/script/svls-alt:

#!/usr/bin/env bash
SVLINT_CONFIG="/path/to/config/alt.toml" svls --debug $*

Second, I set the executable flag and add it to the PATH in my terminal:

$ chmod +x /path/to/script/svls-alt
$ export PATH="/path/to/script:$PATH"

Third, I update my ~/.vimrc to call the script instead of the svls binary:

if executable('svls-alt')
    au User lsp_setup call lsp#register_server({
        \ 'name': 'svls-alt',
        \ 'cmd': {server_info->['svls-alt']},
        \ 'whitelist': ['systemverilog'],
        \ })
endif

Now, if I want to change the command (or run additional commands), then I can edit /path/to/script/svls-alt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants