Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: finder filter functions should work on items inside of result table rather than the result table as a whole #1404

Merged
merged 1 commit into from
Mar 3, 2024

Conversation

winter-again
Copy link
Contributor

PR should fix #1394. Below is the example in the docs for filtering in the finder. Since it's specified that func should return a bool, I think the func is meant to be called on each element of the result table rather than the result table itself (which itself is just part of the map returned by vim.lsp.buf_request_all(); the reuse of names is confusing). This way, I think it's more like the user can write filters that act on the finder results. Correct me if I'm wrong.

Additionally, fn() in box.filter should also take client_id so that filters are applied properly.

If all looks good, I can clean up comments and/or change the name of result_member variable to something else.

require('lspsaga').setup({
  finder = {
    filter = {
      ['textDocument/references']  = function(client_id, result)
        -- your logic
        return true
      end
    }
  }
})

@glepnir glepnir merged commit f836f73 into nvimdev:main Mar 3, 2024
4 checks passed
@winter-again winter-again deleted the fix-finder-filter branch March 3, 2024 06:18
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.

Filter doc wrong
2 participants