import { nvim_buf_set_extmark } from "https://deno.land/x/denops_std@v3.9.0/function/nvim/mod.ts";
Creates or updates an extmark.
To create a new extmark, pass id=0. The extmark id will be
returned. To move an existing mark, pass its id.
It is also allowed to create a new mark by passing in a
previously unused id, but the caller must then keep track of
existing and unused ids itself. (Useful over RPC, to avoid
waiting for the return value.)
Using the optional arguments, it is possible to use this to
highlight a range of text, and also to associate virtual text
to the mark.
Parameters: ~
{buffer} Buffer handle, or 0 for current buffer
{ns_id} Namespace id from |nvim_create_namespace()|
{line} Line where to place the mark, 0-based.
|api-indexing|
{col} Column where to place the mark, 0-based.
|api-indexing|
{opts} Optional parameters.
• id : id of the extmark to edit.
• end_line : ending line of the mark, 0-based
inclusive.
• end_col : ending col of the mark, 0-based
exclusive.
• hl_group : name of the highlight group used to
highlight this mark.
• hl_eol : when true, for a multiline highlight
covering the EOL of a line, continue the
highlight for the rest of the screen line
(just like for diff and cursorline highlight).
• virt_text : virtual text to link to this mark.
A list of [text, highlight] tuples, each
representing a text chunk with specified
highlight. highlight
element can either be a
a single highlight group, or an array of
multiple highlight groups that will be stacked
(highest priority last). A highlight group can
be supplied either as a string or as an
integer, the latter which can be obtained
using |nvim_get_hl_id_by_name|.
• virt_text_pos : position of virtual text.
Possible values:
• "eol": right after eol character (default)
• "overlay": display over the specified
column, without shifting the underlying
text.
• "right_align": display right aligned in the
window.
• virt_text_win_col : position the virtual text
at a fixed window column (starting from the
first text column)
• virt_text_hide : hide the virtual text when
the background text is selected or hidden due
to horizontal scroll 'nowrap'
• hl_mode : control how highlights are combined
with the highlights of the text. Currently
only affects virt_text highlights, but might
affect hl_group
in later versions.
• "replace": only show the virt_text color.
This is the default
• "combine": combine with background text
color
• "blend": blend with background text color.
• virt_lines : virtual lines to add next to this
mark This should be an array over lines, where
each line in turn is an array over [text,
highlight] tuples. In general, buffer and
window options do not affect the display of
the text. In particular 'wrap' and 'linebreak'
options do not take effect, so the number of
extra screen lines will always match the size
of the array. However the 'tabstop' buffer
option is still used for hard tabs. By default
lines are placed below the buffer line
containing the mark.
• virt_lines_above: place virtual lines above
instead.
• virt_lines_leftcol: Place extmarks in the
leftmost column of the window, bypassing sign
and number columns.
• ephemeral : for use with
|nvim_set_decoration_provider| callbacks. The
mark will only be used for the current redraw
cycle, and not be permantently stored in the
buffer.
• right_gravity : boolean that indicates the
direction the extmark will be shifted in when
new text is inserted (true for right, false
for left). defaults to true.
• end_right_gravity : boolean that indicates the
direction the extmark end position (if it
exists) will be shifted in when new text is
inserted (true for right, false for left).
Defaults to false.
• priority: a priority value for the highlight
group. For example treesitter highlighting
uses a value of 100.
Return: ~
Id of the created/updated extmark