mirror of
https://github.com/neovim/neovim.git
synced 2025-10-08 02:46:31 +00:00
feat(ui): allow conceal to be defined in decorations
Unlike syntax conceal, change highlight of concealed char Can be used in tree-sitter using "conceal" metadata.
This commit is contained in:
@@ -467,6 +467,11 @@ Array nvim_buf_get_extmarks(Buffer buffer, Integer ns_id, Object start, Object e
|
||||
/// as the mark and 'cursorline' is enabled.
|
||||
/// Note: ranges are unsupported and decorations are only
|
||||
/// applied to start_row
|
||||
/// - conceal: string which should be either empty or a single
|
||||
/// character. Enable concealing similar to |:syn-conceal|.
|
||||
/// When a character is supplied it is used as |:syn-cchar|.
|
||||
/// "hl_group" is used as highlight for the cchar if provided,
|
||||
/// otherwise it defaults to |hl-Conceal|.
|
||||
///
|
||||
/// @param[out] err Error details, if any
|
||||
/// @return Id of the created/updated extmark
|
||||
@@ -563,6 +568,17 @@ Integer nvim_buf_set_extmark(Buffer buffer, Integer ns_id, Integer line, Integer
|
||||
}
|
||||
}
|
||||
|
||||
if (opts->conceal.type == kObjectTypeString) {
|
||||
String c = opts->conceal.data.string;
|
||||
decor.conceal = true;
|
||||
if (c.size) {
|
||||
decor.conceal_char = utf_ptr2char((const char_u *)c.data);
|
||||
}
|
||||
} else if (HAS_KEY(opts->conceal)) {
|
||||
api_set_error(err, kErrorTypeValidation, "conceal is not a String");
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (opts->virt_text.type == kObjectTypeArray) {
|
||||
decor.virt_text = parse_virt_text(opts->virt_text.data.array, err,
|
||||
&decor.virt_text_width);
|
||||
|
@@ -27,6 +27,7 @@ return {
|
||||
"number_hl_group";
|
||||
"line_hl_group";
|
||||
"cursorline_hl_group";
|
||||
"conceal";
|
||||
};
|
||||
keymap = {
|
||||
"noremap";
|
||||
|
Reference in New Issue
Block a user