blink.cmp
blink.cmp copied to clipboard
Snippet placeholder with variables not expanding as expected
Make sure you have done the following
- [X] Updated to the latest version of
blink.cmp - [X] Searched for existing issues and documentation (try
<C-k>on https://cmp.saghen.dev)
Bug Description
Given the following snippet, the variable placeholder is not handling the variable correctly (For ease of reading, the variable is TM_FILENAME_BASE).
{
"reactArrowFunctionComponent": {
"prefix": "rafc",
"body": [
"interface $2Props {}",
"",
"export const ${1:${TM_FILENAME_BASE}}: React.FC<${1:${TM_FILENAME_BASE}}Props> = () => {",
" return (",
" $0",
" )",
"}"
],
"description": "Creates a React Arrow Function Component with ES7 module system"
}
}
However, if I add the variable add the beginning outside of any placeholder, it loads the placeholder anywhere else in the snippet.
{
"reactArrowFunctionComponent": {
"prefix": "rafc",
"body": [
"$TM_FILENAME_BASE", // Added line to make it "work"
"interface $2Props {}",
"",
"export const ${1:${TM_FILENAME_BASE}}: React.FC<${1:${TM_FILENAME_BASE}}Props> = () => {",
" return (",
" $0",
" )",
"}"
],
"description": "Creates a React Arrow Function Component with ES7 module system"
}
}
I'm showing the preview since I think it makes more sense to show the issue. Let me know if I can help you with anything else since I don't understand much of the codebase to fix this myself. Thanks for the nice project, keep up with the good work! 🚀🔥💪🏽
Relevant configuration
No response
neovim version
NVIM v0.11.0-dev Build type: Release LuaJIT 2.1.1713773202
blink.cmp version
v0.10.0
A slightly offtopic question: How are you getting the snippet preview window ?. I do not get it automatically
This is how it looks for me, even after selecting the snippet the preview does not show up
@Arjun31415 You can either press <C-space> while the menu is open or enable auto_show for it: https://cmp.saghen.dev/configuration/completion.html#documentation
@Arjun31415 You can either press
<C-space>while the menu is open or enableauto_showfor it: https://cmp.saghen.dev/configuration/completion.html#documentation
yeah, I have that, it only opens for functions, keywords but not for snippets
Could you open a separate issue with your configuration?
Also, I know it is off-topic but I have been having problems with <C-space> mapping for a time, it does not work (neither for nvim-cmp before). Do you know where can I look for to solve this? I know it is not related to the plugin itself but cannot find any useful info on this 🫠
You can try using :imap <key> to find what mappings are being assigned to each key, see :h :imap