aboutsummaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAge
* Add support in Neovim for f38-f63 key bindings.newfeaturesJosh Rahm2021-10-07
| | | | | These bindings are generally accesses with <M-Fx> key presses.
* Move colorcolumn character option to fillchars.Josh Rahm2021-10-05
| | | | listchars is not the right place for it.
* 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.
* Merge pull request #14115 from mfussenegger/lsp-commandsMichael Lingelbach2021-09-22
|\ | | | | lsp: Add a registry for client side code action commands
| * feat(lsp): add a registry for client side code action commandsMathias Fussenegger2021-09-20
| | | | | | | | | | This builds on https://github.com/neovim/neovim/pull/14112 and closes https://github.com/neovim/neovim/issues/12326
| * feat(lsp): include original request params in handler ctxMathias Fussenegger2021-09-20
| | | | | | | | | | | | | | | | | | | | | | This is mostly motivated by https://github.com/neovim/neovim/issues/12326 Client side commands might need to access the original request parameters. Currently this is already possible by using closures with `vim.lsp.buf_request`, but the global handlers so far couldn't access the request parameters.
* | 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): preserve fields from LSP diagnostics via user_data (#15735)masterGregory Anders2021-09-21
| | | | | | * preserve fields from LSP diagnostics via adding a user_data table to the diagnostic, which can hold arbitrary data in addition to the lsp diagnostic information.
* | fix(startup): init.lua: set $MYVIMRC to absolute path #15748Justin M. Keyes2021-09-21
|/ | | | | | - main.c: remove os_setenv("MYVIMRC",…), it is already done by do_source(). - This also sets $MYVIMRC to a full (absolute) path. - code cleanup.
* 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).
* fix(inccommand): ignore trailing commands only for *previewed* command #15638itchyny2021-09-20
| | | | | | | | Since the `State` is global, other scripts are unexpectedly affected during the 'inccommand' preview. This commit introduces a new flag for `do_cmdline`, in order to ignore trailing '|'-separated commands only for the command invoking the preview. fix #8796, update #7494
* feat(diagnostic): match(), tolist(), fromlist() #15704Gregory Anders2021-09-19
| | | | | | * feat(diagnostic): add vim.diagnostic.match() Provide vim.diagnostic.match() to generate a diagnostic from a string and a Lua pattern. * feat(diagnostic): add tolist() and fromlist()
* refactor(tests): remove redir_exec #15718Justin M. Keyes2021-09-19
| | | | | | | | | | | Problem - `redir_exec` is obsolete, but it keeps getting used in new tests because people copy existing tests. - Disadvantages of `redir_exec`: - Captures extra junk before the actual error/message that we _want_ to test. - Does not fail on error, unlike e.g. `command()`. Solution - Use new functions like `nvim_exec` and `pcall_err`.
* feat(lsp): improve vim.lsp.util.apply_text_edits (#15561)hrsh7th2021-09-18
| | | | | - Fix the cursor position after applying TextEdits - Support reversed range of TextEdit - Invoke nvim_buf_set_text one by one
* Merge pull request #15710 from gpanders/show_line_diagnosticsMichael Lingelbach2021-09-18
|\ | | | | fix(diagnostic): resolve nil bufnr in show_line_diagnostics
| * test: add test case for show_line_diagnosticsGregory Anders2021-09-18
| |
* | vim-patch:8.2.3394: filler lines are wrong when changing text in diff mode ↵Jaehwang Jerry Jung2021-09-18
|/ | | | | | | | (#15547) Problem: Filler lines are wrong when changing text in diff mode. Solution: Don't change the filler lines on every change. Check scrollbinding when updating the filler lines. (closes vim/vim#8809) https://github.com/vim/vim/commit/04626c243c47af91c2580eaf23e12286180e0e81
* refactor(runtime): handle pack/foo/start/bar/after dirs properlyBjörn Linse2021-09-18
| | | | | | | | The order should be: XDG_CONFIG_HOME/nvim XDG_DATA_HOME/nvim/site/pack/foo/start/bar/ XDG_CONFIG_HOME/nvim/after XDG_DATA_HOME/nvim/site/pack/foo/start/bar/after
* refactor(runtime): always use DIP_START when searching for runtime filesBjörn Linse2021-09-18
| | | | | | | | Now remove the addition of "start/*" packages in 'packpath' as explicit items in 'runtimepath'. This avoids 'runtimepath' from becoming very long when using a lot of plugins as packages. To get the effective search path as a list, use |nvim_list_runtime_paths()|
* fix(diagnostic): change default severity_sort orderGregory Anders2021-09-17
| | | | | | | When severity_sort is true, higher severities should be displayed before lower severities (e.g. ERROR is displayed over WARN). Also improved the test case for this.
* Merge pull request #15696 from gpanders/diagnostic-sign-fixMichael Lingelbach2021-09-17
|\ | | | | Diagnostic hot fixes
| * fix(diagnostic): support severity_sortGregory Anders2021-09-17
| |
* | fix(typo): overriden -> overridden (RE: PR #14159) (#15360)Oliver Marriott2021-09-17
| |
* | test: reorg #15698Justin M. Keyes2021-09-17
|/ | | | | | | | | | | | | | | | | | | | Problem: Subdirectories like "visual", "insert", "normal" encourage people to separate *related* tests for no good reason. Typically the _mode_ is not the relevant topic of a test (and when it is, _then_ create an appropriate describe() or it()). Solution: - Delete the various `test/functional/<mode>/` subdirectories, move their tests to more meaningful topics. - Rename `…/normal/` to `…/editor/`. - Move or merge `…/visual/*` and `…/insert/*` tests into here where appropriate. - Rename `…/eval/` to `…/vimscript/`. - Move `…/viml/*` into here also. * test(reorg): insert/* => editor/mode_insert_spec.lua * test(reorg): cmdline/* => editor/mode_cmdline_spec.lua * test(reorg): eval core tests => eval_spec.lua
* fix: prevent K_EVENT from stopping Select mode CTRL-O #15688zeertzjq2021-09-17
| | | | | | When using Goneovim, Select mode `CTRL-O` returns back to Select mode immediately (even with `--clean`). Neovim TUI (with some plugins) also randomly returns to Select mode even if no keys are pressed when using `CTRL-O` in Select mode.
* fix(diagnostic): remove useless highlight links (#15683)Gregory Anders2021-09-17
| | | | | | | | | | | | | | | | | | These links were actually defined backwards: the highlight groups actually being used for display are the new "Diagnostic*" groups, so linking the old "LspDiagnostics*" groups to these does absolutely nothing, since there is nothing actually being highlighted with the LspDiagnostics* groups. These links were made in an attempt to preserve backward compatibility with existing colorschemes. We could reverse the links to maintain this preservation, but then that disallows us from actually defining default values for the new highlight groups. Instead, just remove the links and be done with the old LspDiagnostics* highlight groups. This is not technically a breaking change: the breaking change already happened in #15585, but this PR just makes that explicit.
* Merge #15585 refactor: move vim.lsp.diagnostic to vim.diagnosticJustin M. Keyes2021-09-16
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ## Overview - Move vim.lsp.diagnostic to vim.diagnostic - Refactor client ids to diagnostic namespaces - Update tests - Write/update documentation and function signatures Currently, non-LSP diagnostics in Neovim must hook into the LSP subsystem. This is what e.g. null-ls and nvim-lint do. This is necessary because none of the diagnostic API is exposed separately from the LSP subsystem. This commit addresses this by generalizing the diagnostic subsystem beyond the scope of LSP. The `vim.lsp.diagnostic` module is now simply a specific diagnostic producer and primarily maintains the interface between LSP clients and the broader diagnostic API. The current diagnostic API uses "client ids" which only makes sense in the context of LSP. We replace "client ids" with standard API namespaces generated from `nvim_create_namespace`. This PR is *mostly* backward compatible (so long as plugins are only using the publicly documented API): LSP diagnostics will continue to work as usual, as will pseudo-LSP clients like null-ls and nvim-lint. However, the latter can now use the new interface, which looks something like this: ```lua -- The namespace *must* be given a name. Anonymous namespaces will not work with diagnostics local ns = vim.api.nvim_create_namespace("foo") -- Generate diagnostics local diagnostics = generate_diagnostics() -- Set diagnostics for the current buffer vim.diagnostic.set(ns, diagnostics, bufnr) ``` Some public facing API utility methods were removed and internalized directly in `vim.diagnostic`: * `vim.lsp.util.diagnostics_to_items` ## API Design `vim.diagnostic` contains most of the same API as `vim.lsp.diagnostic` with `client_id` simply replaced with `namespace`, with some differences: * Generally speaking, functions that modify or add diagnostics require a namespace as their first argument, e.g. ```lua vim.diagnostic.set({namespace}, {bufnr}, {diagnostics}[, {opts}]) ``` while functions that read or query diagnostics do not (although in many cases one may be supplied optionally): ```lua vim.diagnostic.get({bufnr}[, {namespace}]) ``` * We use our own severity levels to decouple `vim.diagnostic` from LSP. These are designed similarly to `vim.log.levels` and currently include: ```lua vim.diagnostic.severity.ERROR vim.diagnostic.severity.WARN vim.diagnostic.severity.INFO vim.diagnostic.severity.HINT ``` In practice, these match the LSP diagnostic severity levels exactly, but we should treat this as an interface and not assume that they are the same. The "translation" between the two severity types is handled transparently in `vim.lsp.diagnostic`. * The actual "diagnostic" data structure is: (**EDIT:** Updated 2021-09-09): ```lua { lnum = <number>, col = <number>, end_lnum = <number>, end_col = <number>, severity = <vim.diagnostic.severity>, message = <string> } ``` This differs from the LSP definition of a diagnostic, so we transform them in the handler functions in vim.lsp.diagnostic. ## Configuration The `vim.lsp.with` paradigm still works for configuring how LSP diagnostics are displayed, but this is a specific use-case for the `publishDiagnostics` handler. Configuration with `vim.diagnostic` is instead done with the `vim.diagnostic.config` function: ```lua vim.diagnostic.config({ virtual_text = true, signs = false, underline = true, update_in_insert = true, severity_sort = false, }[, namespace]) ``` (or alternatively passed directly to `set()` or `show()`.) When the `namespace` argument is `nil`, settings are set globally (i.e. for *all* diagnostic namespaces). This is what user's will typically use for their local configuration. Diagnostic producers can also set configuration options for their specific namespace, although this is generally discouraged in order to respect the user's global settings. All of the values in the table passed to `vim.diagnostic.config()` are resolved in the same way that they are in `on_publish_diagnostics`; that is, the value can be a boolean, a table, or a function: ```lua vim.diagnostic.config({ virtual_text = function(namespace, bufnr) -- Only enable virtual text in buffer 3 return bufnr == 3 end, }) ``` ## Misc Notes * `vim.diagnostic` currently depends on `vim.lsp.util` for floating window previews. I think this is okay for now, although ideally we'd want to decouple these completely.
| * fix(lint): remove unused function from diagnostic specGregory Anders2021-09-16
| |
| * test: add test case for severity rangesGregory Anders2021-09-15
| |
| * refactor: move vim.lsp.diagnostic to vim.diagnosticGregory Anders2021-09-15
| | | | | | | | | | | | | | | | | | | | | | This generalizes diagnostic handling outside of just the scope of LSP. LSP clients are now a specific case of a diagnostic producer, but the diagnostic subsystem is decoupled from the LSP subsystem (or will be, eventually). More discussion at [1]. [1]: https://github.com/neovim/neovim/pull/15585
* | Merge pull request #15211 from seandewar/blob-portJan Edmund Lazo2021-09-16
|\ \ | | | | | | Port VimL's Blob type - vim-patch:8.1.{0735,0736,0738,0741,0742,0755,0756,0757,0765,0793,0797,0798,0802,1022,1023,1671},8.2.{0121,0184,0404,0521,0829,1473,1866,2712}
| * | feat(f_msgpackparse): support parsing from BlobSean Dewar2021-09-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | Note that it is not possible for msgpack_unpack_next() and msgpack_unpacker_next() to return MSGPACK_UNPACK_EXTRA_BYTES, so it should be fine to abort() on that. Lua 5.1 doesn't support string hex escapes (\xXX) like VimL does (though LuaJIT does), so convert them to decimal escapes (\DDD) in tests.
| * | fix(test/dumplog): tostring(rv) before formatting as stringSean Dewar2021-09-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For example, implicitly converting a table to a string works in LuaJIT, but needs to be done explicitly with tostring() in Lua 5.1. This can cause issues when testing a non-JIT build if eq(), for example, fails with a table argument. E.g: eq({}, {1}) will not print the details of the assertion failure, but will instead print a less helpful "string expected, got table" error.
| * | feat(f_msgpackdump): support dumping to BlobSean Dewar2021-09-16
| | |
| * | feat(f_chansend): support Blob data argumentSean Dewar2021-09-16
| | |
| * | vim-patch:8.2.1473: items in a list given to :const can still be modifiedSean Dewar2021-09-16
| | | | | | | | | | | | | | | | | | | | | Problem: Items in a list given to :const can still be modified. Solution: Work like ":lockvar! name" but don't lock referenced items. Make locking a blob work. https://github.com/vim/vim/commit/021bda56710d98c09a6b35610a476ab2dd8c58ad
| * | vim-patch:8.2.0404: writefile() error does not give a hintSean Dewar2021-09-15
| | | | | | | | | | | | | | | | | | Problem: Writefile() error does not give a hint. Solution: Add remark about first argument. https://github.com/vim/vim/commit/18a2b87ca27c378a555b20f14a284d2ce3511427
| * | vim-patch:8.1.0793: incorrect error messages for functions that take a BlobSean Dewar2021-09-15
| | | | | | | | | | | | | | | | | | | | | Problem: Incorrect error messages for functions that now take a Blob argument. Solution: Adjust the error messages. (Dominique Pelle, closes vim/vim#3846) https://github.com/vim/vim/commit/0d17f0d1c09fa6db306336695ba646c21ea24909
| * | feat(decode_string): decode binary string with NULs to BlobSean Dewar2021-09-15
| | | | | | | | | | | | | | | | | | | | | | | | Strings that previously decoded into a msgpack special for representing BINs with NULs now convert to Blobs. It shouldn't be possible to decode into this special anymore after this change? Notably, Lua strings with NULs now convert to Blobs when passed to VimL.
| * | feat(shada): restore Blob globals properlySean Dewar2021-09-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As Strings and Blobs are encoded as msgpack BINs, the current ShaDa implementation will restore global Blob variables as Strings (or msgpack special dicts if they contain NULs). Encode an additional element with Blob globals to differentiate them from Strings so that we can restore them with the correct type. Adjust variables_spec.lua's autotest() to also check for proper type.
| * | feat(msgpack): convert Blobs to BIN stringsSean Dewar2021-09-15
| | |
| * | feat(json): convert Blobs to array of byte valuesSean Dewar2021-09-15
| | | | | | | | | | | | | | | Similiar to how Vim does it, but to be consistent with how Nvim encodes lists, add a space after every comma.
| * | feat(api): convert Blobs to API stringsSean Dewar2021-09-15
| | | | | | | | | | | | Note that these are not NUL-terminated; the API supports this.
| * | feat(nlua): convert Blobs to stringsSean Dewar2021-09-15
| | |
| * | vim-patch:8.1.0735: cannot handle binary dataSean Dewar2021-09-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Cannot handle binary data. Solution: Add the Blob type. (Yasuhiro Matsumoto, closes vim/vim#3638) https://github.com/vim/vim/commit/6e5ea8d2a995b32bbc5972edc4f827b959f2702f Nvim-specific Blob conversions are implemented in future commits. Refactor write_blob() to use a FileDescriptor, as f_writefile() was refactored to use one (does not apply to read_blob()). Use var_check_lock() in f_add() for Blobs from v8.1.0897. Add a modeline to test_blob.vim and fix some doc typos. Include if_perl.txt's VIM::Blob() documentation. Interestingly, this function already worked before this port, as it just returns a Blob string literal, not an actual Blob object. N/A patches for version.c: vim-patch:8.1.0741: viminfo with Blob is not tested Problem: Viminfo with Blob is not tested. Solution: Extend the viminfo test. Fix reading a blob. Fixed storing a special variable value. https://github.com/vim/vim/commit/8c8b8bb56c724cc1bfc3d8520eec33f2d399697c vim-patch:8.1.1022: may use NULL pointer when out of memory Problem: May use NULL pointer when out of memory. (Coverity) Solution: Check for blob_alloc() returning NULL. https://github.com/vim/vim/commit/e142a9467a7f6845a426d8db6efedf246d3c13ac
* | | fix(test runner): handle nil in no-colors output handler #15679Justin M. Keyes2021-09-16
|/ / | | | | | | | | | | | | | | | | | | | | Problem: 13748512f6d6 #15610 The no-colors codepath of the nvim.lua test output handler does not handle nil, leading to weird symptoms if e.g. a test has a syntax error: test/busted/outputHandlers/nvim.lua:105: attempt to concatenate a nil value Solution: Coerce to string in no-colors handler.
* / fix(:source): copy curbuf lines to memory before sourcing #15111Sean Dewar2021-09-15
|/ | | | | | | | | It's possible for weirdness to happen if curbuf is modified while sourcing from it via :source (with no arguments). For example: - Deleting lines from or wiping curbuf can cause internal error E315 to be thrown from ml_get. - Changing the curbuf to another buffer while sourcing can cause lines from the new curbuf to then be sourced instead.
* fix(:source, nvim_exec): handle Vimscript line continuations #14809Sean Dewar2021-09-14
| | | | | | | | | | | Problem: Anonymous :source (no args) and nvim_exec() don't support Vimscript line continuations. Solution: Factor out the concat logic into concat_continued_line() and a CONCAT_CONTINUED_LINES macro for simple concatenations where lines are fetched individually. Closes #14807
* docs: third-party licenses, TEST_COLORS, system() #15665Justin M. Keyes2021-09-14
|
* fix(lsp): correctly parse LSP snippets #15579hrsh7th2021-09-14
| | | Fixes #15522