Syntax error in code breaks vim

Bug #1255188 reported by Vsevolod Velichko on 2013-11-26
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

Sometimes when I edit python code and press Esc having invalid syntax (e.g. I've written 'if someCondition:' and pressed esc — next line doesn't have an appropriate indent), ultisnips error window apprears:

Following is the full stack trace:
Traceback (most recent call last):
  File "/home/torkve/vimtemp/my/.vim/bundle/ultisnips/plugin/UltiSnips/", line 23, in wrapper
    return f(self, *args, **kwds)
  File "/home/torkve/vimtemp/my/.vim/bundle/ultisnips/plugin/UltiSnips/", line 666, in cursor_moved
    if _vim.eval("mode()") not in 'in':
  File "/home/torkve/vimtemp/my/.vim/bundle/ultisnips/plugin/UltiSnips/", line 107, in eval
    rv = vim.eval(as_vimencoding(s))
error: invalid expression

After that vim command line ignores all <cr> keystrokes (I can't type :w<cr> or even ZZ anymore) and my status line text turns into 'Pl#statusline', I have to C-z from vim and kill it.

Output of :py import sys; print sys.version:
  2.7.5+ (default, Sep 19 2013, 13:52:09)
  [GCC 4.8.1]

Unfortunately, there's no guaranteed way to reproduce the bug, sometimes it appears, sometimes not, so I can't give a strict way to reproduce it nor detect if any of my plugins affects the ultisnips behaviour.

Plugins I have:

SirVer (sirver) wrote :

That is a weird error. According to the stack trace, the code vim.eval("mode()") crashes as an invalid expression. Or the reencoding does not work properly. I have two hunches what could be the root cause for this:

1) you are working in some non-latin based language and are hitting some corner case with the vim string encoding facilities. Could that be it?
2) some other plugin interferes with UltiSnips. Could you try to reproduce the error on a minimal install (i.e. only UltiSnips and no other plugins)?

Changed in ultisnips:
status: New → Incomplete
Vsevolod Velichko (torkvemada) wrote :

1. My system locale is Russian, but the cyrillic symbols have never appeared in the code. It could probably be a jedi-vim plugin that uses some non-ascii invisible symbols to make vim display function info in a line above the currently edited.
2. I can try but it's hard, since I still haven't an always-working way to reproduce the bug even with the full set of plugins.

SirVer (sirver) wrote :

1. it seems unlikely that characters in the buffer should disturb ultisnips - be them visible or not.
2. I understand.

I suggest trying the following: edit the as_vimencoding() method in ultisnips (which is defined twice, once for py3 and once for py2) to simply return the string. same for the as utf8 encoding. this will break other things, but if your trouble disappears we know that we have an encoding issue at hand.

Launchpad Janitor (janitor) wrote :

[Expired for UltiSnips because there has been no activity for 60 days.]

Changed in ultisnips:
status: Incomplete → Expired
SirVer (sirver) wrote :


Changed in ultisnips:
status: Expired → Incomplete
Vsevolod Velichko (torkvemada) wrote :

Oh, I completely forget to respond here, sorry.
I tested your recommendation (about as_vimencoding) for that couple of months and it really fixed the things.

SirVer (sirver) wrote :

great - though this is not a really great fix. I wish I would know a more principled way of fixing this. If you come up with a super stable way of reproducing it, I am all ears. Then I can try to fix it properly.

Changed in ultisnips:
status: Incomplete → Invalid
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers