ultisnips icon indicating copy to clipboard operation
ultisnips copied to clipboard

Syntax highlighting for snippet files is broken for transformations containing escaped `/`

Open embear opened this issue 2 years ago • 0 comments

For a snippet containing escaped / in a transformation the syntax highlighting is broken for following lines. The snippets are expanded correctly. It is just the highlighting when the snippet file is edited.

Expected behavior:

The following snippet gets the correct syntax highlighting:

snippet if "if block"                                                                                                                                                                                                                                                                                                        
if (${1:/* condition */}) {                                                                                                                                                                                                                                                                                                  
        ${2:${VISUAL:code}}                                                                                                                                                                                                                                                                                                  
}$0                                                                                                                                                                                                                                                                                                                          
endsnippet

image

Actual behavior:

And this one gets a wrong highlighting because VISUAL allows a transformation after the colon but the syntax file does not respect the escaped /.

snippet if "if block"                                                                                                                                                                                                                                                                                                        
if (${1:/* condition */}) {                                                                                                                                                                                                                                                                                                  
        ${2:${VISUAL:\/\* code \*\/}}                                                                                                                                                                                                                                                                                                  
}$0                                                                                                                                                                                                                                                                                                                          
endsnippet

image

Steps to reproduce

  1. Add the above snippets to a file c.snippets
  2. Edit the file c.snippets

  • Operating System: Debian GNU/Linux 11 (bullseye)
  • Vim Version: VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Jun 1 2022 09:36:05) Included patches: 1-5048
  • UltiSnips Version: f5ccf0977c611ffd774ca180774959301baaffad
  • Python inside Vim: 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110]
  • Docker repo/vimrc: not available

embear avatar Jun 03 '22 07:06 embear