Skip to content

Commit

Permalink
docs: fix custom_areas example
Browse files Browse the repository at this point in the history
Previously a new highlight was created and cached for each index.
For example when the result table only has a warning, an orange color
highlight will be created and cached for index 1. Then the user fixes
the warning but generates an error with index 1, the orange color will be
reused from the cache rather than creating a highlight for the
associated red color. Using an existing highlight with link will
avoid using that cache entirely.
  • Loading branch information
gepbird committed Jul 18, 2024
1 parent a096678 commit 9fedfd1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions doc/bufferline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1126,19 +1126,19 @@ to be shown in a list of tables. For example:
local hint = #vim.diagnostic.get(0, {severity = seve.HINT})

if error ~= 0 then
table.insert(result, {text = "  " .. error, fg = "#EC5241"})
table.insert(result, {text = "  " .. error, link = "DiagnosticError"})
end

if warning ~= 0 then
table.insert(result, {text = "  " .. warning, fg = "#EFB839"})
table.insert(result, {text = "  " .. warning, link = "DiagnosticWarn"})
end

if hint ~= 0 then
table.insert(result, {text = "  " .. hint, fg = "#A3BA5E"})
table.insert(result, {text = "  " .. hint, link = "DiagnosticHint"})
end

if info ~= 0 then
table.insert(result, {text = "  " .. info, fg = "#7EA9A7"})
table.insert(result, {text = "  " .. info, link = "DiagnosticInfo"})
end
return result
end,
Expand Down

0 comments on commit 9fedfd1

Please # to comment.