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

Feature request: shadow file / temporary file as when `stdin = false`

Open FelipeLema opened this issue 1 year ago • 3 comments

Hi, there

Great plugin you got going. I like it that it's easy to configure and/or extend since it's written in lua.

One thing I'm missing is being able to use a temporary file when stdin = false (namely, with mypy). This way I don't need to save my file to get lint the current buffer.

I think I can implement this if maintainers are open to dealing with ~~opening pandora's box~~ this rather complicated feature. My belief is that, while it may lead to lots of corner cases, these can and will be covered through usage within few months (ie: this is a feature that'll take some time to stabilize)

see https://github.com/neomake/neomake/commit/4bb03bf7343357f241b763018a078ed6f3d163e1

FelipeLema avatar Aug 01 '22 21:08 FelipeLema

I think this wouldn't be too hard and I could imagine that something like this would then also make it possible to run linters on portions of a file identified by tree-sitter injections/language-trees (e.g. you could lint a python block in a markdown document with the python linters)

I'm overall open to this, but seeing some upvotes to gauge interest would help

mfussenegger avatar Oct 16 '22 10:10 mfussenegger

Is this the reason why if, as in the GIF, I run ruff,mypy and pylint for python files then I need to save the file for both pylint and mypy to run whereas ruff runs automatically? If that's the case then it is indeed something needed/useful since, for instance, the quickfix get initially popluated by ruff, then when I save the file it add the pylint/mypy stuff but when I delete the unused variable there is lag and it still show mypy/pylint warnings (even though the variable is not there)

nvinlintagain

petobens avatar Oct 05 '23 21:10 petobens

If anyone is looking to do this, conform is a similar plugin which managed to implement this feature. Their README says

-- Send file contents to stdin, read new contents from stdout (default true)
-- When false, will create a temp file (will appear in "$FILENAME" args). The temp
-- file is assumed to be modified in-place by the format command.```

dante0624 avatar Feb 24 '24 00:02 dante0624