SirVer / ultisnips

UltiSnips - The ultimate snippet solution for Vim. Send pull requests to SirVer/ultisnips!
GNU General Public License v3.0
7.56k stars 691 forks source link

Error when editing javascript #857

Closed carloabelli closed 7 years ago

carloabelli commented 7 years ago

Getting an error when using ultisnips with vim-snippets and editing a javascript file

UltiSnips.snippet.source.file._base.SnippetSyntaxError: Invalid line 'version 1' in ~/.local/share/nvim/plugged/vim-snippets/snippets/javascript/javascript-jasmine.snippets:1

Not sure if this is a ultisnips bug or a vim-snippets bug.

greg218 commented 7 years ago

I got the same error.

I believe it has something to do with the 'honza/vim-snippets' plugin after enabling and disabling all combinations.

Here is the following full trace stack:

Following is the full stack trace:                                                                                                                                                                               
15 Traceback (most recent call last):                                                                                                                                                                               
14   File "/home/greg/.nvim/plugged/ultisnips/pythonx/UltiSnips/err_to_scratch_buffer.py", line 16, in wrapper                                                                                                      
13     return func(self, *args, **kwds)                                                                                                                                                                             
12   File "/home/greg/.nvim/plugged/ultisnips/pythonx/UltiSnips/snippet_manager.py", line 151, in snippets_in_current_scope                                                                                         
11     snippets = self._snips(before, True)                                                                                                                                                                         
10   File "/home/greg/.nvim/plugged/ultisnips/pythonx/UltiSnips/snippet_manager.py", line 575, in _snips                                                                                                            
 9     source.ensure(filetypes, cached=autotrigger_only)                                                                                                                                                            
 8   File "/home/greg/.nvim/plugged/ultisnips/pythonx/UltiSnips/snippet/source/file/_base.py", line 47, in ensure                                                                                                   
 7     self._load_snippets_for(ft)                                                                                                                                                                                  
 6   File "/home/greg/.nvim/plugged/ultisnips/pythonx/UltiSnips/snippet/source/file/_base.py", line 87, in _load_snippets_for                                                                                       
 5     self._load_snippets_for(parent_ft)                                                                                                                                                                           
 4   File "/home/greg/.nvim/plugged/ultisnips/pythonx/UltiSnips/snippet/source/file/_base.py", line 80, in _load_snippets_for                                                                                       
 3     self._parse_snippets(ft, fn)                                                                                                                                                                                 
 2   File "/home/greg/.nvim/plugged/ultisnips/pythonx/UltiSnips/snippet/source/file/_base.py", line 99, in _parse_snippets                                                                                          
 1     raise SnippetSyntaxError(filename, line_index, msg)                                                                                                                                                          
21 UltiSnips.snippet.source.file._base.SnippetSyntaxError: Invalid line 'version 1' in ~/.nvim/plugged/vim-snippets/snippets/javascript/javascript-jasmine.snippets:1
jrock2004 commented 7 years ago

I am also having this issue.

I have updated vim plug and updated all plugins. I also tried removing all plugins and download fresh

jrock2004 commented 7 years ago

Looking over and vim snippets issue tracker, it seems like this is a vim-snippets issue

https://github.com/honza/vim-snippets/issues/933

greg218 commented 7 years ago

https://github.com/honza/vim-snippets/issues/933#issuecomment-307598325 FYI: A temporary solution seems to be: Commenting out "version 1", the first line of the file javascript-jasmine.snippets would fix it.

optik-aper commented 7 years ago

I'm getting a similar issue and I'm not using vim-snippets.

Following is the full stack trace:
Traceback (most recent call last):
  File "/home/michael/.vim/bundle/ultisnips/pythonx/UltiSnips/err_to_scratch_buffer.py", line 16, in wrapper
    return func(self, *args, **kwds)
  File "/home/michael/.vim/bundle/ultisnips/pythonx/UltiSnips/snippet_manager.py", line 856, in _track_change
    self._try_expand(autotrigger_only=True)
  File "/home/michael/.vim/bundle/ultisnips/pythonx/UltiSnips/snippet_manager.py", line 702, in _try_expand
    snippets = self._snips(before, False, autotrigger_only)
  File "/home/michael/.vim/bundle/ultisnips/pythonx/UltiSnips/snippet_manager.py", line 575, in _snips
    source.ensure(filetypes, cached=autotrigger_only)
  File "/home/michael/.vim/bundle/ultisnips/pythonx/UltiSnips/snippet/source/file/_base.py", line 47, in ensure
    self._load_snippets_for(ft)
  File "/home/michael/.vim/bundle/ultisnips/pythonx/UltiSnips/snippet/source/file/_base.py", line 80, in _load_snippets_for
    self._parse_snippets(ft, fn)
  File "/home/michael/.vim/bundle/ultisnips/pythonx/UltiSnips/snippet/source/file/_base.py", line 99, in _parse_snippets
    raise SnippetSyntaxError(filename, line_index, msg)
SnippetSyntaxError: Invalid line 'Good bye, Sir. Hope to talk to you soon.' in ~/.vim/snippets/eruby.snippets:4

To sanity test I copied and pasted the email signature example from the help docs into my eruby.snippets file to make sure I was getting the correct format. Once I start editing (enter insert mode) an .erb file the stack trace appears. Oddly when I created a all.snippets file, put them email signature in there, removed all snippets from the eruby.snippet file and then edit an .erb file the error doesn't occur. I'm not sure if the all.snippets file is sourced though since I'm currently having problems with the expansion trigger as well and can't actually expand a snippet. That, I think, is unrelated to this issue.

Here's my eruby.snippet file, just in-case:

extends ruby, rails

snippet bye "My mail signature"
Good bye, Sir. Hope to talk to you soon.
- Arthur, King of Britain
endsnippet

I just installed UltiSnips on this system today so I expect it's the latest version.

seletskiy commented 7 years ago

@optik-aper: snippets directory is reserved for old-style snipMate snippets and that's why your snippet is causing error. Look for snipmate string in the :h UltiSnips help file.