Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent behaviour of snippets with escaped dollar sign \\$ #790

Closed
2 tasks done
Mattias- opened this issue Dec 26, 2024 · 0 comments
Closed
2 tasks done

Inconsistent behaviour of snippets with escaped dollar sign \\$ #790

Mattias- opened this issue Dec 26, 2024 · 0 comments
Labels
bug Something isn't working snippets Built-in provider and library for snippets

Comments

@Mattias-
Copy link

Mattias- commented Dec 26, 2024

Make sure you have done the following

  • I have updated to the latest version of blink.cmp
  • I have read the README

Bug Description

Hello I'm debugging inconsistent behaviour of snippets with escaped dollar sign \\$.
I found it while migrating from using LuaSnip for my VSCode style snippets to the native snippets handling in blink.

Run nvim with repro files:

nvim -u repro.lua

Enter insert mode and complete the snippets:

ie1<C-y><cr>e2<C-y><esc>

Output:

echo "e1 all: \$@ arg0: \$0"
echo "e2 all: $@ arg0: $0 extra: EXTRA"

Expected output:

echo "e1 all: $@ arg0: $0"
echo "e2 all: $@ arg0: $0 extra: EXTRA"

Relevant configuration

repro.lua:

vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()

require("lazy.minit").repro({
    spec = {
        {
            'saghen/blink.cmp',
            version = 'v0.8.2',
            dependencies = 'rafamadriz/friendly-snippets',
            opts = {
                sources = {
                    default = { 'snippets' },
                    providers = {
                        snippets = {
                            opts = {
                                search_paths = { './' } -- With this we can find the all.json file with snippets in the same directory
                            }
                        }
                    }
                },
            },
            opts_extend = { "sources.default" },
        }
    },
})

all.json:

{
  "e1": {
    "prefix": "e1",
    "body": "echo \"e1 all: \\$@ arg0: \\$0\""
  },
  "e2": {
    "prefix": "e2",
    "body": "echo \"e2 all: \\$@ arg0: \\$0 extra: ${1:EXTRA}\""
  }
}

neovim version

v0.10.2

blink.cmp version: branch, tag, or commit

v0.8.2

@Mattias- Mattias- added the bug Something isn't working label Dec 26, 2024
@Saghen Saghen closed this as completed in 434ea2b Dec 27, 2024
@Saghen Saghen added the snippets Built-in provider and library for snippets label Dec 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working snippets Built-in provider and library for snippets
Projects
None yet
Development

No branches or pull requests

2 participants