aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua
Commit message (Collapse)AuthorAge
* Use weak tables in tree-sitter code (#17117)Thomas Vigouroux2022-09-07
| | | | | | feat(treesitter): use weak tables when possible Also add the defaulttable function to create a table whose values are created when a key is missing.
* fix(diagnostic): remove buf from cache on `BufWipeout` (#20099)Sean Dewar2022-09-06
| | | | | | | | | | | | | | Doing so on `BufDelete` has issues: - `BufDelete` is also fired for listed buffers that are made unlisted. - `BufDelete` is not fired for unlisted buffers that are deleted. This means that diagnostics will be lost for a buffer that becomes unlisted. It also means that if an entry exists for an unlisted buffer, deleting that buffer later will not remove its entry from the cache (and you may see "Invalid buffer id" errors when using diagnostic functions if it was wiped). Instead, remove a buffer from the cache if it is wiped out. This means simply `:bd`ing a buffer will not clear its diagnostics now.
* fix(lua): make ui_attach()/ui_detach() take effect immediately (#20037)zeertzjq2022-09-01
|
* feat(lua): vim.ui_attach to get ui events from luabfredl2022-08-31
| | | | Co-authored-by: Famiu Haque <famiuhaque@protonmail.com>
* fix(lsp): clean the diagnostic cache when buffer delete (#19449)Raphael2022-08-29
| | | Co-authored-by: Gregory Anders <greg@gpanders.com>
* feat(lua): add vim.iconv (#18286)Lewis Russell2022-08-24
| | | Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
* fix(eval): check for v:lua when calling callback (#19855)zeertzjq2022-08-20
| | | This makes callback_call() match call_vim_function() when calling a function.
* fix(tests): remove irrelevant usage of display-=msgsepbfredl2022-08-17
| | | | | | | | These were just added to avoid churn when changing the default of 'display'. To simplify message handling logic, we might want to remove support for printing messages in default_grid later on. This would allow things like printing error messages safely in the middle of redraw, or a future graduation of the 'multigrid' feature.
* test: improve mapping tests and docs (#19619)zeertzjq2022-08-02
|
* feat(lua): allow vim.cmd to be indexed (#19238)Lewis Russell2022-07-20
|
* fix(lua): make it possible to cancel vim.wait() with Ctrl-C (#19217)JP2022-07-19
|
* fix(vim.ui.input): accept nil or empty "opts" #191090x74696d6d792022-06-28
| | | Fix #18143
* refactor(filetype)!: allow vim.filetype.match to use different strategies ↵Gregory Anders2022-06-26
| | | | | | | | | | | | | | | | | | | (#18895) This enables vim.filetype.match to match based on a buffer (most accurate) or simply a filename or file contents, which are less accurate but may still be useful for some scenarios. When matching based on a buffer, the buffer's name and contents are both used to do full filetype matching. When using a filename, if the file exists the file is loaded into a buffer and full filetype detection is performed. If the file does not exist then filetype matching is only performed against the filename itself. Content-based matching does the equivalent of scripts.vim, and matches solely based on file contents without any information from the name of the file itself (e.g. for shebangs). BREAKING CHANGE: use `vim.filetype.match({buf = bufnr})` instead of `vim.filetype.match(name, bufnr)`
* Merge pull request #19041 from lewis6991/globallocalbfredl2022-06-25
|\ | | | | fix(api): nvim_set_option_value for global-local options
| * fix(api): nvim_set_option_value for global-local optionsLewis Russell2022-06-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | global-local window options need to be handled specially. When `win` is given but `scope` is not, then we want to set the local version of the option but not the global one, therefore we need to force `scope='local'`. Note this does not apply to window-local only options (e.g. 'number') Example: nvim_set_option_value('scrolloff', 10, {}) -- global-local window option; set global value nvim_set_option_value('scrolloff', 20, {win=0}) -- global-local window option; set local value nvim_set_option_value('number', true, {}) -- local window option is now equivalent to: nvim_set_option_value('scrolloff', 10, {}) nvim_set_option_value('scrolloff', 20, {win=0, scope='local'}) -- changed from before nvim_set_option_value('number', true, {win=0}) -- unchanged from before Only the global-local option with a `win` provided gets forced to local scope.
* | fix(api): check error after getting win/buf handle (#19052)Gregory Anders2022-06-22
|/
* refactor: use nvim_{get,set}_option_value for vim.{b,w}oGregory Anders2022-06-20
| | | | | | | | | | | | | | | | | | | `nvim_get_option_value` and `nvim_set_option_value` better handle unsetting local options. For instance, this is currently not possible: vim.bo.tagfunc = nil This does not work because 'tagfunc' is marked as "local to buffer" and does not have a fallback global option. However, using :setlocal *does* work as expected :setlocal tagfunc= `nvim_set_option_value` behaves more like :set and :setlocal (by design), so using these as the underlying API functions beneath vim.bo and vim.wo makes those two tables act more like :setlocal. Note that vim.o *already* uses `nvim_set_option_value` under the hood, so that vim.o behaves like :set.
* fix(lua): clear got_int when calling vim.on_key() callback (#18979)zeertzjq2022-06-16
|
* fix(lua): highlight.on_yank can close timer in twice #18976notomo2022-06-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Steps to reproduce: 1. setting `vim.highlight.on_yank` ``` vim.api.nvim_create_autocmd({ "TextYankPost" }, { pattern = { "*" }, callback = function() vim.highlight.on_yank({ timeout = 200 }) end, }) ``` 2. repeat typing `yeye` ... 3. causes the following error. ``` Error executing vim.schedule lua callback: vim/_editor.lua:0: handle 0x01e96970 is already closing stack traceback: [C]: in function 'close' vim/_editor.lua: in function '' vim/_editor.lua: in function <vim/_editor.lua:0> ``` 📝 Test result before fix: [----------] Global test environment setup. [----------] Running tests from test/functional/lua/highlight_spec.lua [ RUN ] vim.highlight.on_yank does not show errors even if buffer is wiped before timeout: 15.07 ms OK [ RUN ] vim.highlight.on_yank does not show errors even if executed between timeout and clearing highlight: 15.07 ms ERR test/helpers.lua:73: Expected objects to be the same. Passed in: (string) 'Error executing vim.schedule lua callback: vim/_editor.lua:0: handle 0x02025260 is already closing stack traceback: [C]: in function 'close' vim/_editor.lua: in function '' vim/_editor.lua: in function <vim/_editor.lua:0>' Expected: (string) ''
* fix(tests): check for EOF on exit of nvim properlybfredl2022-06-13
|
* Merge pull request #18931 from zeertzjq/regexp-num-escapedzeertzjq2022-06-13
|\ | | | | fix(substitute): subtract number of backslashes later
| * fix(substitute): subtract number of backslashes laterzeertzjq2022-06-12
| |
* | fix(buffer): disable buffer-updates before removing from window #18933zeertzjq2022-06-12
|/ | | | | | | | There can be other places that access window buffer info (e.g. `tabpagebuflist()`), so checking `w_closing` in `win_findbuf()` doesn't solve the crash in all cases, and may also cause Nvim's behavior to diverge from Vim. Fix #14998
* feat(filetype): remove side effects from vim.filetype.match (#18894)Gregory Anders2022-06-09
| | | | | | | | Many filetypes from filetype.vim set buffer-local variables, meaning vim.filetype.match cannot be used without side effects. Instead of setting these buffer-local variables in the filetype detection functions themselves, have vim.filetype.match return an optional function value that, when called, sets these variables. This allows vim.filetype.match to work without side effects.
* fix(diagnostic): check for negative column value (#18868)mohsen2022-06-08
|
* feat(fs): add vim.fs.normalize()Gregory Anders2022-05-31
|
* feat(fs): add vim.fs.find()Gregory Anders2022-05-31
| | | | | This is a pure Lua implementation of the Vim findfile() and finddir() functions without the special syntax.
* feat(fs): add vim.fs.dir()Gregory Anders2022-05-31
| | | | | This function is modeled after the path.dir() function from Penlight and the luafilesystem module.
* feat(fs): add vim.fs.basename()Gregory Anders2022-05-31
|
* feat(fs): add vim.fs.dirname()Gregory Anders2022-05-31
|
* feat(fs): add vim.fs.parents()Gregory Anders2022-05-31
| | | | | vim.fs.parents() is a Lua iterator that returns the next parent directory of the given file or directory on each iteration.
* fixup: update test/functional/lua/vim_spec.luaLewis Russell2022-05-17
| | | Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
* feat(lua): allow some viml functions to run in fastLewis Russell2022-05-17
| | | | | This change adds the necessary plumbing to annotate functions in funcs.c as being allowed in run in luv fast events.
* fix(filetype.lua): escape expansion of ~ when used as a patternJames McCoy2022-05-02
|
* fix(shared): avoid indexing unindexable values in vim.tbl_get() (#18337)William Boman2022-05-01
|
* test: correct order of arguments to eq() and neq()zeertzjq2022-04-26
|
* fix(lua): don't mutate opts parameter of vim.keymap.del (#18227)Andrey Mishchenko2022-04-23
| | | | | | `vim.keymap.del` takes an `opts` parameter that lets caller refer to and delete buffer-local mappings. For some reason the implementation of `vim.keymap.del` mutates the table that is passed in, setting `opts.buffer` to `nil`. This is wrong and also undocumented.
* fix(diagnostic): use nvim_exec_autocmds to trigger DiagnosticChanged (#18188)Gregory Anders2022-04-20
| | | | | Use nvim_exec_autocmds to issue the DiagnosticChanged autocommand, rather than nvim_buf_call, which has some side effects when drawing statuslines.
* fix(extmarks): splice extmarks on accepting spellTony Chen2022-04-02
|
* 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)