Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(render): dim housekeeping commits by default #612

Merged
merged 2 commits into from
Mar 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lua/lazy/view/colors.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ M.colors = {
CommitIssue = "Number",
CommitType = "Title", -- conventional commit type
CommitScope = "Italic", -- conventional commit scope
Dimmed = "Conceal", -- property
Prop = "Conceal", -- property
Value = "@string", -- value of a property
NoCond = "DiagnosticWarn", -- unloaded icon for a plugin where `cond()` was false
Expand Down
2 changes: 2 additions & 0 deletions lua/lazy/view/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ function M.get_commands()
return ret
end

M.dimmed_commits = { "build", "ci", "chore", "doc" }

M.keys = {
hover = "K",
diff = "d",
Expand Down
12 changes: 9 additions & 3 deletions lua/lazy/view/render.lua
Original file line number Diff line number Diff line change
Expand Up @@ -456,15 +456,21 @@ function M:log(task)
self:diagnostic({ message = "Breaking Changes", severity = vim.diagnostic.severity.WARN })
end
self:append(ref:sub(1, 7) .. " ", "LazyCommit", { indent = 6 })
self:append(vim.trim(msg)):highlight({

local dimmed = false
for _, dim in ipairs(ViewConfig.dimmed_commits) do
if msg:find("^" .. dim) then
dimmed = true
end
end
self:append(vim.trim(msg), dimmed and "LazyDimmed" or nil):highlight({
["#%d+"] = "LazyCommitIssue",
["^%S+:"] = "LazyCommitType",
["^%S+:"] = dimmed and "Bold" or "LazyCommitType",
["^%S+(%(.*%)):"] = "LazyCommitScope",
["`.-`"] = "@text.literal.markdown_inline",
["%*.-%*"] = "Italic",
["%*%*.-%*%*"] = "Bold",
})
-- string.gsub
self:append(" " .. time, "LazyComment")
self:nl()
end
Expand Down