expand snippets for filetypes like html.handlebars

Close #298
This commit is contained in:
Yasuhiro Matsumoto
2015-11-10 09:35:38 +09:00
parent 5eb1061a3d
commit 136b87a330
2 changed files with 17 additions and 3 deletions

View File

@@ -315,8 +315,15 @@ function! emmet#getResource(type, name, default) abort
if has_key(s:emmet_settings, '*') && has_key(s:emmet_settings['*'], a:name)
let global = extend(global, s:emmet_settings['*'][a:name])
endif
echo a:type
for type in split(a:type, '\.')
if has_key(s:emmet_settings, a:type)
let types = [a:type]
else
let types = split(a:type, '\.')
endif
for type in types
if !has_key(s:emmet_settings, type)
continue
endif
@@ -366,7 +373,13 @@ endfunction
function! emmet#getFileType(...) abort
let flg = get(a:000, 0, 0)
let type = ''
for part in split(&filetype, '\.')
if has_key(s:emmet_settings, &filetype)
let types = [&filetype]
else
let types = split(a:type, '\.')
endif
for part in types
if emmet#lang#exists(part)
let type = part
break

View File

@@ -136,7 +136,8 @@ function! emmet#lang#html#parseIntoTree(abbr, type) abort
let snippet = substitute(snippet, '|', '${cursor}', 'g')
endif
" just redirect to expanding
if snippet !~ '^\s*<'
if snippet !~ '^\s*[{\[<]'
let part = emmet#lang#html#findTokens(part)
return emmet#lang#html#parseIntoTree(snippet, a:type)
endif
let lines = split(snippet, "\n", 1)