Skip to content

Commit

Permalink
fix(inlayHint): more compact padding highlight group (#4950)
Browse files Browse the repository at this point in the history
If the chunk is an array with a single string, the highlight group only uses
the foreground of `Normal`, which makes `cursorline` look better.
  • Loading branch information
kevinhwang91 committed Mar 21, 2024
1 parent b01ae44 commit 846994b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/handler/inlayHint/buffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,16 +194,16 @@ export default class InlayHintBuffer implements SyncItem {
nvim.pauseNotification()
buffer.clearNamespace(srcId, range.start.line, range.end.line + 1)
for (const item of inlayHints) {
const chunks: [string, string][] = []
const chunks = []
let { position } = item
let line = this.doc.getline(position.line)
let col = byteIndex(line, position.character) + 1
if (item.paddingLeft) {
chunks.push([' ', 'Normal'])
chunks.push([' '])
}
chunks.push([getLabel(item), getHighlightGroup(item.kind)])
if (item.paddingRight) {
chunks.push([' ', 'Normal'])
chunks.push([' '])
}
buffer.setVirtualText(srcId, position.line, chunks, { col, hl_mode: 'replace' })
}
Expand Down

0 comments on commit 846994b

Please sign in to comment.