Skip to content

Commit 54ecfc7

Browse files
committed
fix(help): sort readme tags case sensitive. Fixes #67
1 parent 4f27fc3 commit 54ecfc7

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

lua/lazy/help.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ function M.update()
6363
local lines = { [[!_TAG_FILE_ENCODING utf-8 //]] }
6464
Util.foreach(tags, function(_, tag)
6565
table.insert(lines, ("%s\t%s\t/%s"):format(tag.tag, tag.file, tag.line))
66-
end)
66+
end, { case_sensitive = true })
6767
Util.write_file(docs .. "/tags", table.concat(lines, "\n"))
6868
end
6969

lua/lazy/util.lua

+5-1
Original file line numberDiff line numberDiff line change
@@ -235,10 +235,14 @@ end
235235
---@generic V
236236
---@param t table<string, V>
237237
---@param fn fun(key:string, value:V)
238-
function M.foreach(t, fn)
238+
---@param opts? {case_sensitive?:boolean}
239+
function M.foreach(t, fn, opts)
239240
---@type string[]
240241
local keys = vim.tbl_keys(t)
241242
pcall(table.sort, keys, function(a, b)
243+
if opts and opts.case_sensitive then
244+
return a < b
245+
end
242246
return a:lower() < b:lower()
243247
end)
244248
for _, key in ipairs(keys) do

0 commit comments

Comments
 (0)