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

Support for inlineCompletionProvider #4581

Open
Konubinix opened this issue Oct 8, 2024 · 5 comments
Open

Support for inlineCompletionProvider #4581

Konubinix opened this issue Oct 8, 2024 · 5 comments

Comments

@Konubinix
Copy link
Contributor

Is your feature related or already mentioned on the wishlist?

Describe your feature here.

When getting completion, I try to use only the built-in capfs mechanism. The fact that lsp-mode integrates with it is great. Unfortunately, copilot.el does not and I have capfs and the ad-hoc copilot.el stuff so far.

I just realized that under the hood, copilot.el uses an lsp server : copilot-node-server, so I tried creating the lsp-copilot.el client.

But this server provides completion using the inlineCompletionProvider capability, not the completionProvider one.

I tried using https://github.com/kassick/lsp-inline-completions there are a few glitches, but it basically works. But it still does not use the capfs. So I'm back to square one.

So, I'm wondering if we could deal with completion using inlineCompletionProvider in lsp-mode, so that simply M-TAB would work seamlessly.

Is there already some discussion on the topic?

@kiennq
Copy link
Member

kiennq commented Nov 6, 2024

inlineCompletions is official in 3.18 lsp spec, we should support it if possible.
I've also created an issue in this kassick/lsp-inline-completions#1 to see if it's okay to integrate the lsp-inline-completions to the current lsp-mode.
@yyoncho @jcs090218

@kassick
Copy link
Contributor

kassick commented Nov 6, 2024

so I tried creating the lsp-copilot.el

@Konubinix I did the same here https://github.com/kassick/copilot-lsp ! Let me know if you want to use some of it or contribute -- it was created as a POC at the time, and then I switched to copilot.el because I did not have much time back then ...

@kassick
Copy link
Contributor

kassick commented Nov 6, 2024

@kiennq as I mentioned in the lsp-inline-completions repo, if the maintainers think it makes sense to upstream the code, sure!

There is at least one glitch I'm aware of -- not sure if it is the same one @Konubinix ran into

@kassick
Copy link
Contributor

kassick commented Nov 7, 2024

Regarding CAPF for inlineCompletions:

One aspect of inline completions is that they can span multiple lines.

With copilot, I did not see much of an issue -- I always get one-liners, not sure if it ever responds with longer text. On gitlab-lsp, though, some prompts resulted in multi-line code snippets (e.g. # write a unit test for this file would bring a test function) , and some would even result in changes in other points of the text.

That's why I wrote a separate UI for inline completions instead of using company, even taking care to display the overlay in the correct place.

When I had the completions from gitlab-lsp displayed in company, it would often look rather weird -- a very long company tooltip with a single candidate displayed on top of the preview overlay.

Helm or Vertico as frontends for capf were no better.

IMHO inlineCompletions either requires some tweaking in company (or any other CAPF frontend) or a separate UI alltogether.

@kiennq
Copy link
Member

kiennq commented Nov 8, 2024

I think the inlineCompletions should be independent from capf and closer to the inlay hint. Just that the inlay hint is just displaying without allow to select the next/prev suggestion and commit it. The UI is fairly close.

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

3 participants