Hi,
I'm a big fan of neovim (emacs users jump to 'emacs:' ;-). neovim has support for the Language Server Protocol and there is a nice plugin called 'null-ls' [1] which allows you to hook linters and formatters into neovim.
I've added support for rpmspec in 'null-ls' so you can get feedback directly while editing a spec file. See the attached screenshot.
How to configure it:
``` local ok, null_ls = pcall(require, 'null-ls') if not ok then return end local sources = {}
if vim.fn.executable('rpmspec') == 1 then table.insert(sources, null_ls.builtins.diagnostics.rpmspec) end
null_ls.setup({ debug = false, sources = sources, }) ```
What is currently missing in rpmspec is support to parse the input form stdin instead of a file [2]. But there is already a PR to support it [3].
Best regards
Andreas
[1] https://github.com/jose-elias-alvarez/null-ls.nvim/ [2] https://github.com/rpm-software-management/rpm/issues/1926 [3] https://github.com/rpm-software-management/rpm/pull/1928
emacs: There is a general purpose LSP called diagnostic-language-server [4] you can use to achieve the same with emacs-lsp.
`dnf install nodejs-diagnostic-languageserver`
On Tue, Feb 22, 2022 at 8:50 AM Andreas Schneider asn@redhat.com wrote:
Hi,
I'm a big fan of neovim (emacs users jump to 'emacs:' ;-). neovim has support for the Language Server Protocol and there is a nice plugin called 'null-ls' [1] which allows you to hook linters and formatters into neovim.
I've added support for rpmspec in 'null-ls' so you can get feedback directly while editing a spec file. See the attached screenshot.
How to configure it:
local ok, null_ls = pcall(require, 'null-ls') if not ok then return end local sources = {} if vim.fn.executable('rpmspec') == 1 then table.insert(sources, null_ls.builtins.diagnostics.rpmspec) end null_ls.setup({ debug = false, sources = sources, })
What is currently missing in rpmspec is support to parse the input form stdin instead of a file [2]. But there is already a PR to support it [3].
`rpmspec -P /dev/stdin` seems to work already now. I use this "trick" all the time with programs that don't support stdin/stdout natively. (Sometimes even that doesn't work, e.g. if the program tries to seek or mmap it, but often it does.)
Best regards
Andreas
[1] https://github.com/jose-elias-alvarez/null-ls.nvim/ [2] https://github.com/rpm-software-management/rpm/issues/1926 [3] https://github.com/rpm-software-management/rpm/pull/1928
<snip>
On Tuesday, February 22, 2022 9:29:49 AM CET Ondrej Mosnacek wrote:
What is currently missing in rpmspec is support to parse the input form stdin
instead of a file [2]. But there is already a PR to support it
[3].
`rpmspec -P /dev/stdin` seems to work already now. I use this "trick" all the time with programs that don't support stdin/stdout natively. (Sometimes even that doesn't work, e.g. if the program tries to seek or mmap it, but often it does.)
I think it only works if a shell is involved. If I try it rpmspec reports:
error: Unable to open /dev/stdin: No such device or address
as lua does execv() on rpmspec.
On Tuesday, February 22, 2022 7:41:16 PM CET Artur Frenszek-Iwicki wrote:
error: Unable to open /dev/stdin: No such device or address
How about "/proc/self/fd/0"?
Nope doesn't work ... /dev/stdin is a symlink to /proc/self/fd/0. I wonder if this is only available with a shell ...
On 2/23/22 08:54, Andreas Schneider wrote:
On Tuesday, February 22, 2022 7:41:16 PM CET Artur Frenszek-Iwicki wrote:
error: Unable to open /dev/stdin: No such device or address
How about "/proc/self/fd/0"?
Nope doesn't work ... /dev/stdin is a symlink to /proc/self/fd/0. I wonder if this is only available with a shell ...
That has nothing to do with the shell. It's a kernel filesystem thing. You could try executing a shell script that dumps the available file descriptors to see what's happening.