-
Notifications
You must be signed in to change notification settings - Fork 790
Proselint: failed to decode json: Expected value but found invalid token at character 1 #969
Comments
Is there a reliable way to replicate this? I saw the same error the first time I set up The issue is quite clear: when there's a cache error, diff --git a/lua/null-ls/builtins/diagnostics/proselint.lua b/lua/null-ls/builtins/diagnostics/proselint.lua
index 1a53fcf..f09eba6 100644
--- a/lua/null-ls/builtins/diagnostics/proselint.lua
+++ b/lua/null-ls/builtins/diagnostics/proselint.lua
@@ -14,19 +14,26 @@ return h.make_builtin({
generator_opts = {
command = "proselint",
args = { "--json" },
- format = "json",
+ format = "raw",
to_stdin = true,
check_exit_code = function(c)
return c <= 1
end,
on_output = function(params)
+ local output = params.output
+ if vim.startswith(output, "Error") then
+ local split = vim.split(output, "\n")
+ output = split[#split - 1]
+ end
+ local decoded = vim.json.decode(output)
+
local diags = {}
local sev = {
error = 1,
warning = 2,
suggestion = 4,
}
- for _, d in ipairs(params.output.data.errors) do
+ for _, d in ipairs(decoded.data.errors) do
table.insert(diags, {
row = d.line,
col = d.column, However, I'm tempted to call this an upstream issue, since using the |
Despite those warnings, proselint works, it will still give me diagnostics. The only thing is it yields warnings frequently. I think the warnings are generated very often: just continuously typing new characters and save the file occasionally, it will yield warnings more than less. I find that Especially when trying to create a new list in markdown, it will have higher probability to yield such warning. |
Could you open an issue on the |
Hi! I would be happy to pose such issue to upstream, but I don't know how to replicate in the
yields valid outputs:
or
|
It should theoretically be the same. All null-ls is doing is the equivalent of this command: cat new.md | proselint --json But since I'm not sure under what conditions this error is triggered, it's hard to provide a proper reproduction. I think the fundamental cause is this line, which uses I think it's worth opening an issue with what we know. While we don't have a 100% reliable method to replicate it, the code path and nature of the issue is pretty clear. Otherwise there's not much I can do here right now, since fixing it would also require me to be able to reliably replicate the issue. |
Ok, I propose such issue to the upstream ampersor/proselint#1307. Have no idea why such resource would be unavailable.
|
I find that if |
I'm seeing the exact same error with haml-lint.
|
@aedwardg Could you open a separate issue so I can reproduce and investigate? |
@jose-elias-alvarez, see #1144 |
FAQ
Issues
Neovim Version
0.7.2
Operating System
macOS 12.4
Minimal config
proselint
version: 0.13.0Steps to reproduce
markdown
file, for exampletest.md
Type the following test any save the file occasionally, then will get the following error:
Expected behavior
shouldn't have any warning
Actual behavior
get the following error:
Debug log
[TRACE Mon Jul 25 03:19:42 2022] ...site/pack/packer/opt/null-ls.nvim/lua/null-ls/client.lua:106: starting null-ls client
[TRACE Mon Jul 25 03:19:42 2022] ...im/site/pack/packer/opt/null-ls.nvim/lua/null-ls/rpc.lua:121: received LSP request for method initialize
[DEBUG Mon Jul 25 03:19:42 2022] ...site/pack/packer/opt/null-ls.nvim/lua/null-ls/client.lua:161: unable to notify client for method textDocument/didOpen (client not active): {
textDocument = {
uri = "file:///Users/northyear/Desktop/test.md"
}
}
[TRACE Mon Jul 25 03:19:42 2022] ...im/site/pack/packer/opt/null-ls.nvim/lua/null-ls/rpc.lua:146: received LSP notification for method initialized
[TRACE Mon Jul 25 03:19:42 2022] ...im/site/pack/packer/opt/null-ls.nvim/lua/null-ls/rpc.lua:146: received LSP notification for method textDocument/didOpen
[TRACE Mon Jul 25 03:19:42 2022] .../pack/packer/opt/null-ls.nvim/lua/null-ls/generators.lua:21: running generators for method NULL_LS_DIAGNOSTICS_ON_OPEN
[DEBUG Mon Jul 25 03:19:42 2022] ...t/null-ls.nvim/lua/null-ls/helpers/generator_factory.lua:346: spawning command "proselint" at /Users/northyear/Desktop with args { "--json" }
[TRACE Mon Jul 25 03:19:42 2022] ...t/null-ls.nvim/lua/null-ls/helpers/generator_factory.lua:217: error output: nil
[TRACE Mon Jul 25 03:19:42 2022] ...t/null-ls.nvim/lua/null-ls/helpers/generator_factory.lua:218: output: {"data": {"errors": []}, "status": "success"}
[TRACE Mon Jul 25 03:19:42 2022] ...pack/packer/opt/null-ls.nvim/lua/null-ls/diagnostics.lua:169: received diagnostics from source 2
[TRACE Mon Jul 25 03:19:42 2022] ...pack/packer/opt/null-ls.nvim/lua/null-ls/diagnostics.lua:170: {}
[TRACE Mon Jul 25 03:19:45 2022] ...im/site/pack/packer/opt/null-ls.nvim/lua/null-ls/rpc.lua:146: received LSP notification for method textDocument/didChange
[TRACE Mon Jul 25 03:19:45 2022] .../pack/packer/opt/null-ls.nvim/lua/null-ls/generators.lua:21: running generators for method NULL_LS_DIAGNOSTICS
[DEBUG Mon Jul 25 03:19:45 2022] ...t/null-ls.nvim/lua/null-ls/helpers/generator_factory.lua:346: spawning command "proselint" at /Users/northyear/Desktop with args { "--json" }
[TRACE Mon Jul 25 03:19:45 2022] ...t/null-ls.nvim/lua/null-ls/helpers/generator_factory.lua:217: error output: nil
[TRACE Mon Jul 25 03:19:45 2022] ...t/null-ls.nvim/lua/null-ls/helpers/generator_factory.lua:218: output: {"data": {"errors": []}, "status": "success"}
[TRACE Mon Jul 25 03:19:45 2022] ...pack/packer/opt/null-ls.nvim/lua/null-ls/diagnostics.lua:169: received diagnostics from source 2
[TRACE Mon Jul 25 03:19:45 2022] ...pack/packer/opt/null-ls.nvim/lua/null-ls/diagnostics.lua:170: {}
[TRACE Mon Jul 25 03:19:46 2022] ...im/site/pack/packer/opt/null-ls.nvim/lua/null-ls/rpc.lua:121: received LSP request for method textDocument/completion
[TRACE Mon Jul 25 03:19:46 2022] .../pack/packer/opt/null-ls.nvim/lua/null-ls/generators.lua:21: running generators for method NULL_LS_COMPLETION
[DEBUG Mon Jul 25 03:19:46 2022] .../pack/packer/opt/null-ls.nvim/lua/null-ls/generators.lua:24: no generators available
[DEBUG Mon Jul 25 03:19:46 2022] .../pack/packer/opt/null-ls.nvim/lua/null-ls/completion.lua:16: received no completion results from generators
[TRACE Mon Jul 25 03:19:47 2022] ...im/site/pack/packer/opt/null-ls.nvim/lua/null-ls/rpc.lua:121: received LSP request for method textDocument/completion
[TRACE Mon Jul 25 03:19:47 2022] .../pack/packer/opt/null-ls.nvim/lua/null-ls/generators.lua:21: running generators for method NULL_LS_COMPLETION
[DEBUG Mon Jul 25 03:19:47 2022] .../pack/packer/opt/null-ls.nvim/lua/null-ls/generators.lua:24: no generators available
[DEBUG Mon Jul 25 03:19:47 2022] .../pack/packer/opt/null-ls.nvim/lua/null-ls/completion.lua:16: received no completion results from generators
[TRACE Mon Jul 25 03:19:48 2022] ...im/site/pack/packer/opt/null-ls.nvim/lua/null-ls/rpc.lua:121: received LSP request for method textDocument/completion
[TRACE Mon Jul 25 03:19:48 2022] .../pack/packer/opt/null-ls.nvim/lua/null-ls/generators.lua:21: running generators for method NULL_LS_COMPLETION
[DEBUG Mon Jul 25 03:19:48 2022] .../pack/packer/opt/null-ls.nvim/lua/null-ls/generators.lua:24: no generators available
[DEBUG Mon Jul 25 03:19:48 2022] .../pack/packer/opt/null-ls.nvim/lua/null-ls/completion.lua:16: received no completion results from generators
[TRACE Mon Jul 25 03:19:49 2022] ...im/site/pack/packer/opt/null-ls.nvim/lua/null-ls/rpc.lua:121: received LSP request for method textDocument/completion
[TRACE Mon Jul 25 03:19:49 2022] .../pack/packer/opt/null-ls.nvim/lua/null-ls/generators.lua:21: running generators for method NULL_LS_COMPLETION
[DEBUG Mon Jul 25 03:19:49 2022] .../pack/packer/opt/null-ls.nvim/lua/null-ls/generators.lua:24: no generators available
[DEBUG Mon Jul 25 03:19:49 2022] .../pack/packer/opt/null-ls.nvim/lua/null-ls/completion.lua:16: received no completion results from generators
[TRACE Mon Jul 25 03:19:49 2022] ...im/site/pack/packer/opt/null-ls.nvim/lua/null-ls/rpc.lua:121: received LSP request for method textDocument/completion
[TRACE Mon Jul 25 03:19:49 2022] .../pack/packer/opt/null-ls.nvim/lua/null-ls/generators.lua:21: running generators for method NULL_LS_COMPLETION
[DEBUG Mon Jul 25 03:19:49 2022] .../pack/packer/opt/null-ls.nvim/lua/null-ls/generators.lua:24: no generators available
[DEBUG Mon Jul 25 03:19:49 2022] .../pack/packer/opt/null-ls.nvim/lua/null-ls/completion.lua:16: received no completion results from generators
[TRACE Mon Jul 25 03:19:52 2022] ...im/site/pack/packer/opt/null-ls.nvim/lua/null-ls/rpc.lua:121: received LSP request for method textDocument/completion
[TRACE Mon Jul 25 03:19:52 2022] .../pack/packer/opt/null-ls.nvim/lua/null-ls/generators.lua:21: running generators for method NULL_LS_COMPLETION
[DEBUG Mon Jul 25 03:19:52 2022] .../pack/packer/opt/null-ls.nvim/lua/null-ls/generators.lua:24: no generators available
[DEBUG Mon Jul 25 03:19:52 2022] .../pack/packer/opt/null-ls.nvim/lua/null-ls/completion.lua:16: received no completion results from generators
[TRACE Mon Jul 25 03:19:53 2022] ...im/site/pack/packer/opt/null-ls.nvim/lua/null-ls/rpc.lua:121: received LSP request for method textDocument/completion
[TRACE Mon Jul 25 03:19:53 2022] .../pack/packer/opt/null-ls.nvim/lua/null-ls/generators.lua:21: running generators for method NULL_LS_COMPLETION
[DEBUG Mon Jul 25 03:19:53 2022] .../pack/packer/opt/null-ls.nvim/lua/null-ls/generators.lua:24: no generators available
[DEBUG Mon Jul 25 03:19:53 2022] .../pack/packer/opt/null-ls.nvim/lua/null-ls/completion.lua:16: received no completion results from generators
[TRACE Mon Jul 25 03:19:54 2022] ...im/site/pack/packer/opt/null-ls.nvim/lua/null-ls/rpc.lua:121: received LSP request for method textDocument/completion
[TRACE Mon Jul 25 03:19:54 2022] .../pack/packer/opt/null-ls.nvim/lua/null-ls/generators.lua:21: running generators for method NULL_LS_COMPLETION
[DEBUG Mon Jul 25 03:19:54 2022] .../pack/packer/opt/null-ls.nvim/lua/null-ls/generators.lua:24: no generators available
[DEBUG Mon Jul 25 03:19:54 2022] .../pack/packer/opt/null-ls.nvim/lua/null-ls/completion.lua:16: received no completion results from generators
[TRACE Mon Jul 25 03:19:54 2022] ...im/site/pack/packer/opt/null-ls.nvim/lua/null-ls/rpc.lua:121: received LSP request for method textDocument/completion
[TRACE Mon Jul 25 03:19:54 2022] .../pack/packer/opt/null-ls.nvim/lua/null-ls/generators.lua:21: running generators for method NULL_LS_COMPLETION
[DEBUG Mon Jul 25 03:19:54 2022] .../pack/packer/opt/null-ls.nvim/lua/null-ls/generators.lua:24: no generators available
[DEBUG Mon Jul 25 03:19:54 2022] .../pack/packer/opt/null-ls.nvim/lua/null-ls/completion.lua:16: received no completion results from generators
[TRACE Mon Jul 25 03:19:57 2022] ...im/site/pack/packer/opt/null-ls.nvim/lua/null-ls/rpc.lua:121: received LSP request for method textDocument/completion
[TRACE Mon Jul 25 03:19:57 2022] .../pack/packer/opt/null-ls.nvim/lua/null-ls/generators.lua:21: running generators for method NULL_LS_COMPLETION
[DEBUG Mon Jul 25 03:19:57 2022] .../pack/packer/opt/null-ls.nvim/lua/null-ls/generators.lua:24: no generators available
[DEBUG Mon Jul 25 03:19:57 2022] .../pack/packer/opt/null-ls.nvim/lua/null-ls/completion.lua:16: received no completion results from generators
[TRACE Mon Jul 25 03:19:57 2022] ...im/site/pack/packer/opt/null-ls.nvim/lua/null-ls/rpc.lua:146: received LSP notification for method textDocument/didChange
[TRACE Mon Jul 25 03:19:57 2022] .../pack/packer/opt/null-ls.nvim/lua/null-ls/generators.lua:21: running generators for method NULL_LS_DIAGNOSTICS
[DEBUG Mon Jul 25 03:19:57 2022] ...t/null-ls.nvim/lua/null-ls/helpers/generator_factory.lua:346: spawning command "proselint" at /Users/northyear/Desktop with args { "--json" }
[TRACE Mon Jul 25 03:19:58 2022] ...im/site/pack/packer/opt/null-ls.nvim/lua/null-ls/rpc.lua:146: received LSP notification for method textDocument/didChange
[TRACE Mon Jul 25 03:19:58 2022] .../pack/packer/opt/null-ls.nvim/lua/null-ls/generators.lua:21: running generators for method NULL_LS_DIAGNOSTICS
[DEBUG Mon Jul 25 03:19:58 2022] ...t/null-ls.nvim/lua/null-ls/helpers/generator_factory.lua:346: spawning command "proselint" at /Users/northyear/Desktop with args { "--json" }
[TRACE Mon Jul 25 03:19:58 2022] ...t/null-ls.nvim/lua/null-ls/helpers/generator_factory.lua:217: error output: nil
[TRACE Mon Jul 25 03:19:58 2022] ...t/null-ls.nvim/lua/null-ls/helpers/generator_factory.lua:218: output: {"data": {"errors": []}, "status": "success"}
[TRACE Mon Jul 25 03:19:58 2022] ...pack/packer/opt/null-ls.nvim/lua/null-ls/diagnostics.lua:169: received diagnostics from source 2
[TRACE Mon Jul 25 03:19:58 2022] ...pack/packer/opt/null-ls.nvim/lua/null-ls/diagnostics.lua:170: {}
[DEBUG Mon Jul 25 03:19:58 2022] ...pack/packer/opt/null-ls.nvim/lua/null-ls/diagnostics.lua:173: buffer changed; ignoring received diagnostics
[TRACE Mon Jul 25 03:19:58 2022] ...t/null-ls.nvim/lua/null-ls/helpers/generator_factory.lua:217: error output: nil
[TRACE Mon Jul 25 03:19:58 2022] ...t/null-ls.nvim/lua/null-ls/helpers/generator_factory.lua:218: output: Error ([Errno 35] Resource temporarily unavailable: '/Users/northyear/.cache/proselint/checks.airlinese.misc.check') opening /Users/northyear/.cache/proselint/checks.airlinese.misc.check - will attempt to delete and re-open.
Error ([Errno 35] Resource temporarily unavailable: '/Users/northyear/.cache/proselint/checks.annotations.misc.check') opening /Users/northyear/.cache/proselint/checks.annotations.misc.check - will attempt to delete and re-open.
Error ([Errno 35] Resource temporarily unavailable: '/Users/northyear/.cache/proselint/checks.archaism.misc.check') opening /Users/northyear/.cache/proselint/checks.archaism.misc.check - will attempt to delete and re-open.
Error ([Errno 35] Resource temporarily unavailable: '/Users/northyear/.cache/proselint/checks.cliches.hell.check_repeated_exclamations') opening /Users/northyear/.cache/proselint/checks.cliches.hell.check_repeated_exclamations - will attempt to delete and re-open.
Error ([Errno 35] Resource temporarily unavailable: '/Users/northyear/.cache/proselint/checks.cliches.misc.check_cliches_garner') opening /Users/northyear/.cache/proselint/checks.cliches.misc.check_cliches_garner - will attempt to delete and re-open.
{"data": {"errors": []}, "status": "success"}
[WARN Mon Jul 25 03:19:58 2022] .../pack/packer/opt/null-ls.nvim/lua/null-ls/generators.lua:78: failed to run generator: ...t/null-ls.nvim/lua/null-ls/helpers/generator_factory.lua:64: failed to decode json: Expected value but found invalid token at character 1
[TRACE Mon Jul 25 03:19:59 2022] ...im/site/pack/packer/opt/null-ls.nvim/lua/null-ls/rpc.lua:146: received LSP notification for method textDocument/didSave
[TRACE Mon Jul 25 03:19:59 2022] .../pack/packer/opt/null-ls.nvim/lua/null-ls/generators.lua:21: running generators for method NULL_LS_DIAGNOSTICS_ON_SAVE
[DEBUG Mon Jul 25 03:19:59 2022] .../pack/packer/opt/null-ls.nvim/lua/null-ls/generators.lua:24: no generators available
[TRACE Mon Jul 25 03:20:01 2022] ...im/site/pack/packer/opt/null-ls.nvim/lua/null-ls/rpc.lua:121: received LSP request for method textDocument/codeAction
[TRACE Mon Jul 25 03:20:01 2022] .../pack/packer/opt/null-ls.nvim/lua/null-ls/generators.lua:21: running generators for method NULL_LS_CODE_ACTION
[DEBUG Mon Jul 25 03:20:01 2022] ...t/null-ls.nvim/lua/null-ls/helpers/generator_factory.lua:346: spawning command "proselint" at /Users/northyear/Desktop with args { "--json" }
[TRACE Mon Jul 25 03:20:02 2022] ...t/null-ls.nvim/lua/null-ls/helpers/generator_factory.lua:217: error output: nil
[TRACE Mon Jul 25 03:20:02 2022] ...t/null-ls.nvim/lua/null-ls/helpers/generator_factory.lua:218: output: {"data": {"errors": []}, "status": "success"}
[TRACE Mon Jul 25 03:20:02 2022] ...ack/packer/opt/null-ls.nvim/lua/null-ls/code-actions.lua:35: received code actions from generators
[TRACE Mon Jul 25 03:20:02 2022] ...ack/packer/opt/null-ls.nvim/lua/null-ls/code-actions.lua:36: {}
[TRACE Mon Jul 25 03:20:02 2022] ...im/site/pack/packer/opt/null-ls.nvim/lua/null-ls/rpc.lua:121: received LSP request for method shutdown
[TRACE Mon Jul 25 03:20:02 2022] ...im/site/pack/packer/opt/null-ls.nvim/lua/null-ls/rpc.lua:146: received LSP notification for method exit
The text was updated successfully, but these errors were encountered: