Listing snippets with <C-Tab> doesn’t work

Bug #1170636 reported by Profpatsch
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
UltiSnips
Fix Committed
Undecided
Unassigned

Bug Description

Output of :verbose map <c-tab>:

s <C-Tab> *<Esc>:call UltiSnips_ListSnippets()<CR>
            Last set from ~/.vim/bundle/ultisnips/plugin/UltiSnips.vim

From my vimrc:

" UltiSnips
"let g:UltiSnipsSnippetsDir="~/code/vim/vim-snippets-private/"
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
let g:UltiSnipsListSnippets="<c-tab>"
" }}}

I am in GVim, so this can’t be a terminal issue. Looks like the function called does nothing.
I tried mapping it to stuff like <leader>xx, but this only deletes two chars (when the following key after hitting leader can’t find a corresponding mapping, it falls back to the normal command without the leader).

Using the latest github version of SirVer/UltiSnips.

Revision history for this message
SirVer (sirver) wrote :

You are interested in imap <c-tab>, as you want to use it in insert mode.

Changed in ultisnips:
status: New → Incomplete
Revision history for this message
Profpatsch (profpatsch) wrote :

Oh, now I see what the 's' in the beginning is for.
But why does Ultisnips map this to select mode by default? oO

Revision history for this message
SirVer (sirver) wrote :

I cannot remember - I believe there was a reason.

However, this is not your problem currently, right? How about the imap?

Revision history for this message
Profpatsch (profpatsch) wrote : Re: [Bug 1170636] Re: Listingsnippets with <C-Tab> doesn’twork

On 13-04-21 05:54pm, SirVer wrote:
> I cannot remember - I believe there was a reason.
>
> However, this is not your problem currently, right? How about the imap?

`imap and inoremap <C-Tab> *<ESC>:call …` don’t work, they are normal
tabs.
`nnoremap <C-Tab> :call …` does work (from normal mode, of course).

I don’t know if this is related, I get the following error trying to
expand bboxes (a similar one with boxes, none with lorem)

Following is the full stack trace:
Traceback (most recent call last):
  File "/home/philip/.vim/bundle/ultisnips/plugin/UltiSnips/__init__.py", line 23, in wrapper
    return f(self, *args, **kwds)
  File "/home/philip/.vim/bundle/ultisnips/plugin/UltiSnips/__init__.py", line 576, in expand_or_jump
    rv = self._try_expand()
  File "/home/philip/.vim/bundle/ultisnips/plugin/UltiSnips/__init__.py", line 893, in _try_expand
    self._do_snippet(snippet, before, after)
  File "/home/philip/.vim/bundle/ultisnips/plugin/UltiSnips/__init__.py", line 867, in _do_snippet
    si = snippet.launch(text_before, self._visual_content, None, start, end)
  File "/home/philip/.vim/bundle/ultisnips/plugin/UltiSnips/__init__.py", line 420, in launch
    last_re = self._last_re, globals = self._globals)
  File "/home/philip/.vim/bundle/ultisnips/plugin/UltiSnips/text_objects/_snippet_instance.py", line 34, in __init__
    self.update_textobjects()
  File "/home/philip/.vim/bundle/ultisnips/plugin/UltiSnips/text_objects/_snippet_instance.py", line 70, in update_textobjects
    if obj._update(done, not_done):
  File "/home/philip/.vim/bundle/ultisnips/plugin/UltiSnips/text_objects/_python_code.py", line 216, in _update
    compatible_exec(self._code, self._globals, local_d)
  File "<string>", line 4, in <module>
  File "<string>", line 64, in make_box
  File "<string>", line 53, in _get_comment_format
AttributeError: 'dict' object has no attribute 'has_key'

I guess that’s a whole different bug, though.

--
Proudly written in Mutt with Vim on Archlinux.
Q: Why is this email five sentences or less?
A: http://five.sentenc.es

Revision history for this message
SirVer (sirver) wrote :

AttributeError: 'dict' object has no attribute 'has_key'

that is really odd - this is a buildin method in python. What does :py import sys; print(sys.version)

give you? What OS are you on?
What does :imap <c-tab> print?

Revision history for this message
Profpatsch (profpatsch) wrote :

On 13-04-21 06:34pm, SirVer wrote:
> What does :imap <c-tab> print?

i <C-Tab> * <Tab>
  (last set from supertab.vim)

> AttributeError: 'dict' object has no attribute 'has_key'
>
> that is really odd - this is a buildin method in python. What does :py
> import sys; print(sys.version)
> give you? What OS are you on?

I’m on Archlinux (python is linked to python3 and python2 to python2).
Python in vim: 2.7.3, GCC 4.7.2.

--
Proudly written in Mutt with Vim on Archlinux.
Q: Why is this email five sentences or less?
A: http://five.sentenc.es

Revision history for this message
SirVer (sirver) wrote :

Well, there you have it. Supertab eats your settings. Check if after/plugin/ultisnips.vim is properly sourced in your installation - I bet it isn't.

About the python problem: dict.has_key is indeed no longer in python 3. A patch that fixes this in a compatible manner would be appreciated.

Changed in ultisnips:
status: Incomplete → Invalid
Revision history for this message
SirVer (sirver) wrote :

setting to invalid, because UltiSnips is not to blame here.

Sawyer (evolye)
Changed in ultisnips:
status: Invalid → Confirmed
Revision history for this message
Sawyer (evolye) wrote :

Hi,
this can be confirmed Vim 7.4.113 with Python 3.3.
Install the latest UltiSnip from github.

:py3 import sys; print(sys.version)
3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:57:17) [MSC v.1600 64 bit (AMD64)]

inside vimrc:
let g:UltiSnipsUsePythonVersion=3

and use <C-Tab>
and select any option, give the errors.

Following is the full stack trace:
Traceback (most recent call last):
  File "C:/Users/*.*/.vim/bundle/ultisnips/plugin\UltiSnips\__init__.py", line 23, in wrapper
    return f(self, *args, **kwds)
  File "C:/Users/*.*/.vim/bundle/ultisnips/plugin\UltiSnips\__init__.py", line 589, in list_snippets
    self._do_snippet(snippet, before, after)
  File "C:/Users/*.*/.vim/bundle/ultisnips/plugin\UltiSnips\__init__.py", line 908, in _do_snippet
    si = snippet.launch(text_before, self._visual_content, None, start, end)
  File "C:/Users/*.*/.vim/bundle/ultisnips/plugin\UltiSnips\__init__.py", line 420, in launch
    last_re = self._last_re, globals = self._globals)
  File "C:/Users/*.*/.vim/bundle/ultisnips/plugin\UltiSnips\text_objects\_snippet_instance.py", line 34, in __init__
    self.update_textobjects()
  File "C:/Users/*.*/.vim/bundle/ultisnips/plugin\UltiSnips\text_objects\_snippet_instance.py", line 70, in update_textobjects
    if obj._update(done, not_done):
  File "C:/Users/*.*/.vim/bundle/ultisnips/plugin\UltiSnips\text_objects\_python_code.py", line 216, in _update
    compatible_exec(self._code, self._globals, local_d)
  File "<string>", line 4, in <module>
  File "<string>", line 64, in make_box
  File "<string>", line 53, in _get_comment_format
AttributeError: 'dict' object has no attribute 'has_key'

Revision history for this message
SirVer (sirver) wrote :

has_key is no longer available in python3 but was used in all.snippets - huge oversight and sorry for that. A fix has been pushed to github right now.

Changed in ultisnips:
status: Confirmed → Invalid
status: Invalid → Fix Committed
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.