aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua
Commit message (Collapse)AuthorAge
* feat: add vim.tbl_get (#17831)Michael Lingelbach2022-03-24
| | | | | | vim.tbl_get takes a table with subsequent string arguments (variadic) that index into the table. If the value pointed to by the set of keys exists, the function returns the value. If the set of keys does not exist, the function returns nil.
* fix(api, lua): return NIL on failure to find converted function (#17779)zeertzjq2022-03-20
|
* Merge pull request #17459 from rktjmp/lua-error-tostringbfredl2022-03-18
|\ | | | | feat: __tostring lua errors if possible before showing in messages
| * feat: call __tostring on lua errors if possible before reporting to userOliver Marriott2022-02-25
| |
* | feat(api, lua): support converting nested Funcref back to LuaRef (#17749)zeertzjq2022-03-17
| |
* | feat(lua): handle lazy submodules in `:lua vim.` wildmenu completionbfredl2022-03-09
| |
* | fix(lua): don't use nlua_error when exiting earlybfredl2022-03-07
| | | | | | | | Screen state is not initialized yet. Print directly to stderr instead.
* | test(sr.ht): skip luamod-dev test which crashes nvimJames McCoy2022-03-06
| |
* | refactor(lua): reorganize builtin modules, phase 1bfredl2022-03-03
| |
* | Merge pull request #17529 from seandewar/api-string-oopsiebfredl2022-02-28
|\ \ | | | | | | fix(api): convert blob to NUL-terminated API string
| * | fix(api): convert blob to NUL-terminated API stringSean Dewar2022-02-26
| |/ | | | | | | | | Looks like I did an oopsie; although API strings carry a size field, they should still be usable as C-strings! (even though they may contain embedded NULs)
* | refactor(lua): cleanup and docs for threadsbfredl2022-02-26
| |
* | feat(lua): add proper support of luv threadserw72022-02-26
|/
* fix: autoload variables not loaded with vim.g & nvim_get_varshadmansaleh2022-02-13
|
* fix(diff): make algorithm work for vim.diff (#17300)Lewis Russell2022-02-05
| | | Fixes #17207
* fix(api/nvim_win_call): share common win_execute logicSean Dewar2022-02-03
| | | | | | | | | | We have to be sure that the bugs fixed in the previous patches also apply to nvim_win_call. Checking v8.1.2124 and v8.2.4026 is especially important as these patches were only applied to win_execute, but nvim_win_call is also affected by the same bugs. A lot of win_execute's logic can be shared with nvim_win_call, so factor it out into a common macro to reduce the possibility of this happening again.
* vim-patch:8.2.4028: ml_get error with :doautoall and Visual areaSean Dewar2022-02-03
| | | | | | | | Problem: ml_get error with :doautoall and Visual area. (Sean Dewar) Solution: Disable Visual mode while executing autocommands. https://github.com/vim/vim/commit/cb1956d6f2aece8ad93e19e5d4c7e0b5e405f056 This should also fix #16937 for nvim_buf_call, so test for it.
* chore: typo fixes (#16921)dundargoc2022-01-29
| | | Co-authored-by: zeertzjq <zeertzjq@outlook.com>
* fix(eval): v:lua support for `-` in module namesbb010g2022-01-28
|
* feat: use nvim_buf_set_extmark for vim.highlight (#16963)Michael Lingelbach2022-01-15
| | | | | | | | | Closes https://github.com/neovim/neovim/issues/13647 This allows customizing the priority of the highlights. * Add default priority of 50 * Use priority of 200 for highlight on yank * use priority of 40 for highlight references (LSP)
* fix(filetype): expand tildes in filetype patterns (#17091)Gregory Anders2022-01-14
| | | | | | | This allows patterns like ["~/.config/foo"] = "fooscript" to work.
* feat(api, lua): more conversions between LuaRef and Vim Funcrefzeertzjq2022-01-13
|
* test: use old style test for testing filetype.lua (#17003)Gregory Anders2022-01-09
| | | | | This is a much better solution than #16942 as it doesn't require copying every new change from test_filetype.vim into filetype_spec.lua (which is much more maintainable).
* vim-patch:8.2.4014: git and gitcommit file types not properly recognized ↵Christian Clason2022-01-07
| | | | | | | (#16953) Problem: Git and gitcommit file types not properly recognized. Solution: Adjust filetype detection. (Tim Pope, closes vim/vim#9477) https://github.com/vim/vim/commit/c689f8c3d98fffe7e13730e198ce120934528f9c
* fix(lua): print multiple return values with =expr (#16933)Shadman2022-01-06
|
* feat(lua): add notify_once() (#16956)Gregory Anders2022-01-06
| | | Like vim.notify(), but only displays the notification once.
* Merge pull request #16591 from shadmansaleh/feat/lua_keymaps2Björn Linse2022-01-06
|\ | | | | feat(lua): add support for lua keymaps
| * feat(lua): add vim.keymapshadmansaleh2022-01-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This introduces two new functions `vim.keymap.set` & `vim.keymap.del` differences compared to regular set_keymap: - remap is used as opposite of noremap. By default it's true for <Plug> keymaps and false for others. - rhs can be lua function. - mode can be a list of modes. - replace_keycodes option for lua function expr maps. (Default: true) - handles buffer specific keymaps Examples: ```lua vim.keymap.set('n', 'asdf', function() print("real lua function") end) vim.keymap.set({'n', 'v'}, '<leader>lr', vim.lsp.buf.references, {buffer=true}) vim.keymap.set('n', '<leader>w', "<cmd>w<cr>", {silent = true, buffer = 5 }) vim.keymap.set('i', '<Tab>', function() return vim.fn.pumvisible() == 1 and "<C-n>" or "<Tab>" end, {expr = true}) vim.keymap.set('n', '[%', '<Plug>(MatchitNormalMultiBackward)') vim.keymap.del('n', 'asdf') vim.keymap.del({'n', 'i', 'v'}, '<leader>w', {buffer = 5 }) ```
* | test(filetype): port test_filetype to LuaGregory Anders2022-01-05
| | | | | | | | | | | | | | | | | | | | Because filetype.lua is gated behind an opt-in variable, it's not tested during the "standard" test_filetype.vim test. So port the test into filetype_spec where we enable the opt-in variable. This means runtime Vim patches will need to update test_filetype in two places. This can eventually be removed if/when filetype.lua is made opt-out rather than opt-in.
* | fix(filetype): match on <afile> rather than <abuf> (#16943)Gregory Anders2022-01-05
| | | | | | | | | | | | | | Filetype detection runs on BufRead and BufNewFile autocommands, both of which can fire without an underlying buffer, so it's incorrect to use <abuf> to determine the file path. Instead, match on <afile> and assume that the buffer we're operating on is the current buffer. This is the same assumption that filetype.vim makes, so it should be safe.
* | test: fix absolute paths in filetype_spec (#16920)Gregory Anders2022-01-04
|/
* feat: filetype.lua (#16600)Gregory Anders2022-01-04
| | | | Adds a new vim.filetype module that provides support for filetype detection in Lua.
* feat(lua): make =expr print result of exprshadmansaleh2022-01-04
|
* fix(lua): stricter type check when calling API function (#16745)dundargoc2022-01-03
| | | | | Solves #13651 Co-authored-by: Gregory Anders <greg@gpanders.com>
* fix(diagnostic): improve validation for list arguments (#16855)Gregory Anders2022-01-01
| | | | | | Function arguments that expect a list should explicitly use tbl_islist rather than just checking for a table. This helps catch some simple errors where a single table item is passed as an argument, which passes validation (since it's a table), but causes other errors later on.
* feat(lua): add support for multiple optional types in vim.validate (#16864)Shadman2022-01-01
|
* feat(api): implement nvim_{add,del}_user_commandGregory Anders2021-12-28
| | | | | Add support for adding and removing custom user commands with the Nvim API.
* fix(uri): change scheme pattern to not include the comma character (#16797)Dmytro Meleshko2021-12-26
|
* feat(lua): add vim.spell (#16620)Lewis Russell2021-12-25
|
* perf: pre-compile embedded Lua source into bytecode (#16631)Gregory Anders2021-12-16
| | | | | | The Lua modules that make up vim.lua are embedded as raw source files into the nvim binary. These sources are loaded by the Lua runtime on startuptime. We can pre-compile these sources into Lua bytecode before embedding them into the binary, which minimizes the size of the binary and improves startuptime.
* refactor(diagnostic): remove bufnr parameter from open_float (#16579)Gregory Anders2021-12-08
| | | | | | | | | | | | | | The overwhelming majority of use cases for `open_float` are to view diagnostics from the current buffer in a floating window. Thus, most use cases will just `0` or `nil` as the first argument, which makes the argument effectively useless and wasteful. In the cause of optimizing for the primary use case, make the `bufnr` parameter an optional parameter in the options table. This still allows using an alternative buffer for those that wish to do so, but makes the "primary" use case much easier. The old signature is preserved for backward compatibility, though it can likely be fully deprecated at some point.
* fix(diagnostic): escape special chars in file names (#16527)Matthew Toohey2021-12-05
| | | | Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: Gregory Anders <greg@gpanders.com>
* feat(api): add nvim_get_option_valueGregory Anders2021-12-04
|
* feat(diagnostic): use `scope = 'line'` by default for `open_float()` (#16456)cbarrete2021-11-28
| | | | | Closes #16453 Co-authored-by: Cédric Barreteau <cbarrete@users.noreply.github.com>
* test(diagnostic): diagnostics passed to set() should be an arrayGregory Anders2021-11-27
|
* fix(lua): fix vim.deepcopy for metatables & cycled tables (#16435)Shadman2021-11-26
| | | | | vim.deepcopy previously didn't retain metatables in copies and caused stackoverflow on recursive tables/cycled tables this fixes these issues
* test(diagnostic): uncomment equality checkGregory Anders2021-11-24
|
* fix(diagnostic): resolve buffer number in get() (#16407)Gregory Anders2021-11-22
|
* fix(diagnostics): don't allow 0 bufnr for metatable index (#16405)Gregory Anders2021-11-22
| | | | | | | | | | | | | | | | | | | | 04bfd20bb introduced a subtle bug where using 0 as the buffer number in the diagnostic cache resets the cache for the current buffer. This happens because we were not checking to see if the _resolved_ buffer number already existed in the cache; rather, when the __index metamethod was called we assumed the index did not exist so we set its value to an empty table. The fix for this is to check `rawget()` for the resolved buffer number to see if the index already exists. However, the reason this bug was introduced in the first place was because we are simply being too clever by allowing a 0 buffer number as the index which is automatically resolved to a real buffer number. In the interest of minimizing metatable magic, remove this "feature" by requiring the buffer number index to always be a valid buffer. This ensures that the __index metamethod is only ever called for non-existing buffers (which is what we wanted originally) as well as reduces some of the cognitive overhead for understanding how the diagnostic cache works. The tradeoff is that all public API functions must now resolve 0 buffer numbers to the current buffer number.
* fix(diagnostic): remove invalid buffers from cache (#16397)smolck2021-11-21
| | | | | | | | | Errors were being caused by invalid buffers being kept around in diagnostic_cache, so add a metatable to diagnostic_cache which attaches to new buffers in the cache, removing them after they are invalidated. Closes #16391. Co-authored-by: Gregory Anders <8965202+gpanders@users.noreply.github.com>