neoclide / coc.nvim

Nodejs extension host for vim & neovim, load extensions like VSCode and host language servers.
Other
24.15k stars 953 forks source link

fix(defaultAction) fallback to default action on emtpy expression #4954

Closed asmodeus812 closed 3 months ago

asmodeus812 commented 3 months ago

This should allow the expression function to return nil, to by default execute the default action of the list, as there are no easy ways to extract the name of the default action for the current list. doAction by default if no 'name' is provided would fallback to the defaultAction.

asmodeus812 commented 3 months ago

The reason is to be able to do something like that

function _G.list_default_action(ctx)
        if ctx and #ctx.targets > 1 then
            -- send to qflist
            return "quickfix"
        else
            -- default
            return nil
        end
    end
        function! Listaction(ctx)
            " do execute quickfix or default action
            return v:lua.list_default_action(a:ctx)
        endfunction
   "<CR>": "expr:Listaction",
codecov[bot] commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 98.56%. Comparing base (846994b) to head (30f56c7).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #4954 +/- ## ========================================== + Coverage 98.54% 98.56% +0.01% ========================================== Files 273 273 Lines 26060 26060 Branches 5386 5385 -1 ========================================== + Hits 25682 25687 +5 + Misses 223 219 -4 + Partials 155 154 -1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.