Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(nvim): avoid annoying unwanted jumps in LuaSnip
This one has been driving me up the wall. If you type something like this: log<tab> that expands to: console.log(<stuff>); and if later on you type tab somewhere else, like here, where you want an indent: function foo() { <tab> } then LuaSnip will jump back inside the `console.log()`. I thought that setting `history = false` in the config would stop this, because the docs say: > - `history`: If true, Snippets that were exited can still be jumped back into. and it seems I wasn't alone in thinking this: L3MON4D3/LuaSnip#213 That issue lead to this PR: L3MON4D3/LuaSnip#215 which adds an `expand_or_locally_jumpable()` function. So, this commit pulls that in. Two things to note: (1) The LuaSnip update changes the API in a way that produced these errors trying to complete a snippet: E5108: Error executing lua ...vim/pack/bundle/opt/LuaSnip/lua/luasnip/util/environ.lua:16: attempt to index local 'pos' (a nil value) I updated nvim-cmp to see if that would fix it (it didn't), before finding the actual remedy, which was updating cmp_luasnip. (2) `expand_or_locally_jumpable()` only works for forward jumps, not backwards ones like `jumpable(-1)`, so I grabbed the `in_snippet()` function (private to LuaSnip) and adapted it so I could use it for the backwards case as well. I am not actually sure if this is required, strictly speaking, but it doesn't seem to do any harm either, so I'm keeping it. Submodule updates listed below: * aspects/nvim/files/.config/nvim/pack/bundle/opt/LuaSnip b7d520e...89f8712 (59): > fix: Prevent error when snip is deleted and updated from same event. > Format with stylua > perf: Optimize out unnecessary calls to pos_begin_end_raw. > perf: use pos_begin_raw for comparing positions. > perf: improve primitive algorithm for adjusting marks inside snippet. > Auto generate docs > Format with stylua > fix(docstrings): only wrap env-value in table if it is usually in one. > doc: mention `snippet.trigger`. > doc: specify that the immediate parent is passed to the d/fNode-function. > BREAKING CHANGE: don't pass env to snippetNodes. > fix: handle end-mark being one line below after full delete. > fix: Perform snip-delete-check before updating. > Format with stylua > fix: Unlink snippet on out-of-range-errors. > fix: make check for node vs table a bit better. > Auto generate docs > Format with stylua > Merge pull request #226 from ner0-m/feat/fs-for-language-injection > Auto generate docs > doc: use simple ordered list instead of indexing an unordered one. > doc: clarify expected position-format. > Auto generate docs > docs: update lsp_expand-doc. > Auto generate docs > Format with stylua > fix: default captures to empty table. > feat: allow expanding at any position. > Merge pull request #236 from L3MON4D3/refactor_expand > docs: also update link to snippets-table in readme. > docs: recommend skipping auxiliary functions. > fix: fix+improve update-behaviour of restore/dynamic/snippetNode. > Auto generate docs > perf: don't copy restoreNode-snippet in put_initial. Closes #234. > Auto generate docs > feat(choice): Allow passing a table of nodes as choice. > Auto generate docs > docs: misc fixes, rewords, corrections. > Merge pull request #233 from L3MON4D3/restore_position > fix(dyn): prevent querying cleared extmarks. > Auto generate docs > docs: whoops. > Merge pull request #228 from L3MON4D3/restoreNode > Auto generate docs > Merge pull request #229 from tiagovla/fix_typo > fix(dynamicNode): Correctly init subsnips for static text/docstring. > Auto generate docs > doc: recommend `lambda` in text on `functionNode`. > Auto generate docs > doc(luasnip.extras): add it. > Format with stylua > fix(fmt): prevent the same node being reused (close #221). > Merge pull request #216 from rhcher/master > Auto generate docs > Merge pull request #215 from dvdsk/master > Format with stylua > Format with stylua > fix(select): if select ends on a multibyte-char, it's cut off (close #214). > fix(insertNode): node ending with \n leads to wrong selection. * aspects/nvim/files/.config/nvim/pack/bundle/opt/cmp_luasnip 16832bb...7bd2612 (2): > fix(cmp_luasnip): remove unused parameters > Merge pull request #29 from L3MON4D3/master * aspects/nvim/files/.config/nvim/pack/bundle/opt/nvim-cmp 669803b...4efecf7 (103): > Correct vim doc reference for getcmdtype() (#650) > Fix #648 > Fix #582 > Fix #603 > Fix #640 > Fix #646 Resolve all properties by default > Fix #637 > Update issue template > Update issue template > Update issue template > Fix rendering of wide characters in the custom completion window (#641) > docs: clarify behavior of `select` in confirm mapping (#621) > Readme: improve readability of lua code block in setup section (#622) > Fix #610 > feat: add issue template (#604) > Fix docs > fmt > Implement #349 > Fix #595 > fmt > Use vim.lsp.util.apply_text_edits instead of vim-vital-vs > fix: default highlights overriding existing highlights (#591) > Fix duplicate doc tags (#586) > Implement kind highlights (#584) > Fix multibyte chars > Fire change events when selecting different items with native menu completion (#514) > Add documents (#460) > Fix README.md > Improve incomplete handling > Remove misc.readonly Fix #571 > Fix #321 > Allow to take the full SourceConfig from source API (#561) > Normalize keymapping configuration Fix #475 Fix #570 Fix #533 > Fix #567 > Fix #563 > Fix #559 > Improve first display > Fix possible nil argument to string.byte (#550) > Add some wiki info in README (#549) > Rename type as cmdtype > Improve completion reset handling > Fix document about scrolling docs backwards (#538) > Refactor get_active_entry and core.filter (#535) > Add reason to complete function (#529) > Fix cmdline screen cursor > Don't feed <C-f> manually but check auto-indentation > Fix #526 > Fix #520 > cosmetic changes > fmt > Add cmdline expansion test > Add tests > Fix #516 (#517) > Fix #513 > Fixed typo in README.md (#515) > Link to menu appearance page in wiki (#493) > Fix cmdline confirmation bug > Fix #504 > Handle block visual/select modes, refactor mode handling (#498) > Remove unused methods > Improve regex handling > Handle InsertEnter and CmdlineEnter seperately > Remove triggering insert enter event > Improve avoiding InsertEnter's invalid mode detection > Fixes the bug that the `cmp.close` does not close the menu when using native_menu. > Use key sequence to avoid the invalid mode detection > Add textwidth tests > Re-fix autoindent with tests > Fix #494 > Fix #473 > strict mapping handling > Fix tests > Fix #480 > Fix #481 > Add linebreak option to cmp documentation window (#486) > Fix cmdline confirmation > Improve async.step > Save undopoint > Use apply_text_edits to avoid making the unexpected indentation by '<CR>' > fix(ghost_text): generate it using chars instead of bytes (#471) > Escape <Bar> when setting indentkeys (#474) > Fix expansion bug > Allow the callback invoking multiple times if it's the recent one > Support session > Fix native menu bug > tmp fix for serveral bugs > Fix #421 > Fix #463 > Fix and improve README.md (#462) > Fix > Support isIncomplete only response > Fix #458 > Fix #449 > Fix #456 > Organize keymap implementation (#454) > Fix keymap bug > Fix #443 > Rewrite keymap.lua (#452) > Fix #436 > Fix native menu not respecting cmp.PreselectMode.None sometimes (#447) > misc.merge: ensure that `misc.none` is never returned (#441) > README: clarify that a snippet plugin is required (#439) > Add mappings for visual mode (#438)
- Loading branch information