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

Choice Node Integration #43

Open
p0da opened this issue May 1, 2022 · 8 comments
Open

Choice Node Integration #43

p0da opened this issue May 1, 2022 · 8 comments

Comments

@p0da
Copy link

p0da commented May 1, 2022

I would like to revive this issue and ask if you could add native choice node integration into this cmp source. While it certainly possible to create an alternative popup menu, having choice nodes integrated will streamline workflows (unified settings and styles). Thanks for considering.

@saadparwaiz1
Copy link
Owner

what are you roughly expecting this to look like?

@p0da
Copy link
Author

p0da commented May 2, 2022

Whenever the choice node is jumped to, all the possible choices are displayed in cmp (potentially excluding the currently selected one?) and the user can confirm their selection immediately causing it to expand. It would essentially be the same as this just integrated into cmp instead.

@saadparwaiz1
Copy link
Owner

I'm not really sure if integrating with cmp is possible as the sources just provide completion candidates and how to resolve them. A hacky way would be instead of passing snippets we pass in the choice node candidates when a choice node is active but that'd still leave the issue of completion candidate from other sources such as lsp/buffer polluting the completion menu.

@L3MON4D3 any thoughts on this?

@p0da
Copy link
Author

p0da commented May 2, 2022

I believe it possible to specify source priorities such that if one source returns completions none of the others are queried which should solve the pollution issue. Can't really speak to the rest of the problem however.

@L3MON4D3
Copy link
Contributor

L3MON4D3 commented May 2, 2022

In case you're not aware @p0da, luasnip already has integration with vim.ui.select for changing choices.

I'm not really sure if integrating with cmp is possible as the sources just provide completion candidates and how to resolve them.

I think it should be doable, take a look at this piece of code from the ui.select-integration, something similar could be done in the execute-function of a source.

cmp_luasnip could provide a second source for the choices only, then the priority for it could be modified without affecting the snippets.

@saadparwaiz1
Copy link
Owner

I think it should be doable, take a look at this piece of code from the ui.select-integration, something similar could be done in the execute-function of a source.

I can definitely try this out. Will try to create a PR in a few days once I have some time 😄

@L3MON4D3
Copy link
Contributor

L3MON4D3 commented May 2, 2022

Nice, looking forward to it👍

@saadparwaiz1
Copy link
Owner

@L3MON4D3 @p0da do you guys want to try out #45?

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