neoclide / coc-eslint

Eslint extension for coc.nvim
MIT License
396 stars 25 forks source link

UnhandledRejection opening markdown files #135

Closed oblitum closed 2 years ago

oblitum commented 2 years ago

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)
fannheyward commented 2 years ago

I can't reproduce this, any more infos?

oblitum commented 2 years ago

: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 []
oblitum commented 2 years ago

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.

oblitum commented 2 years ago

I have this eslint configuration:

                eslint = {
                    quiet          = true,
                    packageManager = 'yarn'
                },
fannheyward commented 2 years ago

Invalid configuration

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

fannheyward commented 2 years ago

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.

oblitum commented 2 years ago

Invalid configuration

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

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

oblitum commented 2 years ago

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.

chemzqm commented 2 years ago

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

oblitum commented 2 years ago

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

oblitum commented 2 years ago

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

oblitum commented 2 years ago

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

chemzqm commented 2 years ago

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

oblitum commented 2 years ago

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

chemzqm commented 2 years ago

Seems coc-lightbulb

oblitum commented 2 years ago

Seems coc-lightbulb

What's that? Magic?

Yes, it's that one.

oblitum commented 2 years ago

I'll open an issue there.

chemzqm commented 2 years ago

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

chemzqm commented 2 years ago

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

oblitum commented 2 years ago

So it seems very complex to find the culprit.

chemzqm commented 2 years ago

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.

oblitum commented 2 years ago

@chemzqm thx, it's fixed.