Skip to content

'$' character in snippet body causes error in 'vsnip#to_string' #245

Closed
@Kamholtz

Description

@Kamholtz

The presence of '$' in snippets seems to result in an error and does not expand:

Error executing vim.schedule lua callback: {"result": [false, null, 0], "text": "$('

')"}
stack traceback:
[C]: in function 'vsnip#to_string'
...\site\pack\packer\start\cmp-vsnip/lua/cmp_vsnip/init.lua:40: in function 'resolve'
...-data\site\pack\packer\start\nvim-cmp/lua/cmp/source.lua:348: in function 'resolve'
...m-data\site\pack\packer\start\nvim-cmp/lua/cmp/entry.lua:452: in function 'resolve'
...im-data\site\pack\packer\start\nvim-cmp/lua/cmp/view.lua:225: in function 'fn'
...\site\pack\packer\start\nvim-cmp/lua/cmp/utils/async.lua:41: in function <...\site\pack\packer\start\nvim-cmp/lua/cmp/utils/async.lua:39>

The snippet causing this error:

{
	"JQuery div": {
		"prefix": "jdiv",
		"body": [
			"$('<div />')"
		]
	}
}

Removing the '$' in the body array allows the snippet to expand without error. The snippet as is works in VSCode, so not sure if this is considered a bug or just a difference between VSCode snippets and this plugin. I suspect it is trying to expand the '$' and following characters as if it were a placeholder. Is there a way to escape the '$' in the meantime?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions