-
-
Notifications
You must be signed in to change notification settings - Fork 209
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
Question: Weird behavior with stdin=true #501
Comments
Just tried it and #502 works fine for me? |
still won't work, will try to make a minimally reproducible example |
There's two things that I noticed:
|
ok I'm beginning to think I'm misunderstanding something crucial. Why use
sidenote: haven't gotten a working MRE yet ;-; |
local root = vim.fn.fnamemodify("~/.repro", ":p")
-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end
-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"--single-branch",
"https://github.com/folke/lazy.nvim.git",
lazypath,
})
end
vim.opt.runtimepath:prepend(lazypath)
-- install plugins
local plugins = {
-- do not remove the colorscheme!
"folke/tokyonight.nvim",
-- add any other pugins here
{
"mfussenegger/nvim-lint",
version = "*",
config = function()
require('lint').linters_by_ft = {
json = { 'jq' },
gitcommit = { 'gitlint' },
}
vim.api.nvim_create_autocmd({ "BufEnter", "TextChanged", "InsertLeave", "BufWritePost" }, {
callback = function()
vim.notify("Tried to lint: " .. math.random())
require("lint").try_lint()
end,
})
end
}
}
require("lazy").setup(plugins, {
root = root .. "/plugins",
})
-- add anything else here
vim.opt.termguicolors = true
-- do not remove the colorscheme!
vim.cmd([[colorscheme tokyonight]])
to test set your git $EDITOR to |
I too am noticing that gitlint is not working via nvim-lint's stdin. When using the following config: return {
cmd = 'gitlint',
stdin = true,
args = { '--debug' },
stream = 'stderr',
ignore_exitcode = true,
parser = require('lint.parser').from_pattern('(.*)', { 'message' }),
} I see the following within the returned message:
Looking at https://github.com/jorisroovers/gitlint/blob/4d9119760056492eabc201bfad5de2f9e660b85f/gitlint-core/gitlint/cli.py#L174 leads me to believe that nvim-lint is not communicating with gitlint through stdin. The details for gitlint's stdin usage is listed in that same file in the function above. For comparison, efm does seem to work with gitlint via stdin (as configured here: https://github.com/creativenull/efmls-configs-nvim/blob/main/lua/efmls-configs/linters/gitlint.lua). |
Interesting.. seems like a good time to mention that |
I wanted gitlint to lint without saving the file, so I checked that it supported reading from stdin, and enabled it in the config (plus disabled appending the filename etc.).
It didn't work, I got no diagnostics, so to debug it I replaced gitlint's
cmd
with a script that simply logs it's stdin to~/LOG
. It was always empty, nothing was appended. It was being run successful as nvim-lint could read it's output (just a simple echo "something") and could read it's exit code (if I addedexit 1
to the script it reported that the linter failed to run).I also tried writing arbitrary messages to it's stdin here:
but still could not see anything.
(also for a sanity check I tried another linter that supports stdin,
jq
and it worked fine)I'm kinda stumped on what's going wrong here :|, any ideas?
The text was updated successfully, but these errors were encountered: