Snippets containing single quote in trigger will break snippets list

Bug #774917 reported by allait
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
UltiSnips
Fix Released
Undecided
Unassigned

Bug Description

Trying to list all javascript snippets leads to a vim error, because of the '':f snippet.
Passing a list repr to vimscript escapes single quotes with backslashes, while vim escapes single quotes with '', which leads to vim error when trying to list snippets.

Related branches

Revision history for this message
allait (allait) wrote :
Revision history for this message
SirVer (sirver) wrote :

Fixed in r288 by merging ryans branch which also contain work from allait.

Changed in ultisnips:
status: New → Fix Committed
Revision history for this message
SirVer (sirver) wrote :

Release in 1.4.

Changed in ultisnips:
status: Fix Committed → Fix Released
Revision history for this message
Thanatermesis (thanatermesis-elive) wrote :

I have the same problem with an "sh" filetype, I also use 2 directories for snippets with only a few extra snippets for "sh" too.

How to reproduce:
   In edit mode, without starting to write a word (new and empty line), i press the list trigger and i get the error.

Some configurations:
   let g:UltiSnipsSnippetDirectories=["UltiSnips", "thanasnippets"]
   let g:UltiSnipsListSnippets="<c-k>" "<--- Just tried, same problem with other combo as <c-w>

ultisnips version is updated to today (bzr)

Backtrace is:

Following is the full stack trace:
Traceback (most recent call last):
  File "/home/thana/Git/git/home_linked/.vim/ultisnips_rep/plugin/UltiSnips/__init__.py", line 41, in wrapper
    return f(*args, **kwds)
  File "/home/thana/Git/git/home_linked/.vim/ultisnips_rep/plugin/UltiSnips/__init__.py", line 676, in list_snippets
    snippet = self._ask_snippets(snippets)
  File "/home/thana/Git/git/home_linked/.vim/ultisnips_rep/plugin/UltiSnips/__init__.py", line 984, in _ask_snippets
    rv = vim.eval("inputlist(%s)" % vim_string(display))
  File "/home/thana/Git/git/home_linked/.vim/ultisnips_rep/plugin/UltiSnips/Util.py", line 20, in vim_string
    return conv(inp)
  File "/home/thana/Git/git/home_linked/.vim/ultisnips_rep/plugin/UltiSnips/Util.py", line 13, in conv
    return u'[' + u",".join([conv(o) for o in obj]) + u']'
  File "/home/thana/Git/git/home_linked/.vim/ultisnips_rep/plugin/UltiSnips/Util.py", line 19, in conv
    return u'"%s"' % str(obj).replace(u'"', u'\\"')
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 19: ordinal not in range(128)

Revision history for this message
Thanatermesis (thanatermesis-elive) wrote :

Problem solved: it was by the use of the three dots (...), I have attached a patch

Revision history for this message
Thanatermesis (thanatermesis-elive) wrote :

extra note: there's no more dots (...) found apart of this one

Revision history for this message
SirVer (sirver) wrote :

Thanks, I added your patch in the latest commit.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.