Skip to content

Commit

Permalink
style: deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Dec 6, 2024
1 parent d5451b0 commit 7cbc39f
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lua/noice/config/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ function M.setup(options)
end

function M.truncate_log()
local stat = vim.loop.fs_stat(M.options.log)
local stat = (vim.uv or vim.loop).fs_stat(M.options.log)
if stat and stat.size > M.options.log_max_size then
io.open(M.options.log, "w+"):close()
end
Expand Down
4 changes: 2 additions & 2 deletions lua/noice/util/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ function M.wo(win, options)
end

function M.debounce(ms, fn)
local timer = vim.loop.new_timer()
local timer = (vim.uv or vim.loop).new_timer()
return function(...)
local argv = vim.F.pack_len(...)
timer:start(ms, 0, function()
Expand All @@ -119,7 +119,7 @@ end
---@return F|Interval
function M.interval(ms, fn, opts)
opts = opts or {}
---@type vim.loop.Timer?
---@type uv.uv_timer_t
local timer = nil

---@class Interval
Expand Down
2 changes: 1 addition & 1 deletion lua/noice/util/spinners.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ local M = {}
function M.spin(name)
name = name or "dots"
local spinner = M.spinners[name] or M.spinners["dots"]
local ms = vim.loop.hrtime() / 1000000
local ms = (vim.uv or vim.loop).hrtime() / 1000000
local frame = math.floor(ms / spinner.interval) % #spinner.frames
return spinner.frames[frame + 1]
end
Expand Down
2 changes: 1 addition & 1 deletion lua/noice/view/backend/mini.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ end

function MiniView:autohide(id)
if not self.timers[id] then
self.timers[id] = vim.loop.new_timer()
self.timers[id] = (vim.uv or vim.loop).new_timer()
end
self.timers[id]:start(self._opts.timeout, 0, function()
if not self.active[id] then
Expand Down
11 changes: 6 additions & 5 deletions lua/noice/view/backend/notify_send.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ local require = require("noice.util.lazy")

local Util = require("noice.util")
local View = require("noice.view")
local uv = vim.uv or vim.loop

---@class NoiceNotifySendOptions
---@field title string
Expand Down Expand Up @@ -90,14 +91,14 @@ function NotifySendView:_notify(msg)
if opts.body then
table.insert(args, vim.trim(opts.body))
end
local stdout = vim.loop.new_pipe()
local stderr = vim.loop.new_pipe()
local stdout = assert(uv.new_pipe())
local stderr = assert(uv.new_pipe())

local out = ""
local err = ""

local proc
proc = vim.loop.spawn(
proc = uv.spawn(
"notify-send",
{
stdio = { nil, stdout, stderr },
Expand All @@ -116,12 +117,12 @@ function NotifySendView:_notify(msg)
end)
)

vim.loop.read_start(stdout, function(_, data)
uv.read_start(stdout, function(_, data)
if data then
out = out .. data
end
end)
vim.loop.read_start(stderr, function(_, data)
uv.read_start(stderr, function(_, data)
if data then
err = err .. data
end
Expand Down

0 comments on commit 7cbc39f

Please sign in to comment.