MarcWeber / ultisnips

Official Mirror of UltiSnips trunk on LaunchPad. Send pull requests to SirVer/ultisnips!
https://launchpad.net/ultisnips
25 stars 5 forks source link

Parse snippets from `extends` #21

Closed blueyed closed 10 years ago

blueyed commented 11 years ago

Without this, no snippets from extends get added.

@MarcWeber Am I missing something here, or is this fix correct? If so, please merge.

MarcWeber commented 11 years ago

extends is bad design. It should be the user choosing which files to load, not snippet files. That's why it is easy to customize loading of plugins. Thus instead of making foo load bar, associate foo and bar with your filetype. Is this what you're talking about? So IMHO extends should even be dropped. Let me know if you think differently, and for what reason. Maybe I can learn something

blueyed commented 10 years ago

Thus instead of making foo load bar, associate foo and bar with your filetype. Is this what you're talking about?

Yes, the snippets file in question is htmldjango.snippets which just does "extends html, django".

The filetype is "htmldjango", and gets handled differently from having ft=html.django (from various plugins).

I think that "extends" is a good way in Ultisnips to have base snippets (e.g. html), which are useful in other filetypes, without having to add change/extend the filetype detection/setting yourself.

MarcWeber commented 10 years ago
let g:UltiSnips.snipmate_ft_filter = {
            \ 'default' : {'filetypes': ["FILETYPE", "_"] },
            \ 'html'    : {'filetypes': ["html_minimal", "javascript", "_"] },
            \ 'php'    : {'filetypes': ["php", "html_minimal", "javascript"] },
            \ 'xhtml'    : {'filetypes': ["html_minimal", "javascript"] },
            \ 'haml'    : {'filetypes': ["haml", "javascript"] },
            \ }

This is what I'm talking about, not having ft=a,b

Anyway, your patch is that small that you should just push (you're a collaborator)

The same "discussion" has taken place at snipmate, and the the new maintainer also agreed on the way above being a valuable alternative ..

blueyed commented 10 years ago

Ah, I see. I forgot about the map/filter (and added htmldjango there also).

Still, it's rather confusing that extends get simply ignored.

Committed as 5a187f9.