Skip to content
This repository was archived by the owner on Aug 11, 2024. It is now read-only.

Adhoc buffer creation or option to restrict the number of buffers / entries when using lsp_finder #96

Open
Reicr opened this issue Apr 1, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@Reicr
Copy link

Reicr commented Apr 1, 2022

Is your feature request related to a problem? Please describe.

Working with code that has a lot of references can cause problems when using lsp_finder in combination with other plugins. I guess mostly because a buffer is created for each entry.

Error executing vim.schedule lua callback: Vim(lua):E5108: Error executing lua ...k/packer/start/gitsigns.nvim/lua/gitsigns/subprocess.lua:71: Failed to spawn process: {                                                                                                                                                                                                                     
  _state = {                                                                                                                                                                                                                                                                                                                                                                                  
    pid = "EMFILE: too many open files",                                                                                                                                                                                                                                                                                                                                                      
    stderr = <userdata 1>,                                                                                                                                                                                                                                                                                                                                                                    
    stderr_data = {},                                                                                                                                                                                                                                                                                                                                                                         
    stdout = <userdata 2>,                                                                                                                                                                                                                                                                                                                                                                    
    stdout_data = {}                                                                                                                                                                                                                                                                                                                                                                          
  },                                                                                                                                                                                                                                                                                                                                                                                          
  args = { "--no-pager", "config", "user.name" },                                                                                                                                                                                                                                                                                                                                             
  command = "git"                                                                                                                                                                                                                                                                                                                                                                             
} 

Describe the solution you'd like

I don't know how difficult, slow and resource heavy it would be to create a buffer on the fly. If it is reasonable, the finder could create the buffer only when a reference is actually inspected instead of creating them all in advance.

Describe alternatives you've considered

If adhoc buffer creation is not feasible, maybe an option to restrict the number of buffers or entries in the finder could be added.

@Reicr Reicr added the enhancement New feature or request label Apr 1, 2022
@Reicr
Copy link
Author

Reicr commented Apr 1, 2022

There is actually already an option for this: max_preview_lines. Problem with this, it is applied after the buffers are created which will not prevent problems caused by too many buffers.

@Reicr Reicr changed the title Adhoc buffer creation or option to restrict the number of buffers / entries in the definition preview Adhoc buffer creation or option to restrict the number of buffers / entries when using lsp_finder Apr 1, 2022
@Reicr
Copy link
Author

Reicr commented Apr 9, 2022

As an alternative to fetching the file contents with buffers, one could think of using file system operations instead. In my test it dit not performe worse but avoided buffer related auto commands and therefore did not trigger the previously mentioned exception.

Since it might still be undesirable to have 100 or 1000 of references to scroll through, an option to limit the number of entries in the lsp_finder window could be added.

@Reicr
Copy link
Author

Reicr commented Apr 10, 2022

The only problem I encountered was the loss of filetype detection and therefore syntax highlighting in the previews. A library like plenary can help with that but would add a maybe unwanted dependency.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant