Skip to content

Conversation

@delphinus
Copy link

The current code uses vim.schedule_wrap to call vim.fn.jobstart for running rg. This can be replaced by uv.spawn that can be called “in fast event”. This makes it run rg as soon as cmp starts to complete.

But this change has 2 problems.

  • vim.fn.json_decode cannot be called in fast event. We should always use vim.json.decode, so we must remove support for Neovim older than v0.6.
  • uv.spawn always run a process directly (without shell). Now additional_arguments option should be an array instead of string.

I think benefits we can get by this change are larger than these breaking changes.

@lukas-reineke
Copy link
Owner

Does this actually make a different to the performance?
Can you profile this?

@xzbdmw
Copy link

xzbdmw commented Jun 22, 2024

I simply test by record duration between begining of complete() and where callback being called, it was 150ms before and 50ms now in init.lua file with debounce of 0.

The difference is vim.schedule_wrap is delayed by 100ms(depends on cmp bussyness) to start the job

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.

3 participants