mattn / emmet-vim

emmet for vim: http://emmet.io/
http://mattn.github.io/emmet-vim
MIT License
6.43k stars 411 forks source link

`empty_elements` setting change is not applied to XML #432

Closed lo48576 closed 6 years ago

lo48576 commented 6 years ago

When editing XML files, settings for HTML automatically be inherited. Settings should be overridable by custom settings (for example I can clear default_attributes by adding 'xml': { 'default_attributes': {} } to g:user_emmet_settings.

But I cannot override empty_elements for XML files by user_emmet_settings, this forces meta<C-y>, to be always expanded into <meta />.

I'm not sure but I think the line below is one of the cause:

https://github.com/mattn/emmet-vim/blob/3fb134b503eeb3fc6cf91a7fd9716a7fb7dbeed6/autoload/emmet/lang/html.vim#L591

The logic for HTML is used for XML files, but it unconditionally uses settings.html.*. I temporarily changed the line as below, and meta<C-y>, is expanded into <meta></meta> as I expected.

  elseif stridx(','.emmet#getResource(type, 'empty_elements', settings.html.empty_elements).',', ','.current_name.',') != -1

I think most of (but not all) appearance of settings.html.foo in the file should be replaced with emmet#getResource(type, 'foo', settings.html.foo).