aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua
Commit message (Collapse)AuthorAge
* 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>
* Merge pull request #16362 from zeertzjq/vim-8.2.3617Jan Edmund Lazo2021-11-21
|\ | | | | vim-patch:8.2.{3468,3617,3618,3622}: some other CWD related patches
| * vim-patch:8.2.3468: problem with :cd when editing file in non-existent directoryzeertzjq2021-11-19
| | | | | | | | | | | | | | Problem: Problem with :cd when editing file in non-existent directory. (Yee Cheng Chin) Solution: Prepend the current directory to get the full path. (closes vim/vim#8903) https://github.com/vim/vim/commit/c6376c798433bcb9ee38a8664299d11454546950
* | fix(diagnostic): fix navigation with diagnostics placed past end of lineGregory Anders2021-11-19
| |
* | fix(diagnostic): deepcopy diagnostics before clamping line numbersGregory Anders2021-11-19
|/ | | | | | | | | | | | | | The current 'clamp_line_numbers' implementation modifies diagnostics in place, which can have adverse downstream side effects. Before clamping line numbers, make a copy of the diagnostic. This commit also merges the 'clamp_line_numbers' method into a new 'get_diagnostics' local function which also implements the more general "get" method. The public 'vim.diagnostic.get()' API now just uses this function (without clamping). This has the added benefit that other internal API functions that need to use get() no longer have to go through vim.validate. Finally, reorganize the source code a bit by grouping all of the data structures together near the top of the file.
* Merge pull request #16328 from gpanders/diagnostic-prefix-hiGregory Anders2021-11-16
|\
| * refactor(diagnostic)!: rename 'show_header' to 'header'Gregory Anders2021-11-15
| | | | | | | | | | | | Rename the `show_header` option in `open_float` to simply `header` and allow users to specify both the header string as well as the highlight group.
| * feat(diagnostic): allow 'prefix' option to return highlightGregory Anders2021-11-15
| | | | | | | | | | Extend the 'prefix' option for `open_float` to also provide an optional highlight group for the prefix string.
* | refactor(diagnostic): make bufnr arguments consistent (#16323)Gregory Anders2021-11-16
|/ | | | | | | Make the bufnr argument have similar semantics across API functions; namely, a nil value means "all buffers" while 0 means "current buffer". This increases the flexibility of the API by allowing functions such as enable() and disable() to apply globally or per-namespace, rather than only on a specific buffer.
* feat(diagnostic): add 'prefix' option to open_float (#16321)Gregory Anders2021-11-14
| | | | The 'prefix' option accepts a function or a string that is used to add a prefix string to each diagnostic displayed in the floating window.
* feat(diagnostic): do not require namespace for hide() and show() (#16261)Gregory Anders2021-11-09
| | | | | | | Also fix a few other small bugs regarding saving and restoring extmarks. In particular, now that the virtual text and underline handlers have their own dedicated namespaces, they should be responsible for saving and restoring their own extmarks. Also fix the wrong argument ordering in the call to `clear_diagnostic_cache` in the `on_detach` callback.
* feat(ui): add vim.ui.input and use in lsp rename (#15959)Sebastian Lyng Johansen2021-11-07
| | | | | | * vim.ui.input is an overridable function that prompts for user input * take an opts table and the `on_confirm` callback, see `:help vim.ui.input` for more details * defaults to a wrapper around vim.fn.input(opts) * switches the built-in client's rename handler to use vim.ui.input by default
* feat(lua): enable stack traces in error output (#16228)Gregory Anders2021-11-06
|
* fix(diagnostic): fix option resolution in open_float (#16229)Gregory Anders2021-11-04
|
* feat: add vim.str_utf_{start,end} (#16129)Michael Lingelbach2021-10-30
| | | | | vim.str_utf_{start,end} return the offset from the current position to the start and end of the current utf-character (nearest codepoint) respectively.
* fix(vim.mpack): rename pack/unpack => encode/decode #16175Justin M. Keyes2021-10-30
| | | | | | | | | | | | | | | | | | | | | | | Problem: 1. "unpack" has an unrelated meaning in Lua: https://www.lua.org/manual/5.1/manual.html#pdf-unpack 2. We already have msgpackparse()/msgpackdump() and json_encode()/json_decode(), so introducing another name for the same thing is entropy. Solution: - Rename vim.mpack.pack/unpack => vim.mpack.encode/decode Caveat: This is incongruent with the `Unpacker` and `Packer` functions. - It's probably too invasive to rename those. - They also aren't part of our documented interface. - This commit is "reversible" in the sense that we can always revert it and add `vim.mpack.encode/decode` as _aliases_ to `vim.mpack.pack/unpack`, at any time in the future, if we want stricter fidelity with upstream libmpack. Meanwhile, `vim.mpack.encode/decode` is currently the total _documented_ interface of `vim.mpack`, so this change serves the purpose of consistent naming in the Nvim stdlib.
* refactor(diagnostic): make display handlers generic (#16137)Gregory Anders2021-10-29
| | | | | | | Rather than treating virtual_text, signs, and underline specially, introduce the concept of generic "handlers", of which those three are simply the defaults bundled with Nvim. Handlers are called in `vim.diagnostic.show()` and `vim.diagnostic.hide()` and are used to handle how diagnostics are displayed.
* Merge pull request #16124 from mjlbach/feat/bjorn-baitBjörn Linse2021-10-24
|\ | | | | feat: add vim.str_utf_pos
| * feat: add vim.str_utf_pos functionMichael Lingelbach2021-10-24
| | | | | | | | | | vim.str_utf_pos returns the codepoints for all utf-8 chars (only, currently) in a string
* | feat(lua): document support of packages with v:lua syntaxBjörn Linse2021-10-23
|/ | | | this already worked in 0.5 but was not properly documented or tested
* Merge pull request #14794 from BK1603/gdbserver_fixMatthieu Coudron2021-10-20
|\ | | | | functionaltest: fix running tests under gdbserver
| * test: close timers in vim_spec.lua functional testShreyansh Chouhan2021-09-20
| | | | | | | | | | | | | | Close the timer started during tests before closing the session. This fixes the uv_loop_close hangs happening in the functional tests. Signed-off-by: Shreyansh Chouhan <chouhan.shreyansh2702@gmail.com>
* | fix(diagnostic): handle diagnostics placed past the end of line (#16095)Gregory Anders2021-10-19
| |
* | feat(lua): allow passing handles to vim.b/w/tLewis Russell2021-10-19
| | | | | | | | | | | | vim.bo can target a specific buffer by indexing with a number, e.g: `vim.bo[2].filetype` can get/set the filetype for buffer 2. This change replicates that behaviour for the variable namespace.
* | refactor(diagnostic)!: replace 'show_*' functions with 'open_float' (#16057)Gregory Anders2021-10-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 'show_line_diagnostics()' and 'show_position_diagnostics()' are almost identical; they differ only in the fact that the latter also accepts a column to form a full position, rather than just a line. This is not enough to justify two separate interfaces for this common functionality. Renaming this to simply 'show_diagnostics()' is one step forward, but that is also not a good name as the '_diagnostics()' suffix is redundant. However, we cannot name it simply 'show()' since that function already exists with entirely different semantics. Instead, combine these two into a single 'open_float()' function that handles all of the cases of showing diagnostics in a floating window. Also add a "float" key to 'vim.diagnostic.config()' to provide global values of configuration options that can be overridden ephemerally. This makes the float API consistent with the rest of the diagnostic API. BREAKING CHANGE
* | Merge pull request #15999 from famiu/fix/build/export-windows-symbolsBjörn Linse2021-10-17
|\ \ | | | | | | fix(build): export symbols on Windows
| * | fix(build): export symbols on WindowsFamiu Haque2021-10-17
| | | | | | | | | | | | | | | | | | Closes https://github.com/neovim/neovim/issues/15063 Allows using Neovim core functions using LuaJIT FFI on Windows.
* | | Merge pull request #15973 from bfredl/luapathBjörn Linse2021-10-17
|\ \ \ | | | | | | | | fix(runtime): don't use regexes inside lua require'mod'
| * | | fix(runtime): don't use regexes inside lua require'mod'Björn Linse2021-10-17
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #15147 and fixes #15497. Also sketch "subdir" caching. Currently this only caches whether an rtp entry has a "lua/" subdir but we could consider cache other subdirs potentially or even "lua/mybigplugin/" possibly. Note: the async_leftpad test doesn't actually fail on master, at least not deterministically (even when disabling the fast_breakcheck throttling). It's still useful as a regression test for further changes and included as such.
* / / fix(diagnostic): do not override existing config settings #16043Gregory Anders2021-10-17
|/ / | | | | | | | | | | | | | | | | | | | | When using `true` as the value of a configuration option, the option is configured to use default values. For example, if a user configures virtual text to include the source globally (using vim.diagnostic.config) and a specific namespace or producer configures virtual text with `virt_text = true`, the user's global configuration is overriden. Instead, interpret a value of `true` to mean "use existing settings if defined, otherwise use defaults".
* | fix: correctly capture uri scheme on windows (#16027)Michael Lingelbach2021-10-15
| | | | | | | | | | | | closes https://github.com/neovim/neovim/issues/15261 * normalize uri path to forward slashes on windows * use a capture group on windows that avoids mistaking drive letters as uri scheme
* | Merge pull request #15502 from seandewar/vim-8.1.1921Jan Edmund Lazo2021-10-10
|\ \ | | | | | | Add method call support for more built-ins: vim-patch:8.1.{1336,1952,1961,1984}
| * | feat(eval/method): partially port v8.1.1954Sean Dewar2021-10-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Does not include listener_*() functions. js_*() functions are N/A. json_encode() and json_decode() didn't include tests; add some anyway (to json_functions_spec.lua). test_lua.vim isn't included yet, so add tests to luaeval_spec.lua.
* | | fix(buffer_updates): handle :sort of already sorted bufferBjörn Linse2021-10-08
| | |
* | | fix(api): check type in nlua_pop_keydict (#15940)virchau132021-10-08
| | |
* | | fix: support severity_sort option for show_diagnostic functions (#15948)Gregory Anders2021-10-07
| | | | | | | | | Support the severity_sort option for show_{line,position}_diagnostics.
* | | fix(buffer_updates): cleanup test behaviorBjörn Linse2021-10-07
| | |
* | | fix(buffer_updates): make `lockmarks` not affect extmarks and buffer ↵Anton Adamansky2021-10-07
| | | | | | | | | | | | | | | | | | updates. fixes #12861 Now mark_adjust() will trigger appropriate buf_updates_send_splice() called by extmark_adjust()
* | | fix(buffer_updates): handle :delete of the very last line in bufferBjörn Linse2021-10-07
| | |
* | | fix(extmarks): splice extmarks on nv_Undo #15920Tony Chen2021-10-06
| | |
* | | Merge #15218 from gpanders/split-trimemptyJustin M. Keyes2021-10-03
|\ \ \ | |/ / |/| | feat(lua): add "noempty" param to vim.split()
| * | refactor: use kwargs parameter in vim.splitGregory Anders2021-09-25
| | |
| * | feat: add trimempty optional parameter to vim.splitGregory Anders2021-09-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `split()` VimL function trims empty items from the returned list by default, so that, e.g. split("\nhello\nworld\n\n", "\n") returns ["hello", "world"] The Lua implementation of vim.split does not do this. For example, vim.split("\nhello\nworld\n\n", "\n") returns {'', 'hello', 'world', '', ''} Add an optional parameter to the vim.split function that, when true, trims these empty elements from the front and back of the returned table. This is only possible for vim.split and not vim.gsplit; because vim.gsplit is an iterator, there is no way for it to know if the current item is the last non-empty item. Note that in order to preserve backward compatibility, the parameter for the Lua vim.split function is `trimempty`, while the VimL function uses `keepempty` (i.e. they are opposites). This means there is a disconnect between these two functions that may surprise users.
* | | test(diagnostic): add test case for signsGregory Anders2021-10-02
| | |
* | | fix(ui): s/format_entry/format_item to match docs (#15819)Mathias Fußenegger2021-09-27
| | | | | | | | | Follow up to https://github.com/neovim/neovim/pull/15771
* | | feat(ui): add vim.ui.select and use in code actions (#15771)Mathias Fußenegger2021-09-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Continuation of https://github.com/neovim/neovim/pull/15202 A plugin like telescope could override it with a fancy implementation and then users would get the telescope-ui within each plugin that utilizes the vim.ui.select function. There are some plugins which override the `textDocument/codeAction` handler solely to provide a different UI. With custom client commands and soon codeAction resolve support, it becomes more difficult to implement the handler right - so having a dedicated way to override the picking function will be useful.
* | | test: add tests for vim.jsonMichael Lingelbach2021-09-26
|/ /
* | feat(diagnostic): allow customized diagnostic messages (#15742)Gregory Anders2021-09-22
| | | | | | | | Provide a 'format' option for virtual text and floating window previews that allows the displayed text of a diagnostic to be customized.
* | feat(diagnostic): add option to include diagnostic sourceGregory Anders2021-09-21
| | | | | | | | | | Add an option to virtual text display and floating window previews to include diagnostic source in the diagnostic message.
* | fix(diagnostic): clamp line numbers in display layer (#15729)Gregory Anders2021-09-20
|/ | | | | | Some parts of LSP need to use cached diagnostics as sent from the LSP server unmodified. Rather than fixing invalid line numbers when diagnostics are first set, fix them when they are displayed to the user (e.g. in show() or one of the get_next/get_prev family of functions).