aboutsummaryrefslogtreecommitdiff
path: root/test/functional
Commit message (Collapse)AuthorAge
* 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
* | 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.
* | feat(f_msgpackdump): support dumping to BlobSean Dewar2021-09-16
| |
* | feat(f_chansend): support Blob data argumentSean Dewar2021-09-16
| |
* | 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(: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
* fix(lsp): correctly parse LSP snippets #15579hrsh7th2021-09-14
| | | Fixes #15522
* Merge pull request #15639 from bfredl/xdataBjörn Linse2021-09-12
|\ | | | | fix(tests): use isolated XDG_DATA_HOME in startup tests
| * fix(tests): use isolated XDG_DATA_HOME in startup testsBjörn Linse2021-09-12
| | | | | | | | | | | | | | | | | | Otherwise the users site packages will be loaded from ~/.local/share/nvim/site which can cause unexpected error messages and other kinds of mayhem Simpler alternative: use "--noplugin". Shouldn't be done because: (1) these tests should test the ordinary startup code path as close as possible (2) tests that test the loading of site packages will be added here very soon
* | Merge pull request #14770 from andrew-pa/fix13403Björn Linse2021-09-12
|\ \ | |/ |/| Fix relative float positioning
| * fix(windowing): positioning of relative floatsandrew-pa2021-09-08
| | | | | | | | | | | | Fix relative floating windows so that they open in the correct position relative to each other. Also make sure that their positions are correct immediately after creation without a redraw.
* | feat(api): win_viewport also sends line_count #15613Yatao Li2021-09-10
| |
* | fix(mouse.c): fix mouse drag positions on multigrid #12667Ville Hakulinen2021-09-10
| | | | | | | | | | | | | | Currently, multigrid mouse drag positions are handled incorrectly if the drag event is not in the top left grid. Fix this by not adjusting the position of the event in jump_to_mouse. related: #15091
* | Merge pull request #15566 from bfredl/mpackBjörn Linse2021-09-09
|\ \ | | | | | | libs: vendor libmpack and libmpack-lua
| * | feat(lua): make vim.mpack support vim.NIL and vim.empty_dict()Björn Linse2021-09-09
| | |
* | | Merge pull request #15091 from yatli/mouse_drag_fixBjörn Linse2021-09-09
|\ \ \ | |/ / |/| | fix #15075 (mouse crash in multigrid)
| * | fix(multigrid): #15075 mouse events crash neovimYatao Li2021-09-08
| | |
* | | docs: naming conventionsJustin M. Keyes2021-09-09
| | |
* | | feat(lua)!: register_keystroke_callback => on_keyJustin M. Keyes2021-09-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | Analogous to nodejs's `on('data', …)` interface, here on_key is the "add listener" interface. ref 3ccdbc570d85 #12536 BREAKING_CHANGE: vim.register_keystroke_callback() is now an error.