nvimdev / nvimdev/lspsaga.nvim

Custom actions for finder?

Open
#1,523 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Lua
Stars
3.8k
Forks
308
PR merge metrics
No merged PRs in 30d

Description

Is your feature request related to a problem? Please describe.
I created a telescope plugin for myself that takes a filepath and presents options to open it in the current window, new tab, vsplit left, vsplit right, split above, and split below. Ideally, I would like to get the filepath that was selected from the lspsaga finder UI to open up my telescope picker to choose the desired action. This would normalize my bindings across neovim while reducing steps to remember.

Describe the solution you'd like
There's two options that could work:

  1. Support something like the following:
    require("lspsaga").setup({
      finder = {
        keys = {
          "<cr>" = function (filepath) ... end
        },
      },
    })
    
  2. Create module-level functions for common actions that one could replace with their own implementations. Less ideal monkey-patching actions but it would work, and I have an emacs-inspired advising system that would make it more manageable.
    telescope = require('telescope')
    telescope.actions.open = function (filepath) 
      telescope._extensions.find_menu.find_menu({ filepath = filepath })
    end 
    

Describe alternatives you've considered
I looked at the finder implementation and saw that it's mostly iterating the config settings for keys, so was thinking I could do something like the following:

   require("lspsaga").setup({
     finder = {
       keys = {
         "Telescope file_menu filepath=" = "<CR>",
       },
     },
   })

But that doesn't seem to work, I'll have to check but maybe unsupported commands are stripped from the config?

I could fork it and make my changes, but then I'll have to be on top of your upstream changes and I'd much rather try and find a way to make lspsaga better than create a worse version of it.

Additional context

Open to alternative ideas here!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue points to the finder implementation and its config-driven key handling; start there to understand how selected filepaths and key actions are dispatched. Done means a supported customization path lets a finder action receive the selected filepath, with the behavior verified through the existing finder workflow.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.