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

Multiline snippet ghost text with dynamic window position flip #1955

Open
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

xzbdmw
Copy link

@xzbdmw xzbdmw commented Jun 8, 2024

follow up of #1886
fix #1886 (comment)
close #495

should behave the same as vscode now. Custom snippet not supported yet, only lsp snippet and copilot-similar source will trigger multi-line ghost-text, but should be easy to add.

The functionality is all implemented,
@hrsh7th do let me know what do you think, Thanks!

iShot_2024-06-09_07.56.42.mp4

@xzbdmw xzbdmw marked this pull request as draft June 8, 2024 21:29
@xzbdmw xzbdmw marked this pull request as ready for review June 8, 2024 23:58
@michaelbrusegard
Copy link

This is so awesome! I will test it shortly! Can you share how you have set up CMP @xzbdmw . I want to try and avoid making a mistake in the setup on my part. I was using Copilot.lua with the cmp extension for my ghost text

@xzbdmw
Copy link
Author

xzbdmw commented Jun 9, 2024

Hey I think you don’t need to change anything. should work out of box, and there is no extra config option in cmp . this is my keymap, and near cursor(vedio effect, optional)

@cybergaz
Copy link

cybergaz commented Jun 9, 2024

please add an option to toggle between multiline and singleline ghost text, not everyone like to have multiline previews.

@michaelbrusegard
Copy link

@xzbdmw It works really well and swaps every time there is a multiline ghost text! My completion menu does not seem to follow the mouse as much as yours and I am not completely sure about the hiding of the menu when there is a space (but keeping the ghost text). If you want to take a look at my cmp config: https://github.com/michaelbrusegard/dotfiles/blob/25f81267d8f3d9253153b54bf92dd6e757ac089a/macos/.config/nvim/init.lua#L551

Maybe you have some feedback or suggestions, I am very new to neovim btw
Thanks for the great work

@xzbdmw
Copy link
Author

xzbdmw commented Jun 10, 2024

@cybergaz That shoud be easy(I’m waiting for maintainer’s reply)
@michaelbrusegard could you use a gif to show that

@michaelbrusegard
Copy link

Screen.Recording.2024-06-10.at.23.01.39.mov

This is how it looks, but the menu doesnt hide on space (while keeping the ghost text) and it doesnt move with the cursor. It may be my config is wrong for all I know

@xzbdmw
Copy link
Author

xzbdmw commented Jun 11, 2024

but the menu doesnt hide on space

That’s because copilot suggestion contains space, so it just matches

it doesnt move with the cursor

you can try
require("cmp").setup({
view = {
entries = {
follow_cursor = true
}
}
})

@michaelbrusegard
Copy link

@xzbdmw Thank you, that worked with the cursor. Are there any convenient way to make the keybinds. I feel like when I have the completion complete with return or tab it can be annoying if I actually want to use any of those

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.

Allow to position the float window above the current line
3 participants