| Commit message (Collapse) | Author | Age |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
## 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
Work on https://github.com/neovim/neovim/issues/27004.
|
|
|
|
|
|
| |
Problem: snippet newline use before line indent after expand.
Solution: it should level + 1.
|
| |
|
| |
|
|
|
|
| |
This fixes the flakiness caused by typing a completion menu key when the
completion menu hasn't showed up.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|