-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: extract word from completion item for auto-insert preview (#341)
* feat: extract word from completion item for auto-insert preview Use a modified version of nvim-cmp's word extraction algorithm from expanded snippets for use in auto-insert preview textEdits. For example, if a snippet expansion results in something like: ``` my_neat_function(int arg1, double arg2) ``` Then the floating window will show the above for that completion, but when selecting it, the buffer will only insert `my_neat_function`. This allows using the snippet completion item without actually _accepting_ it by just selecting it in the preview window and then continuing to type. So one could type "my_n", Ctrl-N/Tab (or whatever your keymap is) to select `my_neat_function`, and then just continue with typing the ( and args manually. Of course, accepting the completion will still work as expected by expanding the snippet. * refactor: word extraction for auto-insert preview --------- Co-authored-by: Liam Dyer <[email protected]>
- Loading branch information
Showing
2 changed files
with
64 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters