From 49086862fc521c29dd8fb7c96cc23a267f1bf397 Mon Sep 17 00:00:00 2001 From: glepnir Date: Sun, 12 Apr 2026 20:38:35 +0800 Subject: fix(api): nvim_get_hl drops groups defined with link_global #38492 Problem: hlgroup2dict passes &ns_id to ns_get_hl twice. The first call (link=true) sets *ns_hl = 0 when link_global is set, so the second call and the sg_cleared guard both see ns_id == 0 and bail out. The group is silently dropped from the result. Solution: use a temporary copy of ns_id for each ns_get_hl call so the original value is preserved. --- runtime/lua/vim/_meta/api.lua | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'runtime/lua/vim/_meta/api.lua') diff --git a/runtime/lua/vim/_meta/api.lua b/runtime/lua/vim/_meta/api.lua index 9cc40a30ba..e9754ed8b5 100644 --- a/runtime/lua/vim/_meta/api.lua +++ b/runtime/lua/vim/_meta/api.lua @@ -2225,29 +2225,29 @@ function vim.api.nvim_set_decoration_provider(ns_id, opts) end --- `nvim_set_hl_ns()` or `nvim_win_set_hl_ns()` to activate them. --- @param name string Highlight group name, e.g. "ErrorMsg" --- @param val vim.api.keyset.highlight Highlight definition map, accepts the following keys: +--- - altfont: boolean --- - bg: color name or "#RRGGBB", see note. --- - bg_indexed: boolean (default false) If true, bg is a terminal palette index (0-255). --- - blend: integer between 0 and 100 +--- - blink: boolean +--- - bold: boolean +--- - conceal: boolean Concealment at the UI level (terminal SGR), unrelated to `:syn-conceal`. --- - cterm: cterm attribute map, like `highlight-args`. If not set, cterm attributes --- will match those from the attribute map documented above. --- - ctermbg: Sets background of cterm color `ctermbg` --- - ctermfg: Sets foreground of cterm color `ctermfg` --- - default: boolean Don't override existing definition `:hi-default` +--- - dim: boolean --- - fg: color name or "#RRGGBB", see note. --- - fg_indexed: boolean (default false) If true, fg is a terminal palette index (0-255). --- - force: if true force update the highlight group when it exists. ---- - link: Name of highlight group to link to. `:hi-link` ---- - sp: color name or "#RRGGBB" ---- - update: boolean (default false) Update specified attributes only, leave others unchanged. ---- - altfont: boolean ---- - blink: boolean ---- - bold: boolean ---- - conceal: boolean Concealment at the UI level (terminal SGR), unrelated to `:syn-conceal`. ---- - dim: boolean --- - italic: boolean +--- - link: Name of highlight group to link to. `:hi-link` +--- - link_global: Like "link", but always resolved in the global (ns=0) namespace. --- - nocombine: boolean --- - overline: boolean --- - reverse: boolean +--- - sp: color name or "#RRGGBB" --- - standout: boolean --- - strikethrough: boolean --- - undercurl: boolean @@ -2255,6 +2255,7 @@ function vim.api.nvim_set_decoration_provider(ns_id, opts) end --- - underdotted: boolean --- - underdouble: boolean --- - underline: boolean +--- - update: boolean (default false) Update specified attributes only, leave others unchanged. function vim.api.nvim_set_hl(ns_id, name, val) end --- Set active namespace for highlights defined with `nvim_set_hl()`. This can be set for -- cgit