-
Notifications
You must be signed in to change notification settings - Fork 32
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
Filter snippets by condition #52
Comments
You can filter them out by either setting the snippet to hidden? Or overriding the show_condition for the snippet |
I don't want to permanently hide the snippet. I just want it to show only when it's actually available (i.e at the beginning of a line).
Can you provide an example for my case? Thanks! |
Ok that has been quite some time. Basically the (not working) example would be local ls = require('luasnip')
local i = ls.insert_node
local fmta = require('luasnip.extras.fmt').fmta
local line_begin = require('luasnip.extras.expand_conditions').line_begin
return {
-- Lua
s(
{ trig = 'rq', dscr = 'Require' },
fmta(
[[
require('<>')
]],
{
i(1, 'package'),
}
),
{ condition = line_begin, show_condition = line_begin }
),
} The issue here is that the API of Currently I don't see a way of changing/improving this, as we need the A quick and dirty (not quite) fix maybe would be to use something like |
Hi! If I have the following snippets
then cmp shows the
rq
completion even when I'm not at the beginning of line. Is it possible to filter such snippet from the completion menu?The text was updated successfully, but these errors were encountered: