none-ls.nvim icon indicating copy to clipboard operation
none-ls.nvim copied to clipboard

WIP/RFC: `dynamic_command` is now async, and runs immediately when opening buffers

Open jfly opened this issue 1 year ago • 1 comments

This implements https://github.com/nvimtools/none-ls.nvim/issues/193.

This is incomplete, which is why I've marked it as draft. It's also stacked on top of https://github.com/nvimtools/none-ls.nvim/pull/192, and includes the commits from that PR. Just ignore the first 2 commits in this PR and focus on the last one ("WIP/RFC: dynamic_command is now async, and runs immediately when opening buffers").

I've redefined dynamic_command to be an async function, but I haven't actually updated all the builtins accordingly. I have updated nix_flake_fmt to demonstrate the idea.

If folks like the direction I'm going with this, I'll polish up the PR so all dynamic_commands are async, and I'll get the tests passing.

nvim-2024-10-11_16.00.32.webm

jfly avatar Oct 11 '24 20:10 jfly

@lassulus, FYI with this change I think slow nix flake eval time is basically unnoticeable =)

jfly avatar Oct 11 '24 21:10 jfly

please fix the failing ci checks, thanks!

mochaaP avatar Dec 02 '24 09:12 mochaaP

@mochaaP, I've rebased this, it's now ready for review. A couple changes:

  1. I've removed the dependency on https://github.com/nvimtools/none-ls.nvim/pull/192. This just makes dynamic_command async, and adds a corresponding cache helper for async functions.
  2. I've removed the logic to start computing the dynamic_command the moment we open a buffer. That got a little tricky, so I plan to do it in a followup PR.

jfly avatar Dec 17 '24 00:12 jfly

Thanks, @mochaaP! I'll rebase https://github.com/nvimtools/none-ls.nvim/pull/192 on top of this now.

jfly avatar Dec 17 '24 20:12 jfly