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

feat(picker): lsp_incoming_calls #1483

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sakalys
Copy link

@sakalys sakalys commented Mar 2, 2025

Description

The lsp_incoming_calls feature was missing

Related Issue(s)

#463


The originally added mapping overrides the internal VIM gesture:

							*gi*
gi			Insert text in the same position as where Insert mode
			was stopped last time in the current buffer.
			This uses the |'^| mark.  It's different from "`^i"
			when the mark is past the end of the line.
			The position is corrected for inserted/deleted lines,
			but NOT for inserted/deleted characters.
			When the |:keepjumps| command modifier is used the |'^|
			mark won't be changed.

@sakalys sakalys changed the title feat: lsp_incoming_calls feat(picker): lsp_incoming_calls Mar 2, 2025
@dpetka2001
Copy link
Contributor

Did you actually test this? There's no finder lsp_incoming_calls.

@sakalys
Copy link
Author

sakalys commented Mar 3, 2025

Did you actually test this? There's no finder lsp_incoming_calls.

I have, locally only. Not sure if there is a way to test it with TDD though. It's a copy-paste from lsp_implementations.

@dpetka2001
Copy link
Contributor

This isn't working for me when I checkout this PR locally. I get error no finder lsp_incoming_calls. And your PR also doesn't add a finder. I don't know how LSP works under the hood to give more details, but this doesn't seem to be working.

@sakalys
Copy link
Author

sakalys commented Mar 3, 2025

There's a caveat though. I'll add it to the original comment as well.
It overrides the internal VIM gesture:

							*gi*
gi			Insert text in the same position as where Insert mode
			was stopped last time in the current buffer.
			This uses the |'^| mark.  It's different from "`^i"
			when the mark is past the end of the line.
			The position is corrected for inserted/deleted lines,
			but NOT for inserted/deleted characters.
			When the |:keepjumps| command modifier is used the |'^|
			mark won't be changed.

@sakalys
Copy link
Author

sakalys commented Mar 3, 2025

This isn't working for me when I checkout this PR locally. I get error no finder lsp_incoming_calls. And your PR also doesn't add a finder. I don't know how LSP works under the hood to give more details, but this doesn't seem to be working.

Thanks for checking. I might have confused myself somehow. Let me see what I can do address this. I will make this PR a draft. I'll have to research how to "add a finder" though, unless you can nudge me in the right direction :)

@sakalys sakalys marked this pull request as draft March 3, 2025 10:44
@dpetka2001
Copy link
Contributor

You would have to add the finder in snacks.nvim/lua/snacks/picker/source/lsp/init.lua I believe. But like I said I don't know LSP stuff at all, so don't know how this would work. Just that currently it's not working.

Maybe wait for maintainer's input after he comes back from vacation (see pinned #1482)

@sakalys sakalys marked this pull request as ready for review March 3, 2025 13:52
@sakalys
Copy link
Author

sakalys commented Mar 3, 2025

This is a tad bit advanced for my in understanding of lua/neovim async concepts.

It's quite simple to implement functionally, but I got stuck with nesting two async calls as one should first do a textDocument/prepareCallHierarchy, and then follow up with callHierarchy/incomingCalls.

Anyone care to pick this up?
This current code is missing a piece similar to the following pseudo code in source/lsp/init.lua:

function M.incoming_calls(opts, ctx)
  return function (cb)
    M.request("textDocument/prepareCallHierarchy", params, function (locationsResult)
      innerParams = locationsResult[1]

      M.request("callHierarchy/incomingCalls", innerParams, function (result)
        result.forEach(item => cb(processItem(item)))
      end
    end
  end
end

```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants