Skip to content

Conversation

jaidetree
Copy link

Problem:
There are use cases where you may wish to call a function instead of mapping a command directly to a key action for the finder UI.

Solution:
Supports configuring a lspsaga.config.finder.actions object mapping action names to callable functions.

require('lspsaga').setup({
  finder = {
    keys = {
      open = "<CR>",
    },
    actions = {
      open = function (fname)
        print("Selected filename", fname)
      end
    },
  }
})

Additionally, this wraps the final api.nvim_win_set_cursor(0, pos) call in xpcall given that this may fail if the function does not finish synchronously, like spawning a telescope interface.

Fixes #1523

Problem:
There are use cases where you may wish to call a function instead of
mapping a command directly to a key action for the finder UI.

Solution:
Supports configuring a `lspsaga.config.finder.actions` object mapping
action names to callable functions.

```lua
require('lspsaga').setup({
  finder = {
    keys = {
      open = "<CR>",
    },
    actions = {
      open = function (fname)
        print("Selected filename", fname)
      end
    },
  }
})
```

Additionally, this wraps the final `api.nvim_win_set_cursor(0, pos)`
call in `xpcall` given that this may fail if the function does not
finish synchronously, like spawning a telescope interface.

Fixes nvimdev#1523
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Custom actions for finder?

1 participant