summaryrefslogtreecommitdiffstatshomepage
path: root/test/functional/lua/snippet_spec.lua
AgeCommit message (Collapse)AuthorFiles
2026-04-10feat(snippet): support multiple sessions #29340Maria Solano1
2025-09-24test: don't call clear() in both before_each() and after_each() (#35901)zeertzjq1
2025-08-19feat(snippet): highlight active tabstop (#35378)TheBlob421
2025-08-13fix(snippet): adjacent tabstops without placeholders (#35167)TheBlob421
* fix(snippet): adjacent tabstops without placeholders * test(snippet): add tests for directly adjacent tabstops
2025-08-03fix(snippet): early return for final tabstop #35115TheBlob421
The cursor movement autocommand can not detect when the final tabstop $0 is directly adjacent to another tabstop, which prevents ending the snippet session. The fix is an early return when jumping.
2025-07-27fix(snippet): jumping backwards to choice node (#35062)TheBlob421
Avoid duplicate text when jumping back to a choice node. Set cursor to end of tabstop range and prioritize current choice in completion items.
2025-07-27fix(snippet): setting end_right_gravity (#35061)TheBlob421
When right_gravity is set to true for deactivating tabstop expansion we have to set end_right_gravity to false to avoid expanding the tabstop region on the right side. Vice versa for activating tabstop expansion again.
2025-04-23fix(snippet): use <cmd>call cursor() for visual rangeLuuk van Baal1
Problem: Change applied in d3e495ce uses a byte-offset where a virtual column is expected. Solution: Set the cursor directly through a <Cmd> mapping, while making sure the commands are ordered correctly by adding them to the type-ahead buffer.
2025-03-19fix(snippet): wrong indentation when snippet contains "^" #32970Avinash Thakur1
## Problem The pattern used to match indentation is wrong as can be seen in ```lua -- current pattern doesn't match starting space print(vim.inspect((" xyz"):match("(^%s+)%S"))) -- nil -- instead, it matches characters `^ ` in text print(vim.inspect(("x^ yz"):match("(^%s+)%S"))) -- "^ " -- indentation could've been matched by, however not required print(vim.inspect((" xyz"):match("^(%s+)%S"))) -- " " ``` ## Solution We don't even need to modify `base_indent` at every line. If every line's indentation is calculated by the previous line's indentation (which already has starting indentation) added to the starting indentation, we see that indentation is multiplied on every line. Hence, we only add the starting line indentation to every line.
2025-03-14feat(snippet): set snippet keymaps permanent instead of dynamic (#31887)Mathias Fußenegger1
Problem: Given that `vim.snippet.expand()` sets temporary `<tab>`/`<s-tab>` keymaps there is no way to build "smart-tab" functionality where `<tab>` chooses the next completion candidate if the popup menu is visible. Solution: Set the keymap permanent in `_defaults`. The downside of this approach is that users of multiple snippet engine's need to adapt their keymaps to handle all their engines that are in use. For example: vim.keymap.set({ 'i', 's' }, "<Tab>", function() if foreign_snippet.active() then return "<Cmd>lua require('foreign_snippet').jump()<CR>" elseif vim.snippet.active({ direction = 1 }) then return "<Cmd>lua vim.snippet.jump(1)<CR>" else return key end end, { expr = true }) Upside is that using `vim.keymap.set` to override keymaps is a well established pattern and `vim.snippet.expand` calls made by nvim itself or plugins have working keymaps out of the box. Co-authored-by: Maria José Solano <majosolano99@gmail.com>
2024-07-16fix(snippet): modify base indentation when there's actually whitespace (#29670)Maria José Solano1
2024-05-28feat(snippet): add default keymaps during snippet sessionMaria José Solano1
2024-04-29fix(lsp): redundant vim.snippet.jumpable #28560Maria José Solano1
2024-04-28fix(snippet): do not add extra indent on newlines (#28538)Mathias Fußenegger1
Reverts parts of https://github.com/neovim/neovim/pull/27674 LSP snippets typically do include tabs or spaces to add extra indentation and don't rely on the client using `autoindent` functionality. For example: public static void main(String[] args) {\n\t${0}\n} Notice the `\t` after `{\n` Adding spaces or tabs independent of that breaks snippets for languages like Haskell where you can have snippets like: ${1:name} :: ${2}\n${1:name} ${3}= ${0:undefined} To generate: name :: name = undefined
2024-04-23test: improve test conventionsdundargoc1
Specifically, functions that are run in the context of the test runner are put in module `test/testutil.lua` while the functions that are run in the context of the test session are put in `test/functional/testnvim.lua`. Closes https://github.com/neovim/neovim/issues/27004.
2024-04-10refactor(test): inject after_each differentlyLewis Russell1
2024-04-08test: improve test conventionsdundargoc1
Work on https://github.com/neovim/neovim/issues/27004.
2024-03-01fix(snippet): correct indent with newlineglepnir1
Problem: snippet newline use before line indent after expand. Solution: it should level + 1.
2024-02-25fix(lsp): add snippet regression test (#27618)Maria José Solano1
2024-02-05fix(lsp): handle adjacent snippet tabstopsMaria José Solano1
2024-01-28test(lua/snippet_spec): wait for completion menu (#27243)zeertzjq1
This fixes the flakiness caused by typing a completion menu key when the completion menu hasn't showed up.
2024-01-12test: remove helpers.sleep()Lewis Russell1
2024-01-03refactor: format test/*Justin M. Keyes1
2023-11-17refactor(snippet): rename test utilitiesMaria José Solano1
2023-11-17feat(lsp): support for choice snippet nodesMaria José Solano1
2023-10-30fix(lsp): do not cancel snippet when selecting placeholder (#25835)Maria José Solano1
2023-10-26fix(lsp): cancel session when leaving snippet region (#25762)Maria José Solano1
2023-10-23fix(lsp): do not add extra indentationMaria José Solano1
2023-10-23fix(lsp): track snippet deletionMaria José Solano1
2023-10-21feat(lsp): add snippet API (#25301)Maria José Solano1