mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
fix(lsp): ensure open_logfile is safe for fast events (#21288)
Closes https://github.com/neovim/neovim/issues/21052
This commit is contained in:
parent
ec6ba87229
commit
b098e7971f
@ -20,6 +20,17 @@ local format_func = function(arg)
|
|||||||
end
|
end
|
||||||
|
|
||||||
do
|
do
|
||||||
|
---@private
|
||||||
|
local function notify(msg, level)
|
||||||
|
if vim.in_fast_event() then
|
||||||
|
vim.schedule(function()
|
||||||
|
vim.notify(msg, level)
|
||||||
|
end)
|
||||||
|
else
|
||||||
|
vim.notify(msg, level)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local path_sep = vim.loop.os_uname().version:match('Windows') and '\\' or '/'
|
local path_sep = vim.loop.os_uname().version:match('Windows') and '\\' or '/'
|
||||||
---@private
|
---@private
|
||||||
local function path_join(...)
|
local function path_join(...)
|
||||||
@ -53,7 +64,7 @@ do
|
|||||||
logfile, openerr = io.open(logfilename, 'a+')
|
logfile, openerr = io.open(logfilename, 'a+')
|
||||||
if not logfile then
|
if not logfile then
|
||||||
local err_msg = string.format('Failed to open LSP client log file: %s', openerr)
|
local err_msg = string.format('Failed to open LSP client log file: %s', openerr)
|
||||||
vim.notify(err_msg, vim.log.levels.ERROR)
|
notify(err_msg, vim.log.levels.ERROR)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -64,7 +75,7 @@ do
|
|||||||
log_info.size / (1000 * 1000),
|
log_info.size / (1000 * 1000),
|
||||||
logfilename
|
logfilename
|
||||||
)
|
)
|
||||||
vim.notify(warn_msg)
|
notify(warn_msg)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Start message for logging
|
-- Start message for logging
|
||||||
|
Loading…
Reference in New Issue
Block a user