aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/generators/gen_api_dispatch.lua
diff options
context:
space:
mode:
authorglepnir <glephunter@gmail.com>2024-01-17 20:14:26 +0800
committerglepnir <glephunter@gmail.com>2024-01-20 21:31:11 +0800
commit646fdf1073433e2bdeec3433f6cbdf8f4be37098 (patch)
treeabb6c88e011a52bc3900aee40fe0cab6ce77a95d /src/nvim/generators/gen_api_dispatch.lua
parentba9f86a9cee58dc32ab875da1fd7eac9bc9e88d7 (diff)
downloadrneovim-646fdf1073433e2bdeec3433f6cbdf8f4be37098.tar.gz
rneovim-646fdf1073433e2bdeec3433f6cbdf8f4be37098.tar.bz2
rneovim-646fdf1073433e2bdeec3433f6cbdf8f4be37098.zip
refactor(api): use hl id directly in nvim_buf_set_extmark
Diffstat (limited to 'src/nvim/generators/gen_api_dispatch.lua')
-rw-r--r--src/nvim/generators/gen_api_dispatch.lua17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/nvim/generators/gen_api_dispatch.lua b/src/nvim/generators/gen_api_dispatch.lua
index 791edfff96..3fb240d70b 100644
--- a/src/nvim/generators/gen_api_dispatch.lua
+++ b/src/nvim/generators/gen_api_dispatch.lua
@@ -72,6 +72,7 @@ local keysets = {}
local function add_keyset(val)
local keys = {}
local types = {}
+ local hlgroups = {}
local is_set_name = 'is_set__' .. val.keyset_name .. '_'
local has_optional = false
for i, field in ipairs(val.fields) do
@@ -80,6 +81,7 @@ local function add_keyset(val)
end
if field.name ~= is_set_name and field.type ~= 'OptionalKeys' then
table.insert(keys, field.name)
+ hlgroups[field.name] = field.name:find('hl_group') and true or false
else
if i > 1 then
error("'is_set__{type}_' must be first if present")
@@ -91,10 +93,13 @@ local function add_keyset(val)
has_optional = true
end
end
- table.insert(
- keysets,
- { name = val.keyset_name, keys = keys, types = types, has_optional = has_optional }
- )
+ table.insert(keysets, {
+ name = val.keyset_name,
+ keys = keys,
+ types = types,
+ hlgroups = hlgroups,
+ has_optional = has_optional,
+ })
end
-- read each input file, parse and append to the api metadata
@@ -305,10 +310,12 @@ for _, k in ipairs(keysets) do
.. typename(k.types[key])
.. ', '
.. ind
+ .. ', '
+ .. (k.hlgroups[key] and 'true' or 'false')
.. '},\n'
)
end
- output:write(' {NULL, 0, kObjectTypeNil, -1},\n')
+ output:write(' {NULL, 0, kObjectTypeNil, -1, false},\n')
output:write('};\n\n')
output:write(hashfun)