aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua
Commit message (Collapse)AuthorAge
* 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>
* 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()