aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua
Commit message (Collapse)AuthorAge
...
| * fix(diff): use mmfile_t in linematchLewis Russell2024-09-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Linematch used to use strchr to navigate a string, however strchr does not supoprt embedded NULs. Solution: Use `mmfile_t` instead of `char *` in linematch and introduce `strnchr()`. Also remove heap allocations from `matching_char_iwhite()` Fixes: #30505
| * feat(treesitter)!: use return values in `language.add()`Christian Clason2024-09-29
| | | | | | | | | | | | | | | | | | Problem: No clear way to check whether parsers are available for a given language. Solution: Make `language.add()` return `true` if a parser was successfully added and `nil` otherwise. Use explicit `assert` instead of relying on thrown errors.
| * feat(treesitter)!: add default fallback to `ft_to_lang` lookupsChristian Clason2024-09-29
| | | | | | | | | | | | | | | | | | | | | | | | Problem: Language names are only registered for filetype<->language lookups when parsers are actually loaded; this means users cannot rely on `vim.treesitter.language.get_lang()` or `get_filetypes()` to return the correct value when language and filetype coincide and always need to add explicit fallbacks. Solution: Always return the language name as valid filetype in `get_filetypes()`, and default to the filetype in `get_lang()`. Document this behavior.
| * docs: misc (#30177)dundargoc2024-09-29
| | | | | | | | | | Co-authored-by: Christian Clason <c.clason@uni-graz.at> Co-authored-by: Riley Bruins <ribru17@hotmail.com> Co-authored-by: zeertzjq <zeertzjq@outlook.com>
| * vim-patch:9.1.0745: filetype: bun and deno history files not recognizedChristian Clason2024-09-29
| | | | | | | | | | | | | | | | | | | | | | | | Problem: filetype: bun and deno history files not recognized Solution: detect '.bun_repl_history' and 'deno_history.txt' as javascript filetype (Wu, Zhenyu) closes: vim/vim#15761 https://github.com/vim/vim/commit/8a2aea8a623ba183dc0703a47970463b105a9399 Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
| * fix(treesitter): specify success status in edit_query return valueRiley Bruins2024-09-28
| |
| * fix(treesitter): suppress get_parser warnings via opts.errorRiley Bruins2024-09-28
| |
| * vim-patch:9.1.0744: filetype: notmuch configs are not recognised (#30535)zeertzjq2024-09-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: filetype: notmuch configs are not recognised Solution: Detect more notmuch profile configuration files as dosini filetype (Julio B) Reference: https://notmuchmail.org/doc/latest/man1/notmuch-config.html#configuration closes: vim/vim#15744 https://github.com/vim/vim/commit/1a2870b57aa832500d59c17c8225a64c2b4aa619 Co-authored-by: Julio B <julio.bacel@gmail.com>
| * fix(treesitter): EditQuery shows swapfile ATTENTION #30536Justin M. Keyes2024-09-27
| | | | | | | | | | | | | | | | Problem: EditQuery shows swapfile ATTENTION, but this buffer is not intended for preservation (and the dialog breaks the UX). Solution: Set 'noswapfile' on the buffer before renaming it.
| * feat(health): highlight headings #30525Justin M. Keyes2024-09-26
| | | | | | | | | | | | | | | | | | | | Problem: checkhealth report sections are not visually separated. Solution: Highlight with "reverse". TODO: migrate checkhealth filetype to use treesitter. TODO: default :help should also highlight headings more boldy!
| * vim-patch:9.1.0741: No way to get prompt for input()/confirm()zeertzjq2024-09-26
| | | | | | | | | | | | | | | | | | | | | | | | Problem: No way to get prompt for input()/confirm() Solution: add getcmdprompt() function (Shougo Matsushita) (Shougo Matsushita) closes: vim/vim#15667 https://github.com/vim/vim/commit/6908428560a0d6ae27bf7af6fcb6dc362e31926c Co-authored-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
| * perf(treesitter): use `child_containing_descendant()` in `is_ancestor()`Riley Bruins2024-09-25
| | | | | | | | | | | | | | | | **Problem:** `is_ancestor()` uses a slow, bottom-up parent lookup which has performance pitfalls detailed in #28512. **Solution:** Take `is_ancestor()` from $O(n^2)$ to $O(n)$ by incorporating the use of the `child_containing_descendant()` function
| * fix(diagnostic): correct `severity` type on `setqflist`, `setloclist` (#30506)Nathan Smith2024-09-25
| | | | | | fix(diagnostic): correct severity type on setqflist, setloclist
| * refactor(lua): vim.keymap.set tests, docs #30511Justin M. Keyes2024-09-25
| |
| * docs: render @see, @note items in _meta/api.lua #30494Justin M. Keyes2024-09-25
| |
| * docs: lua error patterns #30240Justin M. Keyes2024-09-24
| | | | | | | | Co-authored-by: Mathias Fussenegger <f.mathias@zignar.net> Co-authored-by: Ananth Bhaskararaman <antsub@gmail.com>
| * feat(paste): unify cancel and error behavior (#30476)zeertzjq2024-09-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this PR, the behavior of nvim_paste is: - When vim.paste() returns false, return false to the client, but treat following chunks normally (i.e. rely on the client cancelling the paste as expected). - When vim.paste() throws an error, still return true to the client, but drain the following chunks in the stream without calling vim.paste(). There are two problems with such behavior: - When vim.paste() errors, the client is still supposed to send the remaining chunks of the stream, even though they do nothing. - Having different code paths for two uncommon but similar situations complicates maintenance. This PR makes both the cancel case and the error case return false to the client and drain the remaining chunks of the stream, which, apart from sharing the same code path, is beneficial whether the client checks the return value of nvim_paste or not: - If the client checks the return value, it can avoid sending the following chunks needlessly after an error. - If the client doesn't check the return value, chunks following a cancelled chunk won't be pasted on the server regardless, which leads to less confusing behavior.
| * fix(filetype): handle .in files with no filename (#30487)Tristan Knight2024-09-24
| | | | | | | | | | | | | | | | | | Problem: fnamemodify with the :r flag will not strip extensions if the filename starts with a ".". This means that files named ".in" could cause an infinite loop. Solution: Add early return if the filename was not changed
| * Merge #30435 refactor: rename "Dictionary" => "Dict"Justin M. Keyes2024-09-23
| |\
| | * refactor(api)!: rename Dictionary => DictJustin M. Keyes2024-09-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | fix(vim.fs): dirname() returns "." on mingw/msys2 #30480Justin M. Keyes2024-09-23
| |/ | | | | | | | | | | | | | | | | | | Problem: `vim.fs.dirname([[C:\User\XXX\AppData\Local]])` returns "." on mingw/msys2. Solution: - Check for "mingw" when deciding `iswin`. - Use `has("win32")` where possible, it works in "fast" contexts since b02eeb6a7281df0561a021d7ae595c84be9a01be.
| * feat(fs.lua): add vim.fs.rm()Lewis Russell2024-09-22
| | | | | | | | Analogous to the shell `rm` command.
| * docs(api): nvim_get_runtime_file preserves 'runtimepath' order #30454Evgeni Chasnovski2024-09-22
| |
| * vim-patch:a0c14ef: runtime(filetype): tests: Test_filetype_detection() failszeertzjq2024-09-21
| | | | | | | | | | | | | | | | | | Problem: tests: Test_filetype_detection() fails (after 9.1.0738) Solution: Add missing filetype detect patterns for *.SYSx and *.MODx https://github.com/vim/vim/commit/a0c14ef310acac62276b4ee51930d3246b11772e Co-authored-by: Christian Brabandt <cb@256bit.org>
| * vim-patch:9.1.0738: filetype: rapid files are not recognizedzeertzjq2024-09-21
| | | | | | | | | | | | | | | | | | | | | | | | Problem: filetype: rapid files are not recognized Solution: detect '*.sysx' and '*.modx' as rapid filetype (KnoP-01) closes: vim/vim#15669 https://github.com/vim/vim/commit/fdcb08264d6e8525a07b29c14863adc6ead83913 Co-authored-by: KnoP-01 <knosowski@graeffrobotics.de>
| * fix(treesitter): lint top-level anonymous nodesRiley Bruins2024-09-20
| | | | | | | | | | | | | | | | | | | | **Problem:** Top-level anonymous nodes are not being checked by the query linter **Solution:** Check them by adding them to the top-level query This commit also moves a table construction out of the match iterator so it is run less frequently.
| * docs(lsp): hover window controls #30347Tristan Knight2024-09-19
| |
| * fix(health): check more "old" files #30421Justin M. Keyes2024-09-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Node.js provider (optional) ~ - ERROR Failed to run healthcheck for "provider.node" plugin. Exception: …/runtime/lua/provider/node/health.lua:9: attempt to call field 'provider_disabled' (a nil value) Perl provider (optional) ~ - ERROR Failed to run healthcheck for "provider.perl" plugin. Exception: …/runtime/lua/provider/perl/health.lua:8: attempt to call field 'provider_disabled' (a nil value) Python 3 provider (optional) ~ - ERROR Failed to run healthcheck for "provider.python" plugin. Exception: …/runtime/lua/provider/python/health.lua:226: attempt to call field 'provider_disabled' (a nil value) Ruby provider (optional) ~ - ERROR Failed to run healthcheck for "provider.ruby" plugin. Exception: …/runtime/lua/provider/ruby/health.lua:9: attempt to call field 'provider_disabled' (a nil value) Solution: Add these files to the runtime sanity check. fix #29302
| * refactor!: rename 'jumpoptions' flag "unload" to "clean" (#30418)zeertzjq2024-09-19
| | | | | | Follow-up to #29347
| * vim-patch:9.1.0735: filetype: salt files are not recognizedGregory Anders2024-09-17
| | | | | | | | | | | | | | | | | | | | | | | | Problem: filetype: salt files are not recognized Solution: Detect '*.sls' files as filetype salt, include a syntax script (Gregory Anders) closes: vim/vim#15689 https://github.com/vim/vim/commit/89b9bb4ac8ceb701ebecb8c02aca3d047dff9991 Co-authored-by: Gregory Anders <greg@gpanders.com>
| * vim-patch:9.1.0734: filetype: jinja files are not recognizedGregory Anders2024-09-17
| | | | | | | | | | | | | | | | | | | | | | | | Problem: filetype: jinja files are not recognized Solution: detect '*.jinja' files a jinja filetype, include jinja syntax script (Gregory Anders) related: vim/vim#15689 https://github.com/vim/vim/commit/202c467bb37b894ada6377d3f2621c103f324757 Co-authored-by: Gregory Anders <greg@gpanders.com>
| * docs(eval): update param types of prompt-buffer functions (#30392)glepnir2024-09-16
| |
| * feat(vim.ui): configurable "gx" / vim.ui.open() toolMatěj Cepl2024-09-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: User cannot configure the tool used by `vim.ui.open` (or `gx`). With netrw this was supported by `g:netrw_browsex_viewer`. Solution: Introduce `opts.cmd`. Users that want to set this globally can monkey-patch `vim.ui.open` in the same way described at `:help vim.paste()`. Fixes https://github.com/neovim/neovim/issues/29488 Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
| * vim-patch:9.1.0731: inconsistent case sensitive extension matchingChristian Clason2024-09-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: inconsistent case sensitive extension matching Solution: unify case sensitive extension matching (Evgeni Chasnovski). There are different approaches of how extensions are matched with respect to case sensitivity. In particular, '\c' flag is used in pattern whereas in most places case sensitive matching is guarded behind `has("fname_case")` condition. Replace all instances of '\c' with an explicit case sensitive pattern variants guarded by `has("fname_case")`. Strictly speaking, this is a breaking change because only two (most common and prevailingly tested) variants are now matched: upper first letter and upper all letters. closes: vim/vim#15672 https://github.com/vim/vim/commit/59b089c9df238ce940b3c593295bc511e201399a Co-authored-by: Evgeni Chasnovski <evgeni.chasnovski@gmail.com>
| * fix(defaults): cannot remove "How-to disable mouse" menu item #30375Jaehwang Jung2024-09-14
| |
| * fix(lsp): handle nil bytes in stringsMathias Fussenegger2024-09-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: The LSP omnifunc can insert nil bytes, which when read in other places (like semantic token) could cause an error: semantic_tokens.lua:304: Vim:E976: Using a Blob as a String Solution: Use `#line` instead of `vim.fn.strlen(line)`. Both return UTF-8 bytes but the latter can't handle nil bytes. Completion candidates can currently insert nil bytes, if other parts of Alternative fix to https://github.com/neovim/neovim/pull/30359 Note that https://github.com/neovim/neovim/pull/30315 will avoid the insertion of nil bytes from the LSP omnifunc, but the change of this PR can more easily be backported.
| * feat(treesitter): start moving get_parser to return nil #30313Riley Bruins2024-09-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | **Problem:** `vim.treesitter.get_parser` will throw an error if no parser can be found. - This means the caller is responsible for wrapping it in a `pcall`, which is easy to forget - It also makes it slightly harder to potentially memoize `get_parser` in the future - It's a bit unintuitive since many other `get_*` style functions conventionally return `nil` if no object is found (e.g. `get_node`, `get_lang`, `query.get`, etc.) **Solution:** Return `nil` if no parser can be found or created - This requires a function signature change, and some new assertions in places where the parser will always (or should always) be found. - This commit starts by making this change internally, since it is breaking. Eventually it will be rolled out to the public API.
| * fix(lsp): handle empty call hierarchy items #30349James Trew2024-09-13
| | | | | | | | | | Ensure that the function `pick_call_hierarchy_item` correctly handles the case where `call_hierarchy_items` is nil or an empty table. This prevents potential errors when the function is called with no items.
| * vim-patch:9.1.0725: filetype: swiftinterface files are not recognized (#30350)zeertzjq2024-09-12
| | | | | | | | | | | | | | | | | | | | | | Problem: filetype: swiftinterface files are not recognized Solution: Detect '*.swiftinterface' files as swift filetype (LosFarmosCTL) closes: vim/vim#15658 https://github.com/vim/vim/commit/03cac4b70d819148f4b4404701b8f331a3af0fb6 Co-authored-by: LosFarmosCTL <80157503+LosFarmosCTL@users.noreply.github.com>
| * fix: replace NVIM with Nvim in default titlestring (#30348)Gregory Anders2024-09-11
| |
| * fix(lsp): check buffer is loaded and valid #30330glepnir2024-09-11
| | | | | | | | | | Problem: buffer mabye not valid when callback handler invoke. Soliton: check buffer is valid and loaded in handler.
| * fix(health): return correct name from 'path2name()'monkoose2024-09-11
| | | | | | `path2name()` function doesn't process `'pluginname/health/init.lua'` correctly. Instead of retruning `'pluginname'` it returns `'pluginname.health'`
| * vim-patch:d657d3d: runtime(doc): clarify the effect of the timeout for ↵zeertzjq2024-09-11
| | | | | | | | | | | | | | | | | | | | search()-functions (#30337) related: vim/vim#15657 related: vim/vim#15404 https://github.com/vim/vim/commit/d657d3d8fd635dbd78402358788dc58a96d04117 Co-authored-by: Christian Brabandt <cb@256bit.org>
| * fix(lsp): handle encoding bounds in str_utfindex_enctris2032024-09-10
| | | | | | | | | | | | | | | | | | | | Problem: str_utfindex_enc could return an error if the index was longer than the line length. This was handled in each of the calls to it individually Solution: * Fix the call at the source level so that if the index is higher than the line length, utf length is returned
| * fix(lua): revert vim.tbl_extend behavior change and document itChristian Clason2024-09-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: vim.tbl_deep_extend had an undocumented feature where arrays (integer-indexed tables) were not merged but compared literally (used for merging default and user config, where one list should overwrite the other completely). Turns out this behavior was relied on in quite a number of plugins (even though it wasn't a robust solution even for that use case, since lists of tables (e.g., plugin specs) can be array-like as well). Solution: Revert the removal of this special feature. Check for list-like (contiguous integer indices) instead, as this is closer to the intent. Document this behavior.
| * fix(lsp): handle out-of-bounds character positions #30288Tristan Knight2024-09-08
| | | | | | | | | | | | | | | | | | | | | | Problem: str_byteindex_enc could return an error if the index was longer than the lline length. This was handled in each of the calls to it individually Solution: * Fix the call at the source level so that if the index is higher than the line length, line length is returned as per LSP specification * Remove pcalls on str_byteindex_enc calls. No longer needed now that str_byteindex_enc has a bounds check.
| * fix(tohtml): enclose font-family names in quotation marksyayoyuyu2024-09-08
| | | | | | | | | | | | | | | | | | | | | | | | | | Font-family names must be enclosed in quotation marks to ensure that fonts are applied correctly when there are spaces in the name. Fix an issue where multiple fonts specified in `vim.o.guifont` are inserted as a single element, treating them as a single font. Support for escaping commas with backslash and ignoring spaces after a comma. ref `:help 'guifont'`
| * fix(vim.ui.open): prefer xdg-open on WSL #30302Yi Ming2024-09-07
| | | | | | | | xdg-open is usually not installed in WSL. But if the user deliberately installs it, presumably they want to prioritize it.
| * vim-patch:9.1.0720: Wrong breakindentopt=list:-1 with multibyte or TABs (#30293)zeertzjq2024-09-07
| | | | | | | | | | | | | | | | | | | | Problem: Wrong breakindentopt=list:-1 with multibyte chars or TABs in text matched by 'formatlistpat' (John M Devin) Solution: Use the width of the match text (zeertzjq) fixes: vim/vim#15634 closes: vim/vim#15635 https://github.com/vim/vim/commit/61a6ac4d0066317131528f1b3ecc3b3a2599a75c
| * feat(defaults): popupmenu "Open in browser", "Go to definition" #30261Justin M. Keyes2024-09-05
| | | | | | | | - Use the popup to expose more features such as LSP and gx. - Move the copy/paste items lower in the menu, they are lower priority.