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

Use an UI to override/implement methods. #358

Open
DasOhmoff opened this issue Oct 24, 2022 · 4 comments
Open

Use an UI to override/implement methods. #358

DasOhmoff opened this issue Oct 24, 2022 · 4 comments

Comments

@DasOhmoff
Copy link

DasOhmoff commented Oct 24, 2022

Problem Statement

Hey 👋, thank you for your nice work!

Right now, when I try to implement methods, using the command line to select them is pretty uncomfortable, and also not very nice looking:
image

It would be nice to have some UI to be able to do that instead.

Ideas or possible solutions

One could use f.e telescope to be able to select that. Telescope offers the ability to select the items:
image
I am just demonstrating the Idea, of course selecting multiple code actions and applying them does not work with LSPs.

Thank you very much for your support :)

@mfussenegger
Copy link
Owner

Improving the UI sounds good, but I don't want nvim-jdtls to have a dependency on telescope and would rather have an abstraction that allows users to plug-in different implementations.

A first step would be to change jdtls.ui.pick_many to be async. Then it could be overridden with a telescope specific implementation.
(See also this PR in neovim that would go into this direction: neovim/neovim#18161)

@DasOhmoff
Copy link
Author

DasOhmoff commented Oct 25, 2022

Nice. I like this. I did not mean to add a telescope dependency anyway, I was just showing that the concept of the UI would improve things.

So is there a plan or so in regards to this issue?

@mfussenegger
Copy link
Owner

With #360 all jdtls.ui.pick_many calls are now happening inside a coroutine, so it would be possible to do something like:

require('jdtls.ui').pick_many = function(items, prompt, label_f, opts)
  local co = coroutine.running()
  call_other_async_version(..., function(result)
    coroutine.resume(co, result)
  end)
  return coroutine.yield()
end)

Changing the default implementation is still on my todo

@DasOhmoff
Copy link
Author

Ah, perfekt. Thanks! Waiting for the default too 👀

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

No branches or pull requests

2 participants