neoclide/coc-eslint

UnhandledRejection opening markdown files

oblitum opened this issue · 22 comments

Recently anytime I'm opening standalone markdown files (e.g. nvim /tmp/foo.md), I'm getting this error:

[coc.nvim]: UnhandledRejection: Request textDocument/codeAction failed with message: No ESLint configuration found in /tmp.
Error: Request textDocument/codeAction failed with message: No ESLint configuration found in /tmp.
    at Ie (/home/francisco/.local/share/nvim/site/pack/packer/opt/coc.nvim/build/index.js:29:233)
    at Bi (/home/francisco/.local/share/nvim/site/pack/packer/opt/coc.nvim/build/index.js:28:6872)
    at Immediate.<anonymous> (/home/francisco/.local/share/nvim/site/pack/packer/opt/coc.nvim/build/index.js:28:6719)
    at process.processImmediate (node:internal/timers:471:21)

I can't reproduce this, any more infos?

:CocInfo gives:

## versions

vim version: NVIM v0.7.2
node version: v18.8.0
coc.nvim version: 0.0.82-6da029c4 2022-08-24 22:58:55 +0800
coc.nvim directory: /home/francisco/.local/share/nvim/site/pack/packer/opt/coc.nvim
term: tmux
platform: linux

## Log of coc.nvim

2022-08-24T22:49:24.902 ERROR (pid:34656) [configurations] - Invalid configuration "suggest.detailMaxLength" from coc-clangd, overwrite defaults is fobidden.
2022-08-24T22:49:24.902 ERROR (pid:34656) [configurations] - Invalid configuration "diagnostic.format" from coc-clangd, overwrite defaults is fobidden.
2022-08-24T22:49:24.999 INFO (pid:34656) [services] - registered service "languageserver.graphql"
2022-08-24T22:49:25.000 INFO (pid:34656) [services] - registered service "languageserver.haskell"
2022-08-24T22:49:25.000 INFO (pid:34656) [services] - registered service "languageserver.rescript"
2022-08-24T22:49:25.000 INFO (pid:34656) [services] - registered service "languageserver.bash"
2022-08-24T22:49:25.000 INFO (pid:34656) [services] - registered service "languageserver.csharp-ls"
2022-08-24T22:49:25.000 INFO (pid:34656) [services] - registered service "languageserver.purescript"
2022-08-24T22:49:25.017 INFO (pid:34656) [services] - registered service "diagnostic-languageserver"
2022-08-24T22:49:25.038 INFO (pid:34656) [services] - registered service "eslint"
2022-08-24T22:49:25.048 INFO (pid:34656) [services] - ESLint state change: stopped => starting
2022-08-24T22:49:25.060 INFO (pid:34656) [coc-git] - Looking for git in: git
2022-08-24T22:49:25.966 INFO (pid:34656) [plugin] - coc.nvim initialized with node: v18.8.0 after 1122ms
2022-08-24T22:49:25.978 INFO (pid:34656) [attach] - receive notification: diagnosticRefresh []
2022-08-24T22:49:26.001 INFO (pid:34656) [language-client-index] - Language server "ltex" started with 34718
2022-08-24T22:49:26.061 INFO (pid:34656) [services] - ESLint state change: starting => running
2022-08-24T22:49:26.067 INFO (pid:34656) [services] - service eslint started
2022-08-24T22:49:26.506 ERROR (pid:34656) [events] - Error on event: CursorHold Error: Request textDocument/codeAction failed with message: No ESLint configuration found in /tmp.
    at Ie (/home/francisco/.local/share/nvim/site/pack/packer/opt/coc.nvim/build/index.js:29:233)
    at Bi (/home/francisco/.local/share/nvim/site/pack/packer/opt/coc.nvim/build/index.js:28:6872)
    at Immediate.<anonymous> (/home/francisco/.local/share/nvim/site/pack/packer/opt/coc.nvim/build/index.js:28:6719)
    at process.processImmediate (node:internal/timers:471:21)
2022-08-24T22:49:28.107 ERROR (pid:34656) [server] - unhandledRejection  Promise {
  <rejected> Dy [Error]: Request textDocument/codeAction failed with message: No ESLint configuration found in /tmp.
      at Ie (/home/francisco/.local/share/nvim/site/pack/packer/opt/coc.nvim/build/index.js:29:233)
      at Bi (/home/francisco/.local/share/nvim/site/pack/packer/opt/coc.nvim/build/index.js:28:6872)
      at Immediate.<anonymous> (/home/francisco/.local/share/nvim/site/pack/packer/opt/coc.nvim/build/index.js:28:6719)
      at process.processImmediate (node:internal/timers:471:21) {
    code: -32603,
    data: undefined
  }
} Dy [Error]: Request textDocument/codeAction failed with message: No ESLint configuration found in /tmp.
    at Ie (/home/francisco/.local/share/nvim/site/pack/packer/opt/coc.nvim/build/index.js:29:233)
    at Bi (/home/francisco/.local/share/nvim/site/pack/packer/opt/coc.nvim/build/index.js:28:6872)
    at Immediate.<anonymous> (/home/francisco/.local/share/nvim/site/pack/packer/opt/coc.nvim/build/index.js:28:6719)
    at process.processImmediate (node:internal/timers:471:21) {
  code: -32603,
  data: undefined
}
2022-08-24T22:49:29.518 INFO (pid:34656) [attach] - receive notification: diagnosticRefresh []
2022-08-24T22:49:29.532 ERROR (pid:34656) [events] - Error on event: CursorHold Error: Request textDocument/codeAction failed with message: No ESLint configuration found in /tmp.
    at Ie (/home/francisco/.local/share/nvim/site/pack/packer/opt/coc.nvim/build/index.js:29:233)
    at Bi (/home/francisco/.local/share/nvim/site/pack/packer/opt/coc.nvim/build/index.js:28:6872)
    at Immediate.<anonymous> (/home/francisco/.local/share/nvim/site/pack/packer/opt/coc.nvim/build/index.js:28:6719)
    at process.processImmediate (node:internal/timers:471:21)
2022-08-24T22:49:32.089 INFO (pid:34656) [attach] - receive notification: showInfo []

As an unrelated note:

2022-08-24T22:41:20.269 ERROR (pid:34006) [configurations] - Invalid configuration "suggest.detailMaxLength" from coc-clangd, overwrite defaults is fobidden.
2022-08-24T22:41:20.269 ERROR (pid:34006) [configurations] - Invalid configuration "diagnostic.format" from coc-clangd, overwrite defaults is fobidden.

No idea why is that, possibly coming from coc-clangd's internal configuration.

I have this eslint configuration:

                eslint = {
                    quiet          = true,
                    packageManager = 'yarn'
                },

Invalid configuration

extensions shouldn't overwrite configurations, coc-clangd has removed theses.

CursorHold Error: Request textDocument/codeAction failed

Looks like on CursorHold will fetch code actions, tested with markdown + coc-eslint, can't reproduce this, still checking on this.

Invalid configuration

extensions shouldn't overwrite configurations, coc-clangd has removed theses.

Ok, then that's due to no newer release yet.

I may try to reduce to a minimal init, but I'll potentially eliminate the CursorHold cause maybe... I'm short on time at the moment so I can only add this later.

It's expected error message, use silent! with CocAction to avoid

But I simply ignore where the CocAction call comes from, I don't have any custom CursorHold setting.

Oh, I have just one... let me check.

I just removed the single CursorHold I had in my init, issue still present.

You have some coc extension automatically requesting code actions, and it not handles the rejection.

Well... then I'll have to bisect that.

Seems coc-lightbulb

Seems coc-lightbulb

What's that? Magic?

Yes, it's that one.

I'll open an issue there.

But the error should be catched, don't why it throws

Can't reproduce your issue, the code action request should not send at all.

So it seems very complex to find the culprit.

I see, the error you get is not from CursorHold, but the timer

  setTimeout(async () => {
    await lightbulb.refresh();
  }, 3000);

the CodeActionManager could be improved to handle the error.

@chemzqm thx, it's fixed.