mirror of
https://github.com/neovim/neovim.git
synced 2026-04-21 23:05:41 +00:00
fix(treesitter): highlight group for EditQuery captures #36265
fix(treesitter): more distinctive highlight for EditQuery captures Problem: EditQuery shows captures in the source buffer using the Title highlight group, which could be too similar to Normal. Solution: Use a virtual text diagnostic highlight group: they are displayed in a similar manner to the query captures so we can assume that the color scheme should have appropriate styling applied to make them visible.
This commit is contained in:
committed by
GitHub
parent
fd69b71119
commit
d0822bbd15
@@ -1582,9 +1582,11 @@ edit({lang}) *vim.treesitter.query.edit()*
|
|||||||
completes available parsers.
|
completes available parsers.
|
||||||
|
|
||||||
If you move the cursor to a capture name ("@foo"), text matching the
|
If you move the cursor to a capture name ("@foo"), text matching the
|
||||||
capture is highlighted in the source buffer. The query editor is a scratch
|
capture is highlighted with |hl-DiagnosticVirtualTextHint| in the source
|
||||||
buffer, use `:write` to save it. You can find example queries at
|
buffer.
|
||||||
`$VIMRUNTIME/queries/`.
|
|
||||||
|
The query editor is a scratch buffer, use `:write` to save it. You can
|
||||||
|
find example queries at `$VIMRUNTIME/queries/`.
|
||||||
|
|
||||||
Parameters: ~
|
Parameters: ~
|
||||||
• {lang} (`string?`) language to open the query editor for. If omitted,
|
• {lang} (`string?`) language to open the query editor for. If omitted,
|
||||||
|
|||||||
@@ -608,7 +608,7 @@ local function update_editor_highlights(query_win, base_win, lang)
|
|||||||
end_col = end_col,
|
end_col = end_col,
|
||||||
hl_group = 'Visual',
|
hl_group = 'Visual',
|
||||||
virt_text = {
|
virt_text = {
|
||||||
{ capture_name, 'Title' },
|
{ capture_name, 'DiagnosticVirtualTextHint' },
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1196,9 +1196,11 @@ end
|
|||||||
--- Can also be shown with the [:EditQuery]() command. `:EditQuery <tab>` completes available
|
--- Can also be shown with the [:EditQuery]() command. `:EditQuery <tab>` completes available
|
||||||
--- parsers.
|
--- parsers.
|
||||||
---
|
---
|
||||||
--- If you move the cursor to a capture name ("@foo"), text matching the capture is highlighted in
|
--- If you move the cursor to a capture name ("@foo"), text matching the capture is highlighted
|
||||||
--- the source buffer. The query editor is a scratch buffer, use `:write` to save it. You can find
|
--- with |hl-DiagnosticVirtualTextHint| in the source buffer.
|
||||||
--- example queries at `$VIMRUNTIME/queries/`.
|
---
|
||||||
|
--- The query editor is a scratch buffer, use `:write` to save it. You can find example queries
|
||||||
|
--- at `$VIMRUNTIME/queries/`.
|
||||||
---
|
---
|
||||||
--- @param lang? string language to open the query editor for. If omitted, inferred from the current buffer's filetype.
|
--- @param lang? string language to open the query editor for. If omitted, inferred from the current buffer's filetype.
|
||||||
function M.edit(lang)
|
function M.edit(lang)
|
||||||
|
|||||||
Reference in New Issue
Block a user