luckasRanarison / clear-action.nvim

Predictable LSP code actions
MIT License
114 stars 9 forks source link

Error when using `eslint_d` code action #6

Closed KostkaBrukowa closed 1 year ago

KostkaBrukowa commented 1 year ago

Hey! I'm using eslint_d for my TS linting and when I want to pick a code action I'm getting this error:

[actions.lua:19] -- action_tuple: { 1, {
    arguments = {
      title = "Disable ESLint rule @typescript-eslint/explicit-function-return-type for the entire file"
    },
    command = "NULL_LS_CODE_ACTION",
    title = "Disable ESLint rule @typescript-eslint/explicit-function-return-type for the entire file"
  } }
E5108: Error executing lua: ...acker/start/clear-action.nvim/lua/clear-action/utils.lua:8: attempt to call field '_exec_cmd' (a nil value)
stack traceback:
    ...acker/start/clear-action.nvim/lua/clear-action/utils.lua:8: in function 'apply_action'
    ...acker/start/clear-action.nvim/lua/clear-action/utils.lua:43: in function 'handle_action'
    ...ker/start/clear-action.nvim/lua/clear-action/actions.lua:27: in function 'on_select'
    ...acker/start/clear-action.nvim/lua/clear-action/popup.lua:116: in function <...acker/start/clear-action.nvim/lua/clear-action/popup.lua:115>
luckasRanarison commented 1 year ago

Perhaps _exec_cmd was added in the nightly version, I'll check the implementation in the previous versions for backward compabitility.

KostkaBrukowa commented 1 year ago

For your information I'm running 'nvim 0.9.2' and this only happens with eslint_d actions, and they come from 'null-ls' so maybe there is a problem with null-ls itself?

luckasRanarison commented 1 year ago

For your information I'm running 'nvim 0.9.2' and this only happens with eslint_d actions, and they come from 'null-ls' so maybe there is a problem with null-ls itself?

I've checked the default code_action() implementation in 0.9.2 and _exec_cmd didn't exist at the time. Could you check if it's solved in this branch, I haven't tried yet if it also works with the nightly version.

KostkaBrukowa commented 1 year ago

Hey! I've checked (on 0.9.2) and it fine now. Thanks for the fix!!

luckasRanarison commented 1 year ago

It also works with the nightly version so I'll use this implementation for backward compability.