aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua
Commit message (Collapse)AuthorAge
* fix(lua): assert failure with vim.regex() error inside :silent! (#20555)RZia2022-10-10
| | | Co-authored-by: zeertzjq <zeertzjq@outlook.com>
* fix(docs-html): keycodes, taglinks, column_heading #20498Justin M. Keyes2022-10-06
| | | | | | | | | | | | | | | | | | Problem: - Docs HTML: "foo ~" headings (column_heading) are not aligned with their table columns/contents because the leading whitespace is not emitted. - taglinks starting with hyphen like |-x| were not recognized. - keycodes like `<foo>` and `CTRL-x` were not recognized. - ToC is not scrollable. Solution: - Add ws() to the column_heading case. - Update help parser to latest version - supports `keycode` - fixes for taglink, argument - Update .toc CSS. https://github.com/neovim/neovim.github.io/issues/297 fix https://github.com/neovim/neovim.github.io/issues/297
* feat(docs): nested lists in HTML, update :help parserJustin M. Keyes2022-10-04
| | | | | | | | | | | | - Docs HTML: improvements in https://github.com/neovim/tree-sitter-vimdoc allow us to many hacks in `gen_help_html.lua`. - Docs HTML: support nested lists. - Docs HTML: avoid extra newlines (too much whitespace) in old (preformatted) layout. - Docs HTML: disable golden-grid for narrow viewport. - Workaround for https://github.com/neovim/neovim/issues/20404 closes https://github.com/neovim/neovim/issues/20404
* docs: fix typos (#20394)dundargoc2022-09-30
| | | | | Co-authored-by: Raphael <glephunter@gmail.com> Co-authored-by: smjonas <jonas.strittmatter@gmx.de> Co-authored-by: zeertzjq <zeertzjq@outlook.com>
* feat(docs): fixes for :help HTML generatorJustin M. Keyes2022-09-29
| | | | Generate correct leading whitespace for argument, taglink, tag, etc.
* test: add a Lua test for #17501 (#20392)zeertzjq2022-09-29
|
* feat(gen_help_html.lua): adapt to new parserJustin M. Keyes2022-09-28
| | | | | - adapt to parser changes from https://github.com/vigoux/tree-sitter-vimdoc/pull/16 - numerous other generator improvements
* fix!: make :undo! notify buffer update callbacks (#20344)zeertzjq2022-09-26
| | | | | | | | | When :undo! was introduced to Nvim the implementation of 'inccommand' preview callback hasn't been fully decided yet, so not notifying buffer update callbacks made sense for 'inccommand' preview callback in case it needs to undo the changes itself. Now it turns out that the undo-and-forget is done automatically for 'inccommand', so it doesn't make sense for :undo! to avoid notifying buffer update callbacks anymore.
* fix(filetype): use :setf instead of nvim_buf_set_option (#20334)zeertzjq2022-09-25
|
* Merge #11967 generate :help HTML with treesitterJustin M. Keyes2022-09-22
|\
| * feat(docs): gen_help_html.luaJustin M. Keyes2022-09-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: The :help docs HTML generated is driven by an old awk script `runtime/doc/makehtml.awk` that is hard to maintain (ad hoc parser and no one has touched it in decades) and has bugs like: - https://github.com/neovim/neovim.github.io/issues/96 - https://github.com/neovim/neovim.github.io/issues/97 Solution: Use Lua + treesitter (https://github.com/vigoux/tree-sitter-vimdoc) to generate :help docs HTML. Also validates tag links. fix https://github.com/neovim/neovim.github.io/issues/96 fix https://github.com/neovim/neovim.github.io/issues/97 TODO: - delete doc_html build task - delete runtime/doc/Makefile - delete makehtml.awk - delete maketags.awk OUTPUT: $ nvim -V1 -es --clean +"lua require('scripts.gen_help_html')" output dir: /…/neovim.github.io/_site/doc/ generated (207 errors): api.txt => api.html generated (122 errors): arabic.txt => arabic.html generated (285 errors): autocmd.txt => autocmd.html generated (641 errors): builtin.txt => builtin.html generated (623 errors): change.txt => change.html generated (65 errors): channel.txt => channel.html generated (353 errors): cmdline.txt => cmdline.html generated (3 errors): debug.txt => debug.html generated (28 errors): deprecated.txt => deprecated.html generated (193 errors): dev_style.txt => dev_style.html generated (460 errors): develop.txt => develop.html generated (19 errors): diagnostic.txt => diagnostic.html generated (57 errors): diff.txt => diff.html generated (818 errors): digraph.txt => digraph.html generated (330 errors): editing.txt => editing.html generated (368 errors): eval.txt => eval.html generated (184 errors): fold.txt => fold.html generated (61 errors): ft_ada.txt => ft_ada.html generated (0 errors): ft_ps1.txt => ft_ps1.html generated (20 errors): ft_raku.txt => ft_raku.html generated (5 errors): ft_rust.txt => ft_rust.html generated (41 errors): ft_sql.txt => ft_sql.html generated (110 errors): gui.txt => gui.html generated (79 errors): hebrew.txt => hebrew.html generated (17 errors): help.txt => index.html generated (104 errors): helphelp.txt => helphelp.html generated (0 errors): if_cscop.txt => if_cscop.html generated (23 errors): if_perl.txt => if_perl.html generated (16 errors): if_pyth.txt => if_pyth.html generated (9 errors): if_ruby.txt => if_ruby.html generated (216 errors): indent.txt => indent.html generated (634 errors): index.txt => vimindex.html generated (320 errors): insert.txt => insert.html generated (265 errors): intro.txt => intro.html generated (9 errors): job_control.txt => job_control.html generated (0 errors): lsp-extension.txt => lsp-extension.html generated (214 errors): lsp.txt => lsp.html generated (311 errors): lua.txt => lua.html generated (592 errors): luaref.txt => luaref.html generated (798 errors): luvref.txt => luvref.html generated (663 errors): map.txt => map.html generated (228 errors): mbyte.txt => mbyte.html generated (228 errors): message.txt => message.html generated (0 errors): mlang.txt => mlang.html generated (761 errors): motion.txt => motion.html generated (4 errors): nvim.txt => nvim.html generated (226 errors): nvim_terminal_emulator.txt => nvim_terminal_emulator.html generated (988 errors): options.txt => options.html generated (567 errors): pattern.txt => pattern.html generated (15 errors): pi_gzip.txt => pi_gzip.html generated (10 errors): pi_health.txt => pi_health.html generated (27 errors): pi_msgpack.txt => pi_msgpack.html generated (2177 errors): pi_netrw.txt => pi_netrw.html generated (41 errors): pi_paren.txt => pi_paren.html generated (9 errors): pi_spec.txt => pi_spec.html generated (218 errors): pi_tar.txt => pi_tar.html generated (0 errors): pi_tutor.txt => pi_tutor.html generated (235 errors): pi_zip.txt => pi_zip.html generated (265 errors): print.txt => print.html generated (31 errors): provider.txt => provider.html generated (335 errors): quickfix.txt => quickfix.html generated (572 errors): quickref.txt => quickref.html generated (109 errors): recover.txt => recover.html generated (14 errors): remote.txt => remote.html generated (14 errors): remote_plugin.txt => remote_plugin.html generated (351 errors): repeat.txt => repeat.html generated (23 errors): rileft.txt => rileft.html generated (12 errors): russian.txt => russian.html generated (6 errors): scroll.txt => scroll.html generated (106 errors): sign.txt => sign.html generated (347 errors): spell.txt => spell.html generated (784 errors): starting.txt => starting.html generated (1499 errors): syntax.txt => syntax.html generated (23 errors): tabpage.txt => tabpage.html generated (257 errors): tagsrch.txt => tagsrch.html generated (31 errors): term.txt => term.html generated (0 errors): testing.txt => testing.html generated (96 errors): tips.txt => tips.html generated (57 errors): treesitter.txt => treesitter.html generated (71 errors): uganda.txt => uganda.html generated (74 errors): ui.txt => ui.html generated (87 errors): undo.txt => undo.html generated (17 errors): userfunc.txt => userfunc.html generated (1 errors): usr_01.txt => usr_01.html generated (89 errors): usr_02.txt => usr_02.html generated (293 errors): usr_03.txt => usr_03.html generated (46 errors): usr_04.txt => usr_04.html generated (96 errors): usr_05.txt => usr_05.html generated (54 errors): usr_06.txt => usr_06.html generated (20 errors): usr_07.txt => usr_07.html generated (241 errors): usr_08.txt => usr_08.html generated (130 errors): usr_09.txt => usr_09.html generated (50 errors): usr_10.txt => usr_10.html generated (33 errors): usr_11.txt => usr_11.html generated (32 errors): usr_12.txt => usr_12.html generated (22 errors): usr_20.txt => usr_20.html generated (75 errors): usr_21.txt => usr_21.html generated (8 errors): usr_22.txt => usr_22.html generated (3 errors): usr_23.txt => usr_23.html generated (163 errors): usr_25.txt => usr_25.html generated (13 errors): usr_26.txt => usr_26.html generated (84 errors): usr_27.txt => usr_27.html generated (173 errors): usr_28.txt => usr_28.html generated (285 errors): usr_29.txt => usr_29.html generated (280 errors): usr_30.txt => usr_30.html generated (11 errors): usr_31.txt => usr_31.html generated (13 errors): usr_32.txt => usr_32.html generated (156 errors): usr_40.txt => usr_40.html generated (134 errors): usr_41.txt => usr_41.html generated (35 errors): usr_42.txt => usr_42.html generated (19 errors): usr_43.txt => usr_43.html generated (60 errors): usr_44.txt => usr_44.html generated (13 errors): usr_45.txt => usr_45.html generated (1 errors): usr_toc.txt => usr_toc.html generated (69 errors): various.txt => various.html generated (68 errors): vi_diff.txt => vi_diff.html generated (437 errors): vim_diff.txt => vim_diff.html generated (296 errors): visual.txt => visual.html generated (181 errors): windows.txt => windows.html generated 119 html pages total errors: 23862 invalid tags: 537
* | Merge pull request #20103 from lewis6991/refactor/vim_optLewis Russell2022-09-22
|\ \ | |/ |/|
| * refactor(vim.opt): unify vim.bo/wo buildingLewis Russell2022-09-09
| |
* | fix(eval)!: make Lua Funcref work as method and in substitute() (#20217)zeertzjq2022-09-16
| | | | | | | | | | | | | | | | | | | | | | | | BREAKING CHANGE: When using a Funcref converted from a Lua function as a method in Vim script, the result of the base expression is now passed as the first argument instead of being ignored. vim-patch:8.2.5117: crash when calling a Lua callback from a :def function Problem: Crash when calling a Lua callback from a :def function. (Bohdan Makohin) Solution: Handle FC_CFUNC in call_user_func_check(). (closes vim/vim#10587) https://github.com/vim/vim/commit/7d149f899d423b7bf2b90d7b11ebe3e560c462b9
* | fix(lua): free vim.ui_attach callback before lua close (#20205)notomo2022-09-16
| |
* | Merge pull request #20164 from bfredl/luanullbfredl2022-09-13
|\ \ | | | | | | fix(lua): make vim.str_utfindex and vim.str_byteindex handle NUL bytes
| * | fix(lua): make vim.str_utfindex and vim.str_byteindex handle NUL bytesbfredl2022-09-13
| |/ | | | | | | fixes #16290
* | feat(fs): extend fs.find to accept predicate (#20193)Mathias Fußenegger2022-09-13
| | | | | | | | | | | | | | | | | | | | | | | | | | Makes it possible to use `vim.fs.find` to find files where only a substring is known. This is useful for `vim.lsp.start` to get the `root_dir` for languages where the project-file is only known by its extension, not by the full name. For example in .NET projects there is usually a `<projectname>.csproj` file in the project root. Example: vim.fs.find(function(x) return vim.endswith(x, '.csproj') end, { upward = true })
* | feat(diagnostic): pass diagnostics as data to DiagnosticChanged autocmd (#20173)Gregory Anders2022-09-13
|/
* 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.