Closed pauldesmondparker closed 5 months ago
Seeing some weird behaviors on my end aswell. For now I'm using both nvim-lint
and ale
with explicit configs so they don't compete on the same linters
return {
{
"mfussenegger/nvim-lint",
opts = {
linters_by_ft = {
-- solidity = {"solhint"}
},
},
},
{
"dense-analysis/ale",
init = function()
vim.cmd("let g:ale_linters = {'solidity': ['solhint']}")
vim.cmd("let g:ale_linters_explicit = 1")
vim.cmd("let g:ale_echo_cursor = 0")
end,
},
}
But I agree that there is something weird with how solhint behaves in nvim-lint
. Haven't got the time but maybe have a look at what ale
is doing differently (ale seems to be working fine on my end)
Could you try and see if the stdin:write
calls return any errors?
E.g. by applying a change like:
diff --git a/lua/lint.lua b/lua/lint.lua
index 934bab1..e3ce4f7 100644
--- a/lua/lint.lua
+++ b/lua/lint.lua
@@ -364,11 +364,13 @@ function M.lint(linter, opts)
local linter_proc = setmetatable(state, linter_proc_mt)
linter_proc:start_read()
if linter.stdin then
local lines = api.nvim_buf_get_lines(0, 0, -1, true)
for _, line in ipairs(lines) do
- stdin:write(line .. '\n')
+ local _, err = stdin:write(line)
+ assert(not err, err)
+ stdin:write('\n')
end
stdin:write('', function()
stdin:shutdown(function()
stdin:close()
end)
I'm no longer seeing the issue.
Problem
On certain *.sol files, although the buffer is written to
stdin
, the spawnedsolhint stdin
process doesn't process thatstdin
to thestdout
, and hence the function created by theread_output
factory never receives a non-null chunk.Sometimes the lint works immediately, sometimes I need to call the linter several (ten or more sometimes) to get results through into the
chunk
.Debugging Attempts
stdin
(buffer contents, no issue)chunk
(shows that when it doesn't work, it's because there is no non-null chunk)start_read
call to after allstdin:write
calls.solhint stdin
, skippingstdin
completely.:%!solhint stdin
manually. Never fails.stdin:write
cat filename.sol | npx solhint stdin
. No issue.on_exit
code for the spawnedsolhint
process runs at the end, afteron_done
.stdin
and closes it.handle
exists and that streams aren't being closed prematurely.Things I haven't yet done:
Before I reproduce this with minimal config, has anyone seen this kind of behavior before?