-
Notifications
You must be signed in to change notification settings - Fork 411
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
feat: cmp async #1583
feat: cmp async #1583
Conversation
a2b7e07
to
b23ad7c
Compare
Just fixed the tests. Ready for testing by anyone that feels up for it :) |
@yioneko would be great if you could also review this |
Nice work! I believe this will completely remove any user-blocking experience. |
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.
I've tested locally and this works fine for me.
I removed pre-filtering from The resulting items in the entries view are now always correct according to the scoring. See d1136e5 |
Contexts can now be aborted. Any running |
Just tested out your PR @folke. Note, I am not authoritative since I only dabble in Tailwind occasionally, but this PR makes nvim-cmp absolutely buttery smooth with the Tailwind Language Server. A beautiful developer experience to code and not stall. This PR definitely works very well alongside the previous PR; actually in my case this PR has more of an effect than the previous PR; though both compliment each other very well. Two big thumbs up from me. |
Thanks! |
That pr has been merged already and this pr is a continuation of that pr. It depends on those changes |
I get what you mean now 🙂 Yes, this pr will have a bigger effect. The other pr mainly fixed a memory leak |
Thank you so much for your PR! |
@hrsh7th did most of the requested changes. For the rest, see my comments. Thank you for reviewing! |
It's perfect to me! Thank you again! |
Awesome, thank you for merging! |
…indow * upstream/main: (31 commits) fix entry highlight in complete-menu (hrsh7th#1593) Remove max_item_count from source configuration feat: cmp async (hrsh7th#1583) ghost text inline (hrsh7th#1588) Fix demo video in README.md (hrsh7th#1585) docs: fix adjecent typo (hrsh7th#1577) docs: fix typos, add confirm.behavior example cfg (hrsh7th#1576) perf(source): only filter up to 200 entries and dont use the cache (hrsh7th#1574) fix(ghost_text): safely apply virtual_text highlight (hrsh7th#1563) Improve misc.merge Fix hrsh7th#897 Added a modified=false to documentation buffer, so it can be removed without E89 errors (hrsh7th#1557) Fix hrsh7th#1556 fix 1533, add regression test (hrsh7th#1558) Add `buftype=nofile` for entries_win and docs_win - reddit user mention this... Fix hrsh7th#1550 Format with stylua Add test for hrsh7th#1552 Close hrsh7th#1552 Revert hrsh7th#1534 temporaly fix typo (hrsh7th#1551) ...
This is because after hrsh7th/nvim-cmp#1583 was merged, plugins that cannot work within the lua event loop cause an error.
Made part of cmp async.
async.new
: starts a new coroutine that will resume at most 1ms per vim.loop tick. Returns anAsync
async.yield
: when called from inside a coroutine, this will yield. Does nothing when not in an async contextasync.wrap
: wraps a function thatasync.new
for every invocationAsync:await
: you can either pass a callback that gets executed when the async finishes, ornil
, to synchonously wait and get the resultAsync:cancel
: cancels the running function on next yieldsource.get_entries
: addedasync.yield
in the main loop. This method can still be called from outside an async function, but then it will of course not automatically re-schedule on the loop when taking too longsource.complete
to make sure the context is still the same as the one we're completingasync.throttle
to properly deal with async functions in terms ofrunning
andcancelling
This PR removes all stuttering from taildwind (biggest offender).