fix(pack): rename confirmation buffer to again use nvim-pack:// scheme

Problem: `nvim://` scheme feels more like a generalized interface that
  may be requested externally, and it acts like CLI args (roughly).
  This is how `vscode://` works.

  Anything that behaves like an "app" or a "protocol" deserves its own
  scheme. For such Nvim-owned things they will be called `nvim-xx://`.

Solution: Use `nvim-pack://confirm#<bufnr>` template for confirmation
  buffer name instead of `nvim://pack-confirm#<bufnr>`.
This commit is contained in:
Evgeni Chasnovski
2025-11-14 12:07:03 +02:00
parent b151aa761f
commit f492f62c3d
4 changed files with 6 additions and 6 deletions

View File

@@ -283,7 +283,7 @@ mappings to a specific action by invoking `vim.lsp.buf.code_action()` with the
Example: See `runtime/lua/vim/pack/_lsp.lua` for how vim.pack defines an Example: See `runtime/lua/vim/pack/_lsp.lua` for how vim.pack defines an
in-process LSP server to provide interactive features in its in-process LSP server to provide interactive features in its
`nvim://pack-confirm` buffer. `nvim-pack://confirm` buffer.
============================================================================== ==============================================================================
Troubleshooting *lua-plugin-troubleshooting* Troubleshooting *lua-plugin-troubleshooting*

View File

@@ -1057,7 +1057,7 @@ end
local function show_confirm_buf(lines, on_finish) local function show_confirm_buf(lines, on_finish)
-- Show buffer in a separate tabpage -- Show buffer in a separate tabpage
local bufnr = api.nvim_create_buf(true, true) local bufnr = api.nvim_create_buf(true, true)
api.nvim_buf_set_name(bufnr, 'nvim://pack-confirm#' .. bufnr) api.nvim_buf_set_name(bufnr, 'nvim-pack://confirm#' .. bufnr)
api.nvim_buf_set_lines(bufnr, 0, -1, false, lines) api.nvim_buf_set_lines(bufnr, 0, -1, false, lines)
vim.cmd.sbuffer({ bufnr, mods = { tab = vim.fn.tabpagenr() } }) vim.cmd.sbuffer({ bufnr, mods = { tab = vim.fn.tabpagenr() } })
local tab_id = api.nvim_get_current_tabpage() local tab_id = api.nvim_get_current_tabpage()

View File

@@ -20,7 +20,7 @@ function methods.shutdown(_, callback)
end end
local get_confirm_bufnr = function(uri) local get_confirm_bufnr = function(uri)
return tonumber(uri:match('^nvim://pack%-confirm#(%d+)$')) return tonumber(uri:match('^nvim%-pack://confirm#(%d+)$'))
end end
local group_header_pattern = '^# (%S+)' local group_header_pattern = '^# (%S+)'

View File

@@ -1220,7 +1220,7 @@ describe('vim.pack', function()
local confirm_bufnr = api.nvim_get_current_buf() local confirm_bufnr = api.nvim_get_current_buf()
local confirm_winnr = api.nvim_get_current_win() local confirm_winnr = api.nvim_get_current_win()
local confirm_tabpage = api.nvim_get_current_tabpage() local confirm_tabpage = api.nvim_get_current_tabpage()
eq(api.nvim_buf_get_name(0), 'nvim://pack-confirm#' .. confirm_bufnr) eq(api.nvim_buf_get_name(0), 'nvim-pack://confirm#' .. confirm_bufnr)
-- Adjust lines for a more robust screenshot testing -- Adjust lines for a more robust screenshot testing
local fetch_src = repos_src.fetch local fetch_src = repos_src.fetch
@@ -1270,10 +1270,10 @@ describe('vim.pack', function()
short_hashes.fetch_new_prev = git_get_short_hash('main~', 'fetch') short_hashes.fetch_new_prev = git_get_short_hash('main~', 'fetch')
hashes.semver_head = git_get_hash('v0.3.0', 'semver') hashes.semver_head = git_get_hash('v0.3.0', 'semver')
local tab_name = 'n' .. (t.is_os('win') and ':' or '') .. '//pack-confirm#2' local tab_name = 'n' .. (t.is_os('win') and ':' or '') .. '//confirm#2'
local screen_lines = { local screen_lines = {
('{24: [No Name] }{5: %s }{2:%s }{24:X}|'):format( ('{24: [No Name] }{5: %s }{2:%s }{24:X}|'):format(
tab_name, tab_name,
t.is_os('win') and '' or ' ' t.is_os('win') and '' or ' '
), ),