summaryrefslogtreecommitdiffstatshomepage
path: root/src/nvim/api/extmark.c
AgeCommit message (Collapse)AuthorFiles
2026-04-15refactor(api): rename buffer to buf (positional parameters) #39013Justin M. Keyes1
In 3a4a66017b74, 4d3a67cd6201, df8d98173cbc we renamed "buffer" to "buf" in dict parameters and return-values. This commit renames positional parameters. This is only "cosmetic", but is intended to make it extra clear which name is preferred, since people often copy existing code despite the guidelines in `:help dev-naming`.
2026-03-24docs: api, plugins, ui2Justin M. Keyes1
2026-03-09feat(extmark): support end_col=-1 if strict=false #28169Stefan Novaković1
Problem: There is an inconsistency between extmarks/highlights regarding the `end_col` param. Solution: Allow end_col=-1 to mean "end of line" (if strict=false). Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2025-09-26fix(highlight): ensure extmark range is within buffer bounds #35928skewb1k1
Adds an additional check for the case when end_col = 0, addressing https://github.com/neovim/neovim/issues/35814#issuecomment-3340709532. Validation is now localized to the highlighter without affecting the C API.
2025-09-24fix(highlight): allow ephemeral extmarks past final newline #35888skewb1k1
Fixes #35814 Note: this is a temporary workaround; proper concurrency-safe handling of highlighting should be investigated.
2025-09-09fix(treesitter): use subpriorities for tree orderingbfredl1
This partially reverts 0b8a72b73934d33a05e20c255298e88cd921df32, that is unreverts 15e77a56b711102fdc123e15b3f37d49bc0b1df1 "priority" is an internal neovim concept which does not occur in shared queries. Ideally a single priority space should eventually be enough for our needs. But as we don't want to poke at the usages of priorities right now in the wider ecosystem, introduce the "subpriorities" so that treesitter code can distinguish highlights of the same priorities with different tree nesting depth. This mainly affects `injection.combined` as parent-tree nodes might appear in the middle of child-tree nodes which otherwise is not possible.
2025-09-09perf(highlight): allow decoration providers to skip ranges without databfredl1
Continuing the work of #31400 That PR allowed the provider to be invoked multiple times per line. We want only to do that when there actually is more data later on the line. Additionally, we want to skip over lines which contain no new highlight items. The TS query cursor already tells us what the next position with more data is, so there is no need to reinvoke the range callback before that. NB: this removes the double buffering introduced in #32619 which is funtamentally incompatible with this (nvim core is supposed to keep track of long ranges by itself, without requiring a callback reinvoke blitz). Need to adjust the priorities some other way to fix the same issue.
2025-09-06docs: `details` dict in nvim_buf_get_extmark() #35289Phạm Bình An1
Problem: The document of nvim_buf_get_extmark currently lacks the following: - "details" directory: nvim_buf_get_extmarks() allows an option details to get a "details" directory in result, but it doesn't mention where that "details" directory is, what fields does it have. Solution: Add docs for "details" directory in nvim_buf_get_extmarks()
2025-09-03docs: lsp, miscJustin M. Keyes1
- Problem: It's not clear for new plugin developers that `:help` uses a help-tags file for searching the docs, generated by `:helptags`. - Solution: Hint to the |:helptags| docs for regenerating the tags file for their freshly written documentation. Co-authored-by: Yochem van Rosmalen <git@yochem.nl>
2025-08-28perf: add on_range in treesitter highlightingvanaigr1
2025-08-14refactor(build): remove INCLUDE_GENERATED_DECLARATIONS guardsbfredl1
These are not needed after #35129 but making uncrustify still play nice with them was a bit tricky. Unfortunately `uncrustify --update-config-with-doc` breaks strings with backslashes. This issue has been reported upstream, and in the meanwhile auto-update on every single run has been disabled.
2025-06-26docs(api): document types using LuaCATS typesLewis Russell1
- Render Lua types in api.txt. - Added `DictAs(name)` API type which acts the same as `Dict` (no parens) when generating the dispatchers, but acts the same as `Dict(name)` when generating docs. - Added `Tuple(...)` API type which is the treated the as `Array` for generating the dispatchers, but is used to document richer types. - Added `Enum(...)` API type to better document enums - Improve typing of some API functions. - Improve c_grammar to properly parse API types and replace string pattern logic in the parsers. - Removed all the hardcoded type overrides in gen_eval_files.lua
2025-06-18docs: api, miscJustin M. Keyes1
2025-04-21fix(api): wrong return value with reverse range + overlap #32956luukvbaal1
Problem: When iterating in reverse with {start} > {end} in `nvim_buf_get_extmarks()`, marks that overlap {start} and are greater than {end} are included in the return value twice. Marks that overlap {end} and do not overlap {start} are not not included in the return value at all. Marks are not actually returned in a meaningful "traversal order". Solution: Rather than actually iterating in reverse, (also possible but requires convoluted conditions and would require fetching overlapping marks for both the {start} and {end} position, while still ending up with non-traversal ordered marks), iterate normally and reverse the return value.
2025-03-17docs(api): rename "handle" => "id"Justin M. Keyes1
2025-03-15docs: miscdundargoc1
Co-authored-by: Au. <acehinnnqru@gmail.com> Co-authored-by: Daniel Rainer <daniel.rainer@localhost> Co-authored-by: Evgeni Chasnovski <evgeni.chasnovski@gmail.com> Co-authored-by: Lewis Russell <lewis6991@gmail.com> Co-authored-by: Luuk van Baal <luukvbaal@gmail.com> Co-authored-by: Pierre Barbin <pierre@heitzsystem.com> Co-authored-by: Riley Bruins <ribru17@hotmail.com> Co-authored-by: Yinzuo Jiang <jiangyinzuo@foxmail.com> Co-authored-by: phanium <91544758+phanen@users.noreply.github.com> Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2025-02-26fix(extmark): clearer error message for invalid ephemeral mark usageRiley Bruins1
2025-02-25feat(treesitter): vertical conceal support for highlighterLuuk van Baal1
TSHighlighter now places marks for conceal_lines metadata. A new internal decor provider callback _on_conceal_line was added that instructs the highlighter to place conceal_lines marks whenever the editor needs to know whether a line is concealed. The bundled markdown queries use conceal_lines metadata to conceal code block fence lines.
2025-02-25feat(marks): add conceal_lines to nvim_buf_set_extmark()Luuk van Baal1
Implement an extmark property that conceals lines vertically.
2025-02-20feat(marks): virtual lines support horizontal scrolling (#32497)zeertzjq1
Add a new field `virt_lines_overflow` that enables horizontal scrolling for virtual lines when set to "scroll".
2025-02-17docs: misc (#32258)dundargoc1
Co-authored-by: Evgeni Chasnovski <evgeni.chasnovski@gmail.com> Co-authored-by: Julian Visser <12615757+justmejulian@users.noreply.github.com> Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2025-01-26refactor(api): add missing cast #31960glepnir1
2025-01-24feat(extmarks): virtual text can be right-aligned, truncated #31921georgev931
Problem: Right aligned virtual text can cover up buffer text if virtual text is too long Solution: An additional option for `virt_text_pos` called `eol_right_align` has been added to truncate virtual text if it would have otherwise covered up buffer text. This ensures the virtual text extends no further left than EOL.
2025-01-21Merge pull request #32098 from bfredl/multihl_groupbfredl1
feat(extmark): stack multiple highlight groups in `hl_group`
2025-01-21feat(extmark): stack multiple highlight groups in `hl_group`bfredl1
This has been possible in the "backend" for a while but API was missing. Followup: we will need a `details2=true` mode for `nvim_get_hl_id_by_name` to return information in a way forward compatible with even further enhancements.
2025-01-20feat(api): deprecate nvim_buf_add_highlight()bfredl1
This was kept for a while as it was a useful short hand and initially matched what highlights what actually properly implemented. But now |vim.hl.range()| is a better high-level shorthand with full support for native multi-line ranges.
2024-12-23refactor: iwyu #31637Justin M. Keyes1
Result of `make iwyu` (after some "fixups").
2024-12-19docs(api): specify when decor provider on_buf is called #31634luukvbaal1
2024-11-16fix(api): validation, documentation of hl_group #31195luukvbaal1
Problem: Documentation for "hl_group" in nvim_buf_set_extmark() is unclear. "hl_group" in nvim_echo() does not accept highlight group id. Solution: Move documentation for highlight group name/id to first mention of hl_group. Update nvim_echo() to accept highlight group id.
2024-09-23refactor(api)!: rename Dictionary => DictJustin M. Keyes1
In the api_info() output: :new|put =map(filter(api_info().functions, '!has_key(v:val,''deprecated_since'')'), 'v:val') ... {'return_type': 'ArrayOf(Integer, 2)', 'name': 'nvim_win_get_position', 'method': v:true, 'parameters': [['Window', 'window']], 'since': 1} The `ArrayOf(Integer, 2)` return type didn't break clients when we added it, which is evidence that clients don't use the `return_type` field, thus renaming Dictionary => Dict in api_info() is not (in practice) a breaking change.
2024-08-30feat(mbyte): support extended grapheme clusters including more emojibfredl1
Use the grapheme break algorithm from utf8proc to support grapheme clusters from recent unicode versions. Handle variant selector VS16 turning some codepoints into double-width emoji. This means we need to use ptr2cells rather than char2cells when possible.
2024-08-20fix(decor): don't use separate DecorSignHighlight for url (#30096)zeertzjq1
2024-06-15docs: misc (#29229)dundargoc1
Co-authored-by: Ilia Choly <ilia.choly@gmail.com> Co-authored-by: Jose Pedro Oliveira <jose.p.oliveira.oss@gmail.com> Co-authored-by: Maria José Solano <majosolano99@gmail.com> Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2024-06-07feat: get/set namespace properties #28728altermo1
ref https://github.com/neovim/neovim/pull/28432 ref https://github.com/neovim/neovim/issues/28469
2024-06-07docs: misc (#28837)dundargoc1
Co-authored-by: Danymat <d.danymat@gmail.com> Co-authored-by: Gregory Anders <greg@gpanders.com> Co-authored-by: Jakub Okoński <jakub@okonski.org> Co-authored-by: John L. Villalovos <john@sodarock.com> Co-authored-by: Maria José Solano <majosolano99@gmail.com> Co-authored-by: Michaili K <git@michaili.dev> Co-authored-by: TheLeoP <eugenio2305@hotmail.com> Co-authored-by: Tobias Schmitz <tobiasschmitz2001@gmail.com> Co-authored-by: W20MC <157727813+W20MC@users.noreply.github.com> Co-authored-by: Will Hopkins <willothyh@gmail.com> Co-authored-by: Yifan Hu <141280278+b0ae989c@users.noreply.github.com> Co-authored-by: glepnir <glephunter@gmail.com> Co-authored-by: prljav <74116121+prljav@users.noreply.github.com>
2024-05-12refactor(api): nvim_win_xx_ns are EXPERIMENTALJustin M. Keyes1
Problem: The nvim_win_xx_ns function family introduced in ba0370b1d718d473d0ef51c35d88b98ba220082b needs more bake-time. Currently it's narrowly defined for windows, but other scopes ("buffer") and features are likely in the future. Solution: - Rename the API with double-underscore to mark it as EXPERIMENTAL. TODO/FUTURE: - Rename and change the signature to support more than just "window" scope, and for other flexibility. - Open question: we could choose either: - "store scopes on namespaces", or - "store namespaces on scopes (w:/b:/…)"
2024-05-12refactor(api): rename nvim_win_remove_nsJustin M. Keyes1
Problem: nvim_win_remove_ns does not follow `help dev-naming` API naming conventions. Solution: Rename it.
2024-05-12fix(api): make getting explicit empty hl in virtual text work (#28697)zeertzjq1
2024-05-03perf(extmarks): better track whether namespace has extmarks (#28615)zeertzjq1
This avoids redraw when adding/removing an empty namespace for a window. This also avoids marktree traversal when clearing a namespace that has already been cleared, which is added as a benchmark.
2024-05-01revert: "feat(extmarks): subpriorities (relative to declaration order) ↵Gregory Anders1
(#27131)" (#28585) This reverts commit 15e77a56b711102fdc123e15b3f37d49bc0b1df1. Subpriorities were added in https://github.com/neovim/neovim/pull/27131 as a mechanism for enforcing query order when using iter_matches in the Tree-sitter highlighter. However, iter_matches proved to have too many complications to use in the highlighter so we eventually reverted back to using iter_captures (https://github.com/neovim/neovim/pull/27901). Thus, subpriorities are no longer needed and can be removed.
2024-03-13fix(api/buffer): fix handling of viewport of non-current bufferbfredl1
A lot of functions in move.c only worked for curwin, alternatively took a `wp` arg but still only work if that happens to be curwin. Refactor those that are needed for update_topline(wp) to work for any window. fixes #27723 fixes #27720
2024-03-12refactor: use ml_get_buf_len() in API code (#27825)zeertzjq1
2024-03-09docs: support inline markdownLewis Russell1
- Tags are now created with `[tag]()` - References are now created with `[tag]` - Code spans are no longer wrapped
2024-02-27feat(docs): replace lua2dox.luaLewis Russell1
Problem: The documentation flow (`gen_vimdoc.py`) has several issues: - it's not very versatile - depends on doxygen - doesn't work well with Lua code as it requires an awkward filter script to convert it into pseudo-C. - The intermediate XML files and filters makes it too much like a rube goldberg machine. Solution: Re-implement the flow using Lua, LPEG and treesitter. - `gen_vimdoc.py` is now replaced with `gen_vimdoc.lua` and replicates a portion of the logic. - `lua2dox.lua` is gone! - No more XML files. - Doxygen is now longer used and instead we now use: - LPEG for comment parsing (see `scripts/luacats_grammar.lua` and `scripts/cdoc_grammar.lua`). - LPEG for C parsing (see `scripts/cdoc_parser.lua`) - Lua patterns for Lua parsing (see `scripts/luacats_parser.lua`). - Treesitter for Markdown parsing (see `scripts/text_utils.lua`). - The generated `runtime/doc/*.mpack` files have been removed. - `scripts/gen_eval_files.lua` now instead uses `scripts/cdoc_parser.lua` directly. - Text wrapping is implemented in `scripts/text_utils.lua` and appears to produce more consistent results (the main contributer to the diff of this change).
2024-02-25docs: fix several misleading and superfluous wordings (#27609)Evgeni Chasnovski1
2024-02-22fix(api): don't leak memory with nvim_win_get_ns (#27570)zeertzjq1
2024-02-22fix(extmarks): redraw properly with scoped inline virt_text (#27569)zeertzjq1
2024-02-21feat(extmark): window scoped extmarkaltermo1
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2024-02-21refactor(api): make freeing of return-value opt-in instead of opt outbfredl1
As only a few API functions make use of explicit freeing of the return value, make it opt-in instead. The arena is always present under the hood, so `Arena *arena` arg now doesn't mean anything other than getting access to this arena. Also it is in principle possible to return an allocated value while still using the arena as scratch space for other stuff (unlikely, but there no reason to not allow it).
2024-02-20fix(extmarks): priority order of inline and non-inline virt_text (#27532)zeertzjq1