-
Notifications
You must be signed in to change notification settings - Fork 233
Add blink_luasnip #378
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
Add blink_luasnip #378
Conversation
Co-authored-by: Austin Horstman <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the wait, I'll give it a test on my system soon
opts = { | ||
accept = { | ||
expand_snippet = function(snippet) require('luasnip').lsp_expand(snippet) end, | ||
}, | ||
sources = { | ||
completion = { | ||
-- WARN: add the rest of your providers here, unless you're using `opts_extend` | ||
-- and defining this outside of your primary `blink.cmp` config |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line should be kept
@Saghen it works fine in 0.6.2 but was somehow failing in master, let me know if I can help to debug. |
The |
Thanks @Saghen that was what I understood but was waiting for a stable release with the changes. |
LuaSnip does more stuff with the current line and wants access to the range to clear it by itself. I was thinking to set Edit: My hack won't work event work as the items changing the text won't update the Edit: Forget about it, it is indeed possible to feed luasnip with the line as you advised, thanks. |
It's messy but perhaps you could add back the text before calling luasnip? Using this snippet to get the text (not tested fyi, but should work): context.line:sub(context.bounds.start_col, context.bounds.start_col + context.bounds.length - 1) I'll revisit the |
I managed to make it work following your previous suggestion, right now the only issue I see is that the snippet is expanded but it goes to "normal" mode instead of staying in "select" mode as it should. |
I think you're missing the required |
If I pass
|
That's only if you want blink.cmp to expand the |
Yes but it's passing the inserText = " ", -- an space
insertTextFormat = vim.lsp.protocol.InsertTextFormat.Snippet and that worked fine (kept the snippet in select mode), so I think I will use that as a workaround, but IMHO passing inserText = "", -- empty
insertTextFormat = vim.lsp.protocol.InsertTextFormat.Snippet should not break. |
You should be using |
In all the cases I'm using This keeps changing the mode to Normal insertTextFormat = vim.lsp.protocol.InsertTextFormat.PlainText,
insertText = "" This crashes because tries to parse the snippet insertTextFormat = vim.lsp.protocol.InsertTextFormat.Snippet,
insertText = "" This one works well but inserts the space: insertTextFormat = vim.lsp.protocol.InsertTextFormat.Snippet,
insertText = " " This one works well but to me is a HACK 😄 : insertTextFormat = vim.lsp.protocol.InsertTextFormat.Snippet,
insertText = "$0" |
No description provided.