nvim-lint icon indicating copy to clipboard operation
nvim-lint copied to clipboard

Source as a top-level option

Open AckslD opened this issue 3 years ago • 2 comments

Would it be possible to have the source as a top-level option to the linter rather than to be part of the parser function?

In this way it would be easier to reuse an existing linter configuration, for example as:

lint = require('lint')
lint.linters.mylinter = copy_tbl(lint.linters.mypy)
lint.linters.mylinter.source = 'mylinter'

AckslD avatar Jan 26 '22 12:01 AckslD

Can you elaborate why you would like to customize the source names?

mfussenegger avatar Jan 27 '22 16:01 mfussenegger

At work we use a custom command to run effectively typing check using mypy. So the error formats etc are the same. I could of course setup a custom linter by copying whats in lint.linters.mypy but it would be cleaner if I can just reuse that code as above (and update cmd and args). I do want to give it a different name though to distinguish it from the standard mypy.

AckslD avatar Jan 27 '22 17:01 AckslD

Can you elaborate why you would like to customize the source names?

I'd like to be able to easily fetch all the diagnostic sources attached by nvim-lit and call vim.diagnostic.reset() if some condition is fulfilled. Adding a prefix to the name in my case would help me separate sources from e.g lsp.

zapling avatar Sep 21 '23 14:09 zapling

This seems rather an edge case, I may change my mind around this but currently I have no plans to support this.

(Note that wrapping the parse function and post-process the result is currently an option)

mfussenegger avatar Oct 12 '23 08:10 mfussenegger