fix(restart): keep :restart error message concise #40746

This commit is contained in:
Olivia Kinnear
2026-07-15 18:05:46 -05:00
committed by GitHub
parent 31ad7d4527
commit 4f1ef2dec1
2 changed files with 28 additions and 14 deletions

View File

@@ -1,5 +1,7 @@
-- For "--listen", ":restart", and related remote/server functionality.
local util = require('vim._core.util')
local M = {}
--- Called by builtin serverlist(). Returns the combined server list (own + peers).
@@ -204,8 +206,16 @@ function M.ex_session_restart(eap, extra)
end)
if not success then
--- @cast msg string
vim.fs.rm(session, { force = true })
error(msg)
-- Trim error message to be equivalent to `:restart!`
local trimmed_msg = msg:match('Vim:.*$')
if trimmed_msg then
util.echo_err(trimmed_msg:sub(5))
else
error(msg)
end
end
end