summaryrefslogtreecommitdiffstatshomepage
path: root/runtime/lua/vim
AgeCommit message (Collapse)AuthorFiles
2024-01-28feat(extmarks): subpriorities (relative to declaration order) (#27131)Gregory Anders1
The "priority" field of extmarks can be used to set priorities of extmarks which dictates which highlight group a range will actually have when there are multiple extmarks applied. However, when multiple extmarks have the same priority, the only way to enforce an actual priority is through the order in which the extmarks are set. It is not always possible or desirable to set extmarks in a specific order, however, so we add a new "subpriority" field that explicitly enforces the ordering of extmarks that have the same priority. For now this will be used only to enforce priority of treesitter highlights. A single node in a treesitter tree may match multiple captures, in which case that node will have multiple extmarks set. The order in which captures are returned from the treesitter API is not _necessarily_ in the same order they are defined in a query file, so we use the new subpriority field to force that ordering. For now subpriorites are not documented and are not meant to be used by external code, and it only applies to ephemeral extmarks. We indicate the "private" nature of subpriorities by prefixing the field name with an "_".
2024-01-28refactor(lsp): client_hints typo #27250Maria José Solano1
2024-01-28docs: enforce "treesitter" spelling #27110Jongwook Choi3
It's the "tree-sitter" project, but "treesitter" in our code and docs.
2024-01-28vim-patch:9.1.0049: Make "[Command Line]" a special buffer nameSean Dewar1
Problem: E95 is possible if a buffer called "[Command Line]" already exists when opening the cmdwin. This can also happen if the cmdwin's buffer could not be deleted when closing. Solution: Un-name the cmdwin buffer, and give it a special name instead, similar to what's done for quickfix buffers and for unnamed prompt and scratch buffers. As a result, BufFilePre/Post are no longer fired when opening the cmdwin. Add a "command" key to the dictionary returned by getbufinfo() to differentiate the cmdwin buffer instead. (Sean Dewar) Cherry-pick test_normal changes from v9.0.0954. https://github.com/vim/vim/commit/1fb41032060df09ca2640dc49541f11062f6dfaa
2024-01-27revert: "feat(treesitter): add foldtext with treesitter highlighting"Till Bungert2
This reverts commit 9ce1623 in favor of #20750.
2024-01-26feat: improve return type annotations for vim.api.*Lewis Russell2
2024-01-26vim-patch:9.1.0058: Cannot map Super Keys in GTK UI (#27204)zeertzjq1
Problem: Cannot map Super Keys in GTK UI (Casey Tucker) Solution: Enable Super Key mappings in GTK using <D-Key> (Casey Tucker) As a developer who works in both Mac and Linux using the same keyboard, it can be frustrating having to remember different key combinations or having to rely on system utilities to remap keys. This change allows `<D-z>` `<D-x>` `<D-c>` `<D-v>` etc. to be recognized by the `map` commands, along with the `<D-S-...>` shifted variants. ```vimrc if has('gui_gtk') nnoremap <D-z> u nnoremap <D-S-Z> <C-r> vnoremap <D-x> "+d vnoremap <D-c> "+y cnoremap <D-v> <C-R>+ inoremap <D-v> <C-o>"+gP nnoremap <D-v> "+P vnoremap <D-v> "-d"+P nnoremap <D-s> :w<CR> inoremap <D-s> <C-o>:w<CR> nnoremap <D-w> :q<CR> nnoremap <D-q> :qa<CR> nnoremap <D-t> :tabe<CR> nnoremap <D-S-T> :vs#<CR><C-w>T nnoremap <D-a> ggVG vnoremap <D-a> <ESC>ggVG inoremap <D-a> <ESC>ggVG nnoremap <D-f> / nnoremap <D-g> n nnoremap <D-S-G> N vnoremap <D-x> "+x endif ``` closes: vim/vim#12698 https://github.com/vim/vim/commit/92e90a1e102825aa9149262cacfc991264db05df Co-authored-by: Casey Tucker <dctucker@hotmail.com>
2024-01-25docs: various fixes (#27063)dundargoc1
Co-authored-by: lmenou <menl94629@gmail.com> Co-authored-by: altermo <107814000+altermo@users.noreply.github.com> Co-authored-by: VanaIgr <vanaigranov@gmail.com> Co-authored-by: Gregory Anders <greg@gpanders.com>
2024-01-24feat(ui): add support for OSC 8 hyperlinks (#27109)Gregory Anders2
Extmarks can contain URLs which can then be drawn in any supporting UI. In the TUI, for example, URLs are "drawn" by emitting the OSC 8 control sequence to the TTY. On terminals which support the OSC 8 sequence this will create clickable hyperlinks. URLs are treated as inline highlights in the decoration subsystem, so are included in the `DecorSignHighlight` structure. However, unlike other inline highlights they use allocated memory which must be freed, so they set the `ext` flag in `DecorInline` so that their lifetimes are managed along with other allocated memory like virtual text. The decoration subsystem then adds the URLs as a new highlight attribute. The highlight subsystem maintains a set of unique URLs to avoid duplicating allocations for the same string. To attach a URL to an existing highlight attribute we call `hl_add_url` which finds the URL in the set (allocating and adding it if it does not exist) and sets the `url` highlight attribute to the index of the URL in the set (using an index helps keep the size of the `HlAttrs` struct small). This has the potential to lead to an increase in highlight attributes if a URL is used over a range that contains many different highlight attributes, because now each existing attribute must be combined with the URL. In practice, however, URLs typically span a range containing a single highlight (e.g. link text in Markdown), so this is likely just a pathological edge case. When a new highlight attribute is defined with a URL it is copied to all attached UIs with the `hl_attr_define` UI event. The TUI manages its own set of URLs (just like the highlight subsystem) to minimize allocations. The TUI keeps track of which URL is "active" for the cell it is printing. If no URL is active and a cell containing a URL is printed, the opening OSC 8 sequence is emitted and that URL becomes the actively tracked URL. If the cursor is moved while in the middle of a URL span, we emit the terminating OSC sequence to prevent the hyperlink from spanning multiple lines. This does not support nested hyperlinks, but that is a rare (and, frankly, bizarre) use case. If a valid use case for nested hyperlinks ever presents itself we can address that issue then.
2024-01-24refactor: rewrite ruby provider in luadundargoc3
2024-01-24fix(treesitter): avoid # of nil in _query_linterDaniel Kongsgaard1
2024-01-24refactor: rewrite perl provider in luadundargoc1
2024-01-24fix(spell): always accept ':' as filename char in 'spellfile' (#27172)zeertzjq1
Follow-up to #25236
2024-01-24fix(treesitter): prefix treesitter types with vimPhạm Huy Hoàng4
2024-01-23test: typing for screen.luaLewis Russell1
Very rough buts resolves most diagnostic errors and should provide some useful hovers.
2024-01-23fix(diagnostic): fix typing on field |diagnostic-severity|Jongwook Choi1
Problem: vim.diagnostic.{underline,float,virtual_text...}.severity will have a type warning on list-like or table (min-max) inputs, e.g. `vim.diagnostic.config { float = { severity = { min = INFO } } }`. Solution: Correct the typing as documented in |diagnostic-severity|.
2024-01-22refactor: rewrite python provider in luadundargoc1
2024-01-22docs(options): remove misleading sentence (#27129)zeertzjq1
Setting 'verbose' to 1 doesn't cause Nvim to produce messages. It adds more information to existing messages, which is documented above.
2024-01-22feat(fold): transparent foldtextLewis Russell1
'foldtext' can be set to an empty string to disable and render the line with: - extmark highlight - syntax highlighting - search highlighting - no line wrapping - spelling - conceal - inline virtual text - respects `fillchars:fold` Currently normal virtual text is not displayed Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2024-01-22Merge pull request #27076 from glepnir/extmark_hlgroupbfredl1
refactor(api): use hl id directly in nvim_buf_set_extmark
2024-01-22fix(eval): properly support checking v:lua function in exists() (#27124)Raphael1
2024-01-22refactor(api): give "hl_group" more accurate _meta typebfredl1
These can either be number or string in lua, so we can specify this directly as "number|string".
2024-01-21feat(vim.version): add `vim.version.le` and `vim.version.ge`Jongwook Choi1
- Problem: One cannot easily write something like, for example: `version_current >= {0, 10, 0}`; writing like `not vim.version.lt(version_current, {0, 10, 0})` is verbose. - Solution: add {`le`,`ge`} in addition to {`lt`,`gt`}. - Also improve typing on the operator methods: allow `string` as well. - Update the example in `vim.version.range()` docs: `ge` in place of `gt` better matches the semantics of `range:has`.
2024-01-21vim-patch:27a4632af675Christian Clason1
runtime(filetype): detect *.ck files as Chuck filetype (vim/vim#13888) closes vim/vim#13886 https://github.com/vim/vim/commit/27a4632af675345f9d3b4f3d66a63756835df8cc Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-01-20refactor(api): use hl id directly in nvim_buf_set_extmarkglepnir1
2024-01-20fix(lsp): clean up duplicate and unused meta type annotationsJongwook Choi2
2024-01-19fix(vim.deprecate): show deprecation warning in devel versions as wellJongwook Choi1
Problem: On devel(nightly) versions, deprecation warnings for hard-deprecated features are not being displayed. E.g., - to be removed in: 0.11 - hard-deprecation since 0.10 - soft-deprecation since 0.9 then 0.10-nightly (0.10.0-dev) versions as well as 0.10.0 (stable) should display the deprecation warning message. Solution: Improve the code and logic on `vim.deprecate()`, and improve test cases with mocked `vim.version()`.
2024-01-19refactor(lua): refactored globaltermo1
2024-01-19Merge pull request #27061 from luukvbaal/extmarkbfredl1
fix(extmarks): do not remove invalid marks from decor upon deletion
2024-01-18docs(extmarks): add undocumented "details" array fieldsLuuk van Baal1
2024-01-18fix(treesitter): validate language alias for injectionsChristian Clason1
Problem: Parsed language annotations can be random garbage so `nvim_get_runtime_file` throws an error. Solution: Validate that `alias` is a valid language name before trying to find a parser for it.
2024-01-18docs(vim.iter): correct `bool` to `boolean` (#27018)notomo1
2024-01-18docs: various #25289Justin M. Keyes2
Co-authored-by: Jongwook Choi <wookayin@gmail.com> Co-authored-by: Oliver Marriott <hello@omarriott.com> Co-authored-by: Benoit de Chezelles <bew@users.noreply.github.com> Co-authored-by: Jongwook Choi <wookayin@gmail.com>
2024-01-18vim-patch:9.1.0039: too vague errors for 'listchars'/'fillchars' (#27070)zeertzjq1
Problem: too vague errors for 'listchars'/'fillchars' Solution: Include the field name in error message. (zeertzjq) related: #27050 closes: vim/vim#13877 https://github.com/vim/vim/commit/6a8d2e1634f8f0d7463a2786dbcbe0f38dd287a7 Co-authored-by: Cole Frankenhoff <cole.nhf@gmail.com>
2024-01-17fix(lua): return after assert returns assert message (#27064)altermo2
2024-01-17feat: add __call typing for vim.inspect()Lewis Russell1
2024-01-17docs: various fixes (#26929)dundargoc1
Co-authored-by: Patrick Bollinger <owner@pjbollinger.com> Co-authored-by: vilo1839 <139687192+vilo1839@users.noreply.github.com>
2024-01-16refactor(lsp): deprecate `vim.lsp.util.lookup_section`Jongwook Choi2
This function is used only in the `workspace/configuration` handler, and does not warrant a public API because of its confusing return types. The only caller `vim.lsp.handlers["workspace.configuration"]` is also refactored to use `vim.tbl_get()` instead.
2024-01-16vim-patch:9.1.0013: Modula2 filetype support lacking (#27020)Sean Dewar2
Problem: Modula2 filetype support lacking Solution: Improve the Modula-2 runtime support, add additional modula2 dialects, add compiler plugin, update syntax highlighting, include syntax tests, update Makefiles (Doug Kearns) closes: vim/vim#6796 closes: vim/vim#8115 https://github.com/vim/vim/commit/68a89470693c7687d4e736ca056c05de632e3ac7 - Luaify the detection script: - Split the `(*!m2foo*)` and `(*!m2foo+bar*)` detection into two Lua patterns, as Lua capture groups cannot be used with `?` and friends (as they only work on character classes). - Use `vim.api.nvim_buf_call()` (ew) to call `modula2#SetDialect()` to ensure `b:modula2` is set for the given bufnr. - Skip the syntax screendump tests. (A shame as they test some of the detection from `(*!m2foo+bar*)` tags, but I tested this locally and it seems to work) - Port the synmenu.vim changes from Vim9 script. (Also tested this locally) - (And also add the missing comma for `b:browsefilter` from earlier.) Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2024-01-16docs(column): 'statuscolumn' redraw interaction with 'relativenumber'Luuk van Baal1
2024-01-16fix(diagnostic): typingLewis Russell2
2024-01-16docs(builtin): remove signatures of undocumented functions (#27039)zeertzjq1
Having an empty signature causes an empty line in generated docs, so remove it. Also change ">" to ">vim" in foreach() docs.
2024-01-16vim-patch:partial:9.1.0027: Vim is missing a foreach() func (#27037)zeertzjq1
Problem: Vim is missing a foreach() func Solution: Implement foreach({expr1}, {expr2}) function, which applies {expr2} for each item in {expr1} without changing it (Ernie Rael) closes: vim/vim#12166 https://github.com/vim/vim/commit/e79e2077607e8f829ba823308c91104a795736ba Partial port as this doesn't handle non-materialized range() lists. vim-patch:c92b8bed1fa6 runtime(help): delete duplicate help tag E741 (vim/vim#13861) https://github.com/vim/vim/commit/c92b8bed1fa632569c8358feb3b72dd6a0844ef7 Co-authored-by: Ernie Rael <errael@raelity.com>
2024-01-16vim-patch:9.1.0009: Cannot easily get the list of matches (#27028)zeertzjq1
Problem: Cannot easily get the list of matches Solution: Add the matchstrlist() and matchbufline() Vim script functions (Yegappan Lakshmanan) closes: vim/vim#13766 Omit CHECK_LIST_MATERIALIZE(): it populates a List with numbers only, and there is a check for strings below. https://github.com/vim/vim/commit/f93b1c881a99fa847a1bafa71877d7e16f18e6ef vim-patch:eb3475df0d92 runtime(doc): Replace non-breaking space with normal space (vim/vim#13868) https://github.com/vim/vim/commit/eb3475df0d927a178789cf8e7fc4983932e1cdbe Co-authored-by: Yegappan Lakshmanan <4298407+yegappan@users.noreply.github.com>
2024-01-15feat(terminal): respond to OSC background and foreground request (#17197)Daniel Steinberg1
The motivation for this update is Issue #15365, where background=light is not properly set for Nvim running from an Nvim :terminal. This can be encountered when e.g., opening a terminal to make git commits, which opens EDITOR=nvim in the nested terminal. Under the implementation of this commit, the OSC response always indicates a black or white foreground/background. While this may not reflect the actual foreground/background color, it permits 'background' to be retained for a nested Nvim instance running in the terminal emulator. The behaviour matches Vim.
2024-01-15docs(vvars): fix wrong lua types in vim.v variablesJongwook Choi1
- cmdarg: string[] -> string - shell_error: string -> int - stderr: string -> int - Add types for: cmdbang, errors, exception, false, true
2024-01-15docs: add lua typing for `vim.NIL`Jongwook Choi3
2024-01-14docs(builtin): overload functions with union return typesaltermo1
2024-01-14docs: auto-generate docs for `vim.lpeg` and `vim.re`Jongwook Choi3
- Add section `VIM.LPEG` and `VIM.RE` to docs/lua.txt. - Add `_meta/re.lua` which adds luadoc and type annotations, for the vendored `vim.re` package. - Fix minor style issues on `_meta/lpeg.lua` luadoc for better vimdocs generation. - Fix a bug on `gen_vimdoc` where non-helptags in verbatim code blocks were parsed as helptags, affecting code examples on `vim.lpeg.Cf`, etc. - Also move the `vim.regex` section below so that it can be located closer to `vim.lpeg` and `vim.re`.
2024-01-14fix(lsp): fix incorrect typing and doc for `vim.lsp.rpc`Jongwook Choi3
Typings introduced in #26032 and #26552 have a few conflicts, so we merge and clean them up. We also fix some incorrect type annotation in the `vim.lsp.rpc` package. See the associated PR for more details. Summary: - vim.rpc.Dispatchers -> vim.lsp.rpc.Dispatchers - vim.lsp.rpc.Error -> lsp.ResponseError - Revise docs