-
Notifications
You must be signed in to change notification settings - Fork 365
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
Sources/Completion item: Store non-copyable data. #851
Comments
I think the Sorry. I might not understand the problem. Could you explain more easily? |
Yeah, of course. We basically need some way to reference a non-serializable snippet in the completion-item, which proves to be kind of hard because all of the completion-item seems to be copied. I assumed that |
data
-table of completion-items
I think this is not correct, e.g. for |
I just tried it (which I could've done like 5 hours ago xD), seems like the entire completion-item is copied :/ I'm not certain if this really is something useful to completion-sources other than |
Hi!
It looks like the
data
-fiels of completion-items is copied at some place, which can cause issues ifdata
contains complicated structures eg. recursive tables.The specific issue is with
cmp_luasnip
, where we currently (because storing a reference doesn't work due to copying) have to store what amounts to an iterator, which might be invalidated (see here), making it necessary to rebuild the entire cache, even though no items were changed.I can see thre ways to solve this:
data
IMO 2 would be pretty nice, because there's no need to copy the snippets, at least in
cmp_luasnip
case.I wouldn't be opposed to 3, but it would only solve this problem for
cmp_luasnip
, not for other sources (which might be enough, I'm not sure if any other source has a similar problem).1 doesn't sound good, I don't think there's any cases where big, complicated structures should be copied, and it would probably worsen copy for simple tables.
I'm not sure if it's possible to do already (didn't find anything about it if it is 😅)
Thank you for your work on
nvim-cmp
❤️The text was updated successfully, but these errors were encountered: