mirror of
https://github.com/neovim/neovim.git
synced 2026-08-20 14:21:06 +00:00
build(docs): sort/lint class fields and keysets
Problem: Fields (key names) in classes, keysets, and quasi-keysets are ordered randomly, which adds friction when reading docs. Solution: - Sort class fields and keysets when generating docs. - Add a lint check for quasi-keysets (keysets defined as unstructured markdown lists within a docstring).
This commit is contained in:
@@ -610,6 +610,8 @@ local function inline_type(obj, classes)
|
||||
end
|
||||
end
|
||||
|
||||
util.sort_by_key(cls.fields, 'name')
|
||||
|
||||
local desc_append = {}
|
||||
for _, f in ipairs(cls.fields) do
|
||||
if not f.access then
|
||||
@@ -715,6 +717,8 @@ local function render_class(class, classes, hidden_fields, cfg)
|
||||
end, fields)
|
||||
end
|
||||
|
||||
util.sort_by_key(fields, 'name')
|
||||
|
||||
local fields_txt = render_fields_or_params(fields, nil, classes, cfg)
|
||||
if not fields_txt:match('^%s*$') then
|
||||
table.insert(ret, '\n Fields: ~\n')
|
||||
@@ -1145,6 +1149,7 @@ local function gen_target(cfg)
|
||||
|
||||
if not f:find('ui_events%.in%.h$') then -- TODO(justinmk): also lint UI events.
|
||||
lint.lint_names(f, funs, nil, classes)
|
||||
lint.lint_quasi_keysets(f, funs)
|
||||
end
|
||||
|
||||
local mod_cls_nm = find_module_class(classes, 'M')
|
||||
|
||||
Reference in New Issue
Block a user