From 70f1ab8bb87e93c9ca0f4fb9bb4b7d8c2271732e Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Tue, 7 Nov 2023 17:52:08 -0700 Subject: [PATCH] fix: use vim.uv instead of vim.loop if it exists --- lua/colorsaver/file_watcher.lua | 3 ++- lua/colorsaver/utils.lua | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lua/colorsaver/file_watcher.lua b/lua/colorsaver/file_watcher.lua index 3034102..9335464 100644 --- a/lua/colorsaver/file_watcher.lua +++ b/lua/colorsaver/file_watcher.lua @@ -18,7 +18,8 @@ function FileWatcher.new(path, callback) self.path = path self.callback = callback -- Initialize the file system watcher with libuv. - self.fs_watcher = vim.loop.new_fs_event() + local uv = vim.uv or vim.loop + self.fs_watcher = uv.new_fs_event() return self end diff --git a/lua/colorsaver/utils.lua b/lua/colorsaver/utils.lua index a88d3dd..35083ee 100644 --- a/lua/colorsaver/utils.lua +++ b/lua/colorsaver/utils.lua @@ -22,7 +22,8 @@ function M.debounce(func, delay) end -- Create a new timer. - timer = vim.loop.new_timer() + local uv = vim.uv or vim.loop + timer = uv.new_timer() -- Start the timer with the specified delay. timer:start(