LunarVim / Neovim-from-scratch

📚 A Neovim config designed from scratch to be understandable
https://www.chrisatmachine.com/
GNU General Public License v3.0
5.31k stars 1.17k forks source link

how to configure for snippets with choice list in `json`? #194

Open thudjx opened 1 year ago

thudjx commented 1 year ago

I am using friendly-snippets to provider snippets for luasnip, following the repository. But I don't know how to config the neovim so that it works well for snippets with choice list, e.g.,

"set font size": {
    "prefix": "fontsize",
    "body": "${1|\\Huge,\\huge,\\LARGE,\\Large,\\large,\\normalsize,\\small,\\footnotesize,\\scriptsize,\\tiny|}",
    "description": "Select a font size"
},

When I type fontsize and <CR>, the choice list doesn't show up and it is always the first choice, i.e., \Huge typed. I have tried to add the codes here to my configuration.This time when I type fontsize and <CR>, the choice list pops up, as shown here: image But I can't do anything from now on. I thought we should add some keymap to handle this event, so I tried to read the documentation of luasnip but found it is lengthy and mainly on the snippets defined in the lua way, rather defined in a json file. So I am wondering is it possible to fix this problem based on the beloved configuration I have followed so far here?