aboutsummaryrefslogtreecommitdiff
path: root/test/functional/helpers.lua
Commit message (Collapse)AuthorAge
* test: remove the pipe created by new_pipename() (#26173)zeertzjq2023-11-23
|
* feat(lsp)!: vim.lsp.inlay_hint.get(), enable(), is_enabled() #25512LW2023-11-12
| | | | | | | | | | | | | | | | | | refactor!: `vim.lsp.inlay_hint()` -> `vim.lsp.inlay_hint.enable()` Problem: The LSP specification allows inlay hints to include tooltips, clickable label parts, and code actions; but Neovim provides no API to query for these. Solution: Add minimal viable extension point from which plugins can query for inlay hints in a range, in order to build functionality on top of. Possible Next Steps --- - Add `virt_text_idx` field to `vim.fn.getmousepos()` return value, for usage in mappings of `<LeftMouse>`, `<C-LeftMouse>`, etc
* feat(extmark): support proper multiline rangesbfredl2023-09-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The removes the previous restriction that nvim_buf_set_extmark() could not be used to highlight arbitrary multi-line regions The problem can be summarized as follows: let's assume an extmark with a hl_group is placed covering the region (5,0) to (50,0) Now, consider what happens if nvim needs to redraw a window covering the lines 20-30. It needs to be able to ask the marktree what extmarks cover this region, even if they don't begin or end here. Therefore the marktree needs to be augmented with the information covers a point, not just what marks begin or end there. To do this, we augment each node with a field "intersect" which is a set the ids of the marks which overlap this node, but only if it is not part of the set of any parent. This ensures the number of nodes that need to be explicitly marked grows only logarithmically with the total number of explicitly nodes (and thus the number of of overlapping marks). Thus we can quickly iterate all marks which overlaps any query position by looking up what leaf node contains that position. Then we only need to consider all "start" marks within that leaf node, and the "intersect" set of that node and all its parents. Now, and the major source of complexity is that the tree restructuring operations (to ensure that each node has T-1 <= size <= 2*T-1) also need to update these sets. If a full inner node is split in two, one of the new parents might start to completely overlap some ranges and its ids will need to be moved from its children's sets to its own set. Similarly, if two undersized nodes gets joined into one, it might no longer completely overlap some ranges, and now the children which do needs to have the have the ids in its set instead. And then there are the pivots! Yes the pivot operations when a child gets moved from one parent to another.
* refactor(map): enhanced implementation, Clean Code™, etc etcbfredl2023-09-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This involves two redesigns of the map.c implementations: 1. Change of macro style and code organization The old khash.h and map.c implementation used huge #define blocks with a lot of backslash line continuations. This instead uses the "implementation file" .c.h pattern. Such a file is meant to be included multiple times, with different macros set prior to inclusion as parameters. we already use this pattern e.g. for eval/typval_encode.c.h to implement different typval encoders reusing a similar structure. We can structure this code into two parts. one that only depends on key type and is enough to implement sets, and one which depends on both key and value to implement maps (as a wrapper around sets, with an added value[] array) 2. Separate the main hash buckets from the key / value arrays Change the hack buckets to only contain an index into separate key / value arrays This is a common pattern in modern, state of the art hashmap implementations. Even though this leads to one more allocated array, it is this often is a net reduction of memory consumption. Consider key+value consuming at least 12 bytes per pair. On average, we will have twice as many buckets per item. Thus old implementation: 2*12 = 24 bytes per item New implementation 1*12 + 2*4 = 20 bytes per item And the difference gets bigger with larger items. One might think we have pulled a fast one here, as wouldn't the average size of the new key/value arrays be 1.5 slots per items due to amortized grows? But remember, these arrays are fully dense, and thus the accessed memory, measured in _cache lines_, the unit which actually matters, will be the fully used memory but just rounded up to the nearest cache line boundary. This has some other interesting properties, such as an insert-only set/map will be fully ordered by insert only. Preserving this ordering in face of deletions is more tricky tho. As we currently don't use ordered maps, the "delete" operation maintains compactness of the item arrays in the simplest way by breaking the ordering. It would be possible to implement an order-preserving delete although at some cost, like allowing the items array to become non-dense until the next rehash. Finally, in face of these two major changes, all code used in khash.h has been integrated into map.c and friends. Given the heavy edits it makes no sense to "layer" the code into a vendored and a wrapper part. Rather, the layered cake follows the specialization depth: code shared for all maps, code specialized to a key type (and its equivalence relation), and finally code specialized to value+key type.
* fix(messages): use "Vimscript" instead of "VimL" #24111Justin M. Keyes2023-06-22
| | | | followup to #24109 fix #16150
* docs(powershell): use tee.exe instead of Tee-ObjectT7272023-04-22
| | | | | | | Problem: Tee-Object does not create a file if it does not receive input for example when :grep does not find matches. and so nvim tries to open a nonexistent errorfile causing an error. Solution: use tee.exe instead of Tee-Object
* test: replace lfs with luv and vim.fsdundargoc2023-04-04
| | | | | | test: replace lfs with luv luv already pretty much does everything lfs does, so this duplication of dependencies isn't needed.
* test: use exec_capture() in more places (#22787)zeertzjq2023-03-26
| | | | | | | Problem: Using `meths.exec2("code", { output = true })` is too verbose. Solution: Use exec_capture() in more places.
* feat(api): nvim_exec2(), deprecate nvim_exec() #19032Evgeni Chasnovski2023-03-25
| | | | | | | Problem: The signature of nvim_exec() is not extensible per ":help api-contract". Solution: Introduce nvim_exec2() and deprecate nvim_exec().
* fix(shell): on Windows :make does not echo #22728Enan Ajmain2023-03-19
| | | | | | | | | | | | | | Problem: On Windows, :make does not display the output of the program it runs. The cause is the default 'shellpipe'. On Linux, nvim uses `tee` to redirect the output to both stdout and the error file. In Windows, for both cmd.exe and powershell, the output is only redirected to the error file. Solution: - On Windows, change the 'shellpipe' default to "2>&1| tee". - Nvim includes `tee` in its Windows package. - Document recommended defaults for powershell. Fixes #12910
* test: move oldtests to test directory (#22536)dundargoc2023-03-07
| | | | | The new oldtest directory is in test/old/testdir. The reason for this is that many tests have hardcoded the parent directory name to be 'testdir'.
* refactor(tests): move lua-client into core and use it for functionaltestsbfredl2023-02-10
| | | | | | | | Eliminates lua-client and non-static libluv as test time dependencies Note: the API for a public lua-client is not yet finished. The interface needs to be adjusted to work in the embedded loop of a nvim instance (to use it to talk between instances)
* refactor(tests): lift retry() into assert_log()Justin M. Keyes2023-01-17
|
* test(fileio_spec): avoid expect_exit() without calling clear() (#21810)zeertzjq2023-01-15
| | | | | Since before_each() doesn't call clear() in these tests, after_each() may call expect_exit() without calling clear() if a test is skipped, causing frequent test failures on Cirrus CI. Close the session instead.
* fix(tui): more work in the TUIbfredl2022-12-31
|
* test: simplify platform detection (#21020)dundargoc2022-11-22
| | | | | Extend the capabilities of is_os to detect more platforms such as freebsd and openbsd. Also remove `iswin()` helper function as it can be replaced by `is_os("win")`.
* feat(test): add Lua forms for API methods (#20152)Lewis Russell2022-11-14
|
* test: introduce skip() #21010dundargoc2022-11-13
| | | | | | | This is essentially a convenience wrapper around the `pending()` function, similar to `skip_fragile()` but more general-purpose. Also remove `pending_win32` function as it can be replaced by `skip(iswin())`.
* docs: various #12823Justin M. Keyes2022-10-09
| | | | | | | | | | | | - increase python line-length limit from 88 => 100. - gen_help_html: fix bug in "tag" case (tbl_count => tbl_contains) ref #15632 fix #18215 fix #18479 fix #20527 fix #20532 Co-authored-by: Ben Weedon <ben@weedon.email>
* fix: make_filter_cmd for :! powershellEnan Ajmain2022-09-30
| | | | | | | | | | | | | | | Problem: `Start-Process` requires the command to be split into the shell command and its arguments. Previously it was done by parsing, which didn't handle cases such as - commands with escaped space in their filepath - quoted commands with space in their filepath Solution: Use - `pwsh -Command` instead of `Start-Process` - `Get-Content` instead of `-RedirectStandardInput` - `Out-File` instead of `-RedirectStandardOutput`
* 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(tests): indicate in test logs when nvim exit times outbfredl2022-09-22
| | | | | | When it happens it wastes 2 seconds which is NOT included in the normal busted timing info. It is hard to correct this, but we can at least print a warning when this happens.
* ci(tests): don't skip parsers on functionaltestChristian Clason2022-09-06
| | | | | Treesitter parsers are now a mandatory part of the installation and should be tested on all platforms. Remove `pending_c_parser` helper.
* test(treesitter): make internal lang test pending when necessaryThomas Vigouroux2022-08-24
|
* feat(ui): allow to set the highlight namespace per windowbfredl2022-08-17
| | | | | - reimplement 'winhl' in terms of highlight namespaces - check for EOF in screen tests (to indicate a likely crash)
* test: deal with RPC call causing Nvim to exit laterzeertzjq2022-07-19
|
* refactor(tests): introduce testprg()Justin M. Keyes2022-06-25
| | | | | | Also: - Add a describe('shell :!') section to system_spec. - Make the test for #16271 work on systems without powershell.
* fix: make_filter_cmd for :! powershell #15913Enan Ajmain2022-06-25
| | | | | | | | | | | | | Problem: Nvim fails to create tempfile "…/nvim6UJx04/7" when 'shell' is set to pwsh (PowerShell Core). This breaks filtered shell commands ":{range}!". With shell set to cmd, it works. Solution: PowerShell doesn't use "<" for stdin redirection. Instead, use "-RedirectStandardInput". Closes #15913
* feat(server): instance "name", store pipes in stdpath(state)Justin M. Keyes2022-06-15
| | | | | | | | | | | | | | | | | | Problem: - Unix sockets are created in random /tmp dirs. - /tmp is messy, unclear when OSes actually clear it. - The generated paths are very ugly. This adds friction to reasoning about which paths belong to which Nvim instances. - No way to provide a human-friendly way to identify Nvim instances in logs or server addresses. Solution: - Store unix sockets in stdpath('state') - Allow --listen "name" and serverstart("name") to given a name (which is appended to a generated path). TODO: - is stdpath(state) the right place?
* feat(logging): include test-id in log messagesJustin M. Keyes2022-06-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: 1. Log messages (especially in CI) are hard to correlate with tests. 2. Since b353a5c05f02 #11886, dumplog() prints the logs next to test failures. This is noisy and gets in the way of the test results. Solution: 1. Associate an incrementing id with each test and include it in log messages. - FUTURE: add v:name so Nvim instances can be formally "named"? 2. Mention "child" in log messages if the current Nvim is a child (based on the presence of $NVIM). BEFORE: DBG … 12345 UI: event DBG … 12345 log_server_msg:722: RPC ->ch 1: … DBG … 12345 UI: flush DBG … 12345 inbuf_poll:444: blocking... events_enabled=1 events_pending=0 DBG … 23454 UI: stop INF … 23454 os_exit:594: Nvim exit: 0 AFTER: DBG … T57 UI: event DBG … T57 log_server_msg:722: RPC ->ch 1: … DBG … T57 UI: flush DBG … T57 inbuf_poll:444: blocking... events_enabled=1 events_pending=0 DBG … T57/child UI: stop INF … T57/child os_exit:594: Nvim exit: 0
* fix(tests): check for EOF on exit of nvim properlybfredl2022-06-13
|
* test: allow running CI without ts parsers installedJames McCoy2022-06-08
|
* feat(defaults): search selection by * and # in visual mode (#18538)yamatsum2022-05-13
|
* feat(server): set $NVIM, unset $NVIM_LISTEN_ADDRESS #11009Justin M. Keyes2022-05-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PROBLEM ------------------------------------------------------------------------ $NVIM_LISTEN_ADDRESS has conflicting purposes as both a parameter ("the current process should listen on this address") and a descriptor ("the current process is a child of this address"). This contradiction means the presence of NVIM_LISTEN_ADDRESS is ambiguous, so child Nvim always tries to listen on its _parent's_ socket. This is the cause of lots of "Failed to start server" spam in our test/CI logs: WARN 2022-04-30… server_start:154: Failed to start server: address already in use: \\.\pipe\nvim-4480-0 WARN 2022-04-30… server_start:154: Failed to start server: address already in use: \\.\pipe\nvim-2168-0 SOLUTION ------------------------------------------------------------------------ 1. Set $NVIM to the parent v:servername, *only* in child processes. - Now the correct way to detect a "parent" Nvim is to check for $NVIM. 2. Do NOT set $NVIM_LISTEN_ADDRESS in child processes. 3. On startup if $NVIM_LISTEN_ADDRESS exists, unset it immediately after server init. 4. Open a channel to parent automatically, expose it as v:parent. Fixes #3118 Fixes #6764 Fixes #9336 Ref https://github.com/neovim/neovim/pull/8247#issuecomment-380275696 Ref #8696
* refactor(ui): simplify stdin handlingbfredl2022-05-02
|
* feat(test): use nvim_exec in helpers.source() #16064Justin M. Keyes2022-03-27
| | | | | | | | helpers.source() was a hack to work around the lack of anonymous :source. Its "create tempfile" behavior is not a required part of most tests that use it. Some tests still need the old "create tempfile" behavior either because they test SID behavior, or because of missing nvim_exec features: #16071
* test: add VIMRUNTIME variable to the clear functionDundar Göc2022-01-08
| | | | Some of the tests will fail if this isn't explicitly set.
* test: fix running functional tests under gdbserverShreyansh Chouhan2021-09-20
| | | | | | | | | | | It was not possible to run the tests under the gdbserver because we were not closing the old session before starting a new one. This caused the server to not to be able to bind to the given address and crashing the tests. This commit closes the session before starting a new one. Signed-off-by: Shreyansh Chouhan <chouhan.shreyansh2702@gmail.com>
* 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`.
* docs: make Lua docstrings consistent #15255Gregory Anders2021-08-22
| | | | | | | | | | | | The official developer documentation in in :h dev-lua-doc specifies to use "--@" for special/magic tokens. However, this format is not consistent with EmmyLua notation (used by some Lua language servers) nor with the C version of the magic docstring tokens which use three comment characters. Further, the code base is currently split between usage of "--@", "---@", and "--- @". In an effort to remain consistent, change all Lua magic tokens to use "---@" and update the developer documentation accordingly.
* feat(defaults): set nojoinspacesGregory Anders2021-08-17
|
* feat: defaults: set undo points in <C-U> and <C-W> (#15400)Gregory Anders2021-08-16
|
* feat(defaults): map CTRL-L to search highlights, update diffs #15385Gregory Anders2021-08-16
|
* feat(defaults): map Y to y$ #13268Matthieu Coudron2021-08-15
| | | | | | | | | rationale: - consistent with D and Y - long recommended by Vim's own ":help Y" close #13268 close #416 ref #6289
* doc(options): Fix recommended PowerShell config (#14349)Dimitri Tcaciuc2021-07-02
| | | | | | | | | | | Ensure that * Shell uses UTF8 input/output mode * Stderr output is captured, in UTF8 * Program exit codes are correctly captured Update functional test harness and add tests for :make command. Closes #13713
* Refactor(tests): Use os commands in mkdir_p helpershadmansaleh2021-06-30
|
* feat(startup): Source runtime/plugin/**/*.lua at startupshadmansaleh2021-06-11
| | | | | | For opt plugins these files are sourced on `:packadd` * `:runtime` Now can exexute lua files
* tests: make treesitter its own categoryBjörn Linse2021-01-03
|
* ex_getln: add secret charmBjörn Linse2020-12-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Opt in to this secret world using set wildchar=0 " already the default, but remove if non-zero existing config: set wildcharm=0 now you can map 'wildmode' just like any mode: cnoremap <tab> <c-z> function! Spacey() return getcmdline()[-1:] == "/" ? "\<bs>" : "" endfunc cnoremap <expr> / wildmenumode() ? Spacey()."/<c-z>" : "/" Possibly asked questions: What about backwards compatibility? ==== Just do nothing and your existing 'wildchar' and 'wildcharm' will keep working. Doesn't `<c-z>` mean suspend? ==== Not in cmdline mode. If it would then the recommended wildcharm would not have been `<c-z>` to start with. My config relies on `:<c-z>` being a synonym to `:<nop>`! ==== just no.
* api: add API for themesBjörn Linse2020-11-01
| | | | | | | | | | co-author: hlpr98 <hlpr98@gmail.com> (dict2hlattrs function) orange is sus?? NOVEMBER DAWN erase the lie that is redraw_later()