From 7843f18e40dbb107478159f5682309b4e1195ce9 Mon Sep 17 00:00:00 2001 From: jpsouzasilva Date: Sat, 25 Aug 2018 15:22:18 -0300 Subject: [PATCH 1/9] Prioritizes syntax at the current cursor position for determining the file type --- autoload/emmet.vim | 72 ++++++++++++++++++++++------------------------ 1 file changed, 34 insertions(+), 38 deletions(-) diff --git a/autoload/emmet.vim b/autoload/emmet.vim index ebabcc8..aa5f290 100644 --- a/autoload/emmet.vim +++ b/autoload/emmet.vim @@ -376,46 +376,42 @@ endfunction function! emmet#getFileType(...) abort let flg = get(a:000, 0, 0) - let type = '' - - if has_key(s:emmet_settings, &filetype) - let type = &filetype + + let pos = emmet#util#getcurpos() + let type = synIDattr(synID(pos[1], pos[2], 1), 'name') + if type =~# '^css\w' + let type = 'css' + elseif type =~# '^html\w' + let type = 'html' + elseif type =~# '^javaScript' + let type = 'javascript' + elseif len(type) ==# 0 && type =~# '^xml' + let type = 'xml' else - let types = split(&filetype, '\.') - for part in types - if emmet#lang#exists(part) - let type = part - break - endif - let base = emmet#getBaseType(part) - if base !=# '' - if flg - let type = &filetype - else - let type = base + if has_key(s:emmet_settings, &filetype) + let type = &filetype + else + let types = split(&filetype, '\.') + for part in types + if emmet#lang#exists(part) + let type = part + break endif - unlet base - break - endif - endfor + let base = emmet#getBaseType(part) + if base !=# '' + if flg + let type = &filetype + else + let type = base + endif + unlet base + break + endif + endfor + endif + if len(type) ==# 0 | let type = 'html' | endif endif - if type ==# 'html' - let pos = emmet#util#getcurpos() - let type = synIDattr(synID(pos[1], pos[2], 1), 'name') - if type =~# '^css\w' - let type = 'css' - endif - if type =~# '^html\w' - let type = 'html' - endif - if type =~# '^javaScript' - let type = 'javascript' - endif - if len(type) ==# 0 && type =~# '^xml' - let type = 'xml' - endif - endif - if len(type) ==# 0 | let type = 'html' | endif + return type endfunction @@ -523,7 +519,7 @@ function! emmet#expandAbbr(mode, abbr) range abort if len(filters) ==# 0 let filters = ['html'] endif - + if a:mode ==# 2 let leader = substitute(input('Tag: ', ''), '^\s*\(.*\)\s*$', '\1', 'g') if len(leader) ==# 0 From 3dcdbff913ea2689e2678fab42ef66d63bd17c64 Mon Sep 17 00:00:00 2001 From: jpsouzasilva Date: Sat, 25 Aug 2018 15:49:54 -0300 Subject: [PATCH 2/9] Remove empty string comparison for xml identification --- autoload/emmet.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/emmet.vim b/autoload/emmet.vim index aa5f290..3b36b10 100644 --- a/autoload/emmet.vim +++ b/autoload/emmet.vim @@ -385,7 +385,7 @@ function! emmet#getFileType(...) abort let type = 'html' elseif type =~# '^javaScript' let type = 'javascript' - elseif len(type) ==# 0 && type =~# '^xml' + elseif type =~# '^xml' let type = 'xml' else if has_key(s:emmet_settings, &filetype) From 03c2309f445c4eb75b9bd9e5af259b77fe391359 Mon Sep 17 00:00:00 2001 From: jpsouzasilva Date: Tue, 28 Aug 2018 22:05:06 -0300 Subject: [PATCH 3/9] Attempt at fixing the Javascript identifier pattern Running tests locally seems OK! --- autoload/emmet.vim | 5 +- test.log | 517 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 519 insertions(+), 3 deletions(-) create mode 100644 test.log diff --git a/autoload/emmet.vim b/autoload/emmet.vim index 3b36b10..d5fcc18 100644 --- a/autoload/emmet.vim +++ b/autoload/emmet.vim @@ -383,7 +383,7 @@ function! emmet#getFileType(...) abort let type = 'css' elseif type =~# '^html\w' let type = 'html' - elseif type =~# '^javaScript' + elseif type =~# '^js\w' let type = 'javascript' elseif type =~# '^xml' let type = 'xml' @@ -409,10 +409,9 @@ function! emmet#getFileType(...) abort endif endfor endif - if len(type) ==# 0 | let type = 'html' | endif endif - return type + return len(type) == 0 ? 'html' : type endfunction function! emmet#getDollarExprs(expand) abort diff --git a/test.log b/test.log new file mode 100644 index 0000000..b3e768c --- /dev/null +++ b/test.log @@ -0,0 +1,517 @@ +[html][expand abbreviation]testing #001 +: div ... +ok +testing #002 +: div#wrapper ... +ok +testing #003 +: div.box ... +ok +testing #004 +: a[title=TITLE] ... +ok +testing #005 +: div#wrapper.box ... +ok +testing #006 +: div#wrapper.box.current ... +ok +testing #007 +: div#wrapper.box.current[title=TITLE rel] ... +ok +testing #008 +: div#main+div#sub ... +ok +testing #009 +: div#main>div#sub ... +ok +testing #010 +: html:xt>div#header>div#logo+ul#nav>li.item-$*5>a ... +ok +testing #011 +: ol>li*2 ... +ok +testing #012 +: a ... +ok +testing #013 +: obj ... +ok +testing #014 +: cc:ie6>p+blockquote#sample$.so.many.classes*2 ... +ok +testing #015 +: html:4t>div#wrapper>div#header+div#contents+div#footer ... +ok +testing #016 +: a[href=http://www.google.com/].foo#hoge ... +ok +testing #017 +: a[href=http://www.google.com/]{Google} ... +ok +testing #018 +: {Emmet} ... +ok +testing #019 +: a+b ... +ok +testing #020 +: a>b>ib>i^b ... +ok +testing #022 +: a>b>i<b>i^^b ... +ok +testing #024 +: blockquote>b>i<b>i^^b ... +ok +testing #026 +: a[href=foo][class=bar] ... +ok +testing #027 +: a[a=b][b=c=d][e]{foo}*2 ... +ok +testing #028 +: a[a=b][b=c=d][e]*2{foo} ... +ok +testing #029 +: a*2{foo}a ... +ok +testing #030 +: a{foo}*2>b ... +ok +testing #031 +: a*2{foo}>b ... +ok +testing #032 +: table>tr>td.name#foo+td*3 ... +ok +testing #033 +: div#header+div#footer ... +ok +testing #034 +: #header+div#footer ... +ok +testing #035 +: #header>ul>liul>li^p{Footer} ... +ok +testing #037 +: a#foo$$$*3 ... +ok +testing #038 +: ul+ ... +ok +testing #039 +: table+ ... +ok +testing #040 +: #header>li<#content ... +ok +testing #041 +: #header>li^#content ... +ok +testing #042 +: (#header>li)<#content ... +ok +testing #043 +: (#header>li)^#content ... +ok +testing #044 +: a>b>i<
b>i^^div ... +ok +testing #046 +: (#header>h1)+#content+#footer ... +ok +testing #047 +: (#header>h1)+(#content>(#main>h2+div#entry$.section*5>(h3>a)+div>p*3+ul+)+(#utilities))+(#footer>address) ... +ok +testing #048 +: (div>(ul*2)*2)+(#utilities) ... +ok +testing #049 +: table>(tr>td*3)*4 ... +ok +testing #050 +: (((a#foo+a#bar)*2)*3) ... +ok +testing #051 +: div#box$*3>h3+p*2 ... +ok +testing #052 +: div#box.foo$$$.bar$$$*3 ... +ok +testing #053 +: div#box$*3>h3+p.bar*2|e ... +ok +testing #054 +: div>div#page>p.title+p|c ... +ok +testing #055 +: kbd*2|s ... +ok +testing #056 +: link:css ... +ok +testing #057 +: a[title="Hello', world" rel] ... +ok +testing #058 +: div>a#foo{bar} ... +ok +testing #059 +: .content{Hello!} ... +ok +testing #060 +: div.logo+(div#navigation)+(div#links) ... +ok +testing #061 +: h1{header}+{Text}+a[href=http://link.org]{linktext}+{again some text}+a[href=http://anoterlink.org]{click me!}+{some final text} ... +ok +testing #062 +: a{&}+div{&&} ... +ok +testing #063 +: span$$$$ ... +ok +testing #064 +: foo span$$$$ ... +ok +testing #065 +: foo span$$$$ bar ... +ok +testing #066 +: foo $$$$bar baz ... +ok +testing #067 +: foo $$$$bar baz ... +ok +testing #068 +: f div.boxes>article.box2>header>(hgroup>h2{aaa}+h3{bbb})+p{ccc}$$$$ ... +ok +testing #069 +: div.boxes>(div.box2>section>h2{a}+p{b})+(div.box1>section>h2{c}+p{d}+p{e}+(bq>h2{f}+h3{g})+p{h}) ... +ok +testing #070 +: (div>(label+input))+div ... +ok +testing #071 +: test1\ntest2\ntest3$$$$ ... +ok +testing #072 +: test1\ntest2\ntest3$$$$ ... +ok +testing #073 +: test1\ntest2\ntest3$$$$ ... +ok +testing #074 +: div#id-$*5>div#id2-$ ... +ok +testing #075 +: .foo>[bar=2]>.baz ... +ok +testing #076 +: {test case $ }*3 ... +ok +testing #077 +: {test case $${nr}}*3 ... +ok +testing #078 +: {test case \$ }*3 ... +ok +testing #079 +: {test case $$$ }*3 ... +ok +testing #080 +: a[title=$#]{foo} ... +ok +testing #081 +: span.item$*2>{item $} ... +ok +testing #082 +: \t$$$$ ... +ok +testing #083 +: a$$$$ ... +ok +testing #084 +: form.search-form._wide>input.-query-string+input:s.-btn_large|bem ... +ok +testing #085 +: form>fieldset>legend+(label>input[type="checkbox"])*3 ... +ok +pass 13.924448[split join tag]testing #001 +:
\n\t$$$$\n
... +ok +testing #002 +:
\n\t\n
... +ok +testing #003 +:
test$$$$/>\n
... +ok +testing #004 +:
\n\t\n
... +ok +pass 0.710855[toggle comment]testing #001 +:
\n\t$$$$\n
... +ok +testing #002 +:
\n\t\n
... +ok +pass 0.355618[image size]testing #001 +: img[src=http://mattn.kaoriya.net/images/logo.png]$$$$ ... +ok +testing #002 +: img[src=/logo.png]$$$$ ... +ok +testing #003 +: img[src=http://mattn.kaoriya.net/images/logo.png width=foo height=bar]$$$$ ... +ok +pass 1.940602[move next prev]testing #001 +: foo+bar+baz[dankogai=""]$$$$ ... +ok +pass 0.200150[contains dash in attributes]testing #001 +: div[foo-bar="baz"] ... +ok +pass 0.144592[default attributes]testing #001 +: p.title>a[/hoge/] ... +ok +testing #002 +: script[jquery.js] ... +ok +pass 0.277444[multiple group]testing #001 +: .outer$*3>.inner$*2 ... +ok +pass 0.155586[group itemno]testing #001 +: dl>(dt{$}+dd)*3 ... +ok +testing #002 +: (div[attr=$]*3)*3 ... +ok +pass 0.365517[update tag]testing #001 +: ... +ok +pass 0.188945[base value]testing #001 +: ul>li#id$@0*3 ... +ok +pass 0.145338[css][expand abbreviation]testing #001 +: {fs:n$$$$} ... +ok +testing #002 +: {fl:l|fc$$$$} ... +ok +testing #003 +: {bg+$$$$} ... +ok +testing #004 +: {bg+!$$$$} ... +ok +testing #005 +: {m$$$$} ... +ok +testing #006 +: {m0.1p$$$$} ... +ok +testing #007 +: {m1.0$$$$} ... +ok +testing #008 +: {m2$$$$} ... +ok +testing #009 +: {bdrs10$$$$} ... +ok +testing #010 +: {-bdrs20$$$$} ... +ok +testing #011 +: {lg(top,#fff,#000)$$$$} ... +ok +testing #012 +: {m10-5-0$$$$} ... +ok +testing #013 +: {m-10--5$$$$} ... +ok +testing #014 +: {m10-auto$$$$} ... +ok +testing #015 +: {w100p$$$$} ... +ok +testing #016 +: {h50e$$$$} ... +ok +testing #017 +: {(bg+)+c$$$$} ... +ok +testing #018 +: {m0+bgi+bg++p0$$$$} ... +ok +testing #019 +: {borle$$$$} ... +ok +testing #020 +: {c#dba$$$$} ... +ok +testing #021 +: {c#dba.7$$$$} ... +ok +testing #022 +: {dn$$$$} ... +ok +testing #023 +: {p10%$$$$} ... +ok +testing #024 +: {p10p$$$$} ... +ok +testing #025 +: {p10e$$$$} ... +ok +testing #026 +: {p10em$$$$} ... +ok +testing #027 +: {p10re$$$$} ... +ok +testing #028 +: {p10rem$$$$} ... +ok +pass 4.998573[haml][expand abbreviation]testing #001 +: div>p+ul#foo>li.bar$[foo=bar][bar=baz]*3>{baz} ... +ok +testing #002 +: div>p+ul#foo>li.bar$[foo=bar][bar=baz]*3>{baz}|haml ... +ok +testing #003 +: a*3|haml ... +ok +testing #004 +: .content{Hello!}|haml ... +ok +testing #005 +: a[title=$#]{foo} ... +ok +pass 0.854218[split join]testing #001 +: %a foo\n bar$$$$ ... +ok +testing #002 +: $$$$%a ... +ok +pass 0.411440[toggle comment]testing #001 +: %a{ :href => "http://www.google.com"$$$$ } hello ... +ok +testing #002 +: -# %a{ :href => "http://www.google.com"$$$$ } hello ... +ok +pass 0.399764[slim][expand abbreviation]testing #001 +: div>p+ul#foo>li.bar$[foo=bar][bar=baz]*3>{baz} ... +ok +testing #002 +: div>p+ul#foo>li.bar$[foo=bar][bar=baz]*3>{baz}|slim ... +ok +testing #003 +: a*3|slim ... +ok +testing #004 +: .content{Hello!}|slim ... +ok +testing #005 +: a[title=$#]{foo} ... +ok +pass 1.053588[split join tag]testing #001 +: a\n | foo$$$$ ... +ok +testing #002 +: a$$$$ ... +ok +pass 0.290832[toggle comment]testing #001 +: a href="http://www.google.com"$$$$\n | hello ... +ok +testing #002 +: /a href="http://www.google.com"$$$$\n | hello ... +ok +pass 0.289361[xsl][expand abbreviation]testing #001 +: vari ... +ok +testing #002 +: ap>wp ... +ok +pass 0.354678[xsd][expand abbreviation]testing #001 +: xsd:w3c ... +ok +pass 0.155347[mustache][expand abbreviation]testing #001 +: div#{{foo}} ... +ok +testing #002 +: div.{{foo}} ... +ok +pass 0.310753[scss][expand abbreviation]testing #001 +: @i$$$$ ... +ok +testing #002 +: {fs:n$$$$} ... +ok +testing #003 +: {fl:l|fc$$$$} ... +ok +testing #004 +: {bg+$$$$} ... +ok +testing #005 +: {bg+!$$$$} ... +ok +testing #006 +: {m$$$$} ... +ok +testing #007 +: {m0.1p$$$$} ... +ok +testing #008 +: {m1.0$$$$} ... +ok +testing #009 +: {m2$$$$} ... +ok +testing #010 +: {bdrs10$$$$} ... +ok +testing #011 +: {-bdrs20$$$$} ... +ok +testing #012 +: {lg(top,#fff,#000)$$$$} ... +ok +testing #013 +: {m10-5-0$$$$} ... +ok +testing #014 +: {m-10--5$$$$} ... +ok +testing #015 +: {m10-auto$$$$} ... +ok +testing #016 +: {w100p$$$$} ... +ok +testing #017 +: {h50e$$$$} ... +ok +testing #018 +: {(bg+)+c$$$$} ... +ok +pass 3.520060done \ No newline at end of file From ca2b158737ffc0ec6a1250403f2a4dfb8afb66ff Mon Sep 17 00:00:00 2001 From: jpsouzasilva Date: Tue, 28 Aug 2018 22:06:59 -0300 Subject: [PATCH 4/9] Deleting the test.log file --- test.log | 517 ------------------------------------------------------- 1 file changed, 517 deletions(-) delete mode 100644 test.log diff --git a/test.log b/test.log deleted file mode 100644 index b3e768c..0000000 --- a/test.log +++ /dev/null @@ -1,517 +0,0 @@ -[html][expand abbreviation]testing #001 -: div ... -ok -testing #002 -: div#wrapper ... -ok -testing #003 -: div.box ... -ok -testing #004 -: a[title=TITLE] ... -ok -testing #005 -: div#wrapper.box ... -ok -testing #006 -: div#wrapper.box.current ... -ok -testing #007 -: div#wrapper.box.current[title=TITLE rel] ... -ok -testing #008 -: div#main+div#sub ... -ok -testing #009 -: div#main>div#sub ... -ok -testing #010 -: html:xt>div#header>div#logo+ul#nav>li.item-$*5>a ... -ok -testing #011 -: ol>li*2 ... -ok -testing #012 -: a ... -ok -testing #013 -: obj ... -ok -testing #014 -: cc:ie6>p+blockquote#sample$.so.many.classes*2 ... -ok -testing #015 -: html:4t>div#wrapper>div#header+div#contents+div#footer ... -ok -testing #016 -: a[href=http://www.google.com/].foo#hoge ... -ok -testing #017 -: a[href=http://www.google.com/]{Google} ... -ok -testing #018 -: {Emmet} ... -ok -testing #019 -: a+b ... -ok -testing #020 -: a>b>ib>i^b ... -ok -testing #022 -: a>b>i<b>i^^b ... -ok -testing #024 -: blockquote>b>i<b>i^^b ... -ok -testing #026 -: a[href=foo][class=bar] ... -ok -testing #027 -: a[a=b][b=c=d][e]{foo}*2 ... -ok -testing #028 -: a[a=b][b=c=d][e]*2{foo} ... -ok -testing #029 -: a*2{foo}a ... -ok -testing #030 -: a{foo}*2>b ... -ok -testing #031 -: a*2{foo}>b ... -ok -testing #032 -: table>tr>td.name#foo+td*3 ... -ok -testing #033 -: div#header+div#footer ... -ok -testing #034 -: #header+div#footer ... -ok -testing #035 -: #header>ul>liul>li^p{Footer} ... -ok -testing #037 -: a#foo$$$*3 ... -ok -testing #038 -: ul+ ... -ok -testing #039 -: table+ ... -ok -testing #040 -: #header>li<#content ... -ok -testing #041 -: #header>li^#content ... -ok -testing #042 -: (#header>li)<#content ... -ok -testing #043 -: (#header>li)^#content ... -ok -testing #044 -: a>b>i<
b>i^^div ... -ok -testing #046 -: (#header>h1)+#content+#footer ... -ok -testing #047 -: (#header>h1)+(#content>(#main>h2+div#entry$.section*5>(h3>a)+div>p*3+ul+)+(#utilities))+(#footer>address) ... -ok -testing #048 -: (div>(ul*2)*2)+(#utilities) ... -ok -testing #049 -: table>(tr>td*3)*4 ... -ok -testing #050 -: (((a#foo+a#bar)*2)*3) ... -ok -testing #051 -: div#box$*3>h3+p*2 ... -ok -testing #052 -: div#box.foo$$$.bar$$$*3 ... -ok -testing #053 -: div#box$*3>h3+p.bar*2|e ... -ok -testing #054 -: div>div#page>p.title+p|c ... -ok -testing #055 -: kbd*2|s ... -ok -testing #056 -: link:css ... -ok -testing #057 -: a[title="Hello', world" rel] ... -ok -testing #058 -: div>a#foo{bar} ... -ok -testing #059 -: .content{Hello!} ... -ok -testing #060 -: div.logo+(div#navigation)+(div#links) ... -ok -testing #061 -: h1{header}+{Text}+a[href=http://link.org]{linktext}+{again some text}+a[href=http://anoterlink.org]{click me!}+{some final text} ... -ok -testing #062 -: a{&}+div{&&} ... -ok -testing #063 -: span$$$$ ... -ok -testing #064 -: foo span$$$$ ... -ok -testing #065 -: foo span$$$$ bar ... -ok -testing #066 -: foo $$$$bar baz ... -ok -testing #067 -: foo $$$$bar baz ... -ok -testing #068 -: f div.boxes>article.box2>header>(hgroup>h2{aaa}+h3{bbb})+p{ccc}$$$$ ... -ok -testing #069 -: div.boxes>(div.box2>section>h2{a}+p{b})+(div.box1>section>h2{c}+p{d}+p{e}+(bq>h2{f}+h3{g})+p{h}) ... -ok -testing #070 -: (div>(label+input))+div ... -ok -testing #071 -: test1\ntest2\ntest3$$$$ ... -ok -testing #072 -: test1\ntest2\ntest3$$$$ ... -ok -testing #073 -: test1\ntest2\ntest3$$$$ ... -ok -testing #074 -: div#id-$*5>div#id2-$ ... -ok -testing #075 -: .foo>[bar=2]>.baz ... -ok -testing #076 -: {test case $ }*3 ... -ok -testing #077 -: {test case $${nr}}*3 ... -ok -testing #078 -: {test case \$ }*3 ... -ok -testing #079 -: {test case $$$ }*3 ... -ok -testing #080 -: a[title=$#]{foo} ... -ok -testing #081 -: span.item$*2>{item $} ... -ok -testing #082 -: \t$$$$ ... -ok -testing #083 -: a$$$$ ... -ok -testing #084 -: form.search-form._wide>input.-query-string+input:s.-btn_large|bem ... -ok -testing #085 -: form>fieldset>legend+(label>input[type="checkbox"])*3 ... -ok -pass 13.924448[split join tag]testing #001 -:
\n\t$$$$\n
... -ok -testing #002 -:
\n\t\n
... -ok -testing #003 -:
test$$$$/>\n
... -ok -testing #004 -:
\n\t\n
... -ok -pass 0.710855[toggle comment]testing #001 -:
\n\t$$$$\n
... -ok -testing #002 -:
\n\t\n
... -ok -pass 0.355618[image size]testing #001 -: img[src=http://mattn.kaoriya.net/images/logo.png]$$$$ ... -ok -testing #002 -: img[src=/logo.png]$$$$ ... -ok -testing #003 -: img[src=http://mattn.kaoriya.net/images/logo.png width=foo height=bar]$$$$ ... -ok -pass 1.940602[move next prev]testing #001 -: foo+bar+baz[dankogai=""]$$$$ ... -ok -pass 0.200150[contains dash in attributes]testing #001 -: div[foo-bar="baz"] ... -ok -pass 0.144592[default attributes]testing #001 -: p.title>a[/hoge/] ... -ok -testing #002 -: script[jquery.js] ... -ok -pass 0.277444[multiple group]testing #001 -: .outer$*3>.inner$*2 ... -ok -pass 0.155586[group itemno]testing #001 -: dl>(dt{$}+dd)*3 ... -ok -testing #002 -: (div[attr=$]*3)*3 ... -ok -pass 0.365517[update tag]testing #001 -: ... -ok -pass 0.188945[base value]testing #001 -: ul>li#id$@0*3 ... -ok -pass 0.145338[css][expand abbreviation]testing #001 -: {fs:n$$$$} ... -ok -testing #002 -: {fl:l|fc$$$$} ... -ok -testing #003 -: {bg+$$$$} ... -ok -testing #004 -: {bg+!$$$$} ... -ok -testing #005 -: {m$$$$} ... -ok -testing #006 -: {m0.1p$$$$} ... -ok -testing #007 -: {m1.0$$$$} ... -ok -testing #008 -: {m2$$$$} ... -ok -testing #009 -: {bdrs10$$$$} ... -ok -testing #010 -: {-bdrs20$$$$} ... -ok -testing #011 -: {lg(top,#fff,#000)$$$$} ... -ok -testing #012 -: {m10-5-0$$$$} ... -ok -testing #013 -: {m-10--5$$$$} ... -ok -testing #014 -: {m10-auto$$$$} ... -ok -testing #015 -: {w100p$$$$} ... -ok -testing #016 -: {h50e$$$$} ... -ok -testing #017 -: {(bg+)+c$$$$} ... -ok -testing #018 -: {m0+bgi+bg++p0$$$$} ... -ok -testing #019 -: {borle$$$$} ... -ok -testing #020 -: {c#dba$$$$} ... -ok -testing #021 -: {c#dba.7$$$$} ... -ok -testing #022 -: {dn$$$$} ... -ok -testing #023 -: {p10%$$$$} ... -ok -testing #024 -: {p10p$$$$} ... -ok -testing #025 -: {p10e$$$$} ... -ok -testing #026 -: {p10em$$$$} ... -ok -testing #027 -: {p10re$$$$} ... -ok -testing #028 -: {p10rem$$$$} ... -ok -pass 4.998573[haml][expand abbreviation]testing #001 -: div>p+ul#foo>li.bar$[foo=bar][bar=baz]*3>{baz} ... -ok -testing #002 -: div>p+ul#foo>li.bar$[foo=bar][bar=baz]*3>{baz}|haml ... -ok -testing #003 -: a*3|haml ... -ok -testing #004 -: .content{Hello!}|haml ... -ok -testing #005 -: a[title=$#]{foo} ... -ok -pass 0.854218[split join]testing #001 -: %a foo\n bar$$$$ ... -ok -testing #002 -: $$$$%a ... -ok -pass 0.411440[toggle comment]testing #001 -: %a{ :href => "http://www.google.com"$$$$ } hello ... -ok -testing #002 -: -# %a{ :href => "http://www.google.com"$$$$ } hello ... -ok -pass 0.399764[slim][expand abbreviation]testing #001 -: div>p+ul#foo>li.bar$[foo=bar][bar=baz]*3>{baz} ... -ok -testing #002 -: div>p+ul#foo>li.bar$[foo=bar][bar=baz]*3>{baz}|slim ... -ok -testing #003 -: a*3|slim ... -ok -testing #004 -: .content{Hello!}|slim ... -ok -testing #005 -: a[title=$#]{foo} ... -ok -pass 1.053588[split join tag]testing #001 -: a\n | foo$$$$ ... -ok -testing #002 -: a$$$$ ... -ok -pass 0.290832[toggle comment]testing #001 -: a href="http://www.google.com"$$$$\n | hello ... -ok -testing #002 -: /a href="http://www.google.com"$$$$\n | hello ... -ok -pass 0.289361[xsl][expand abbreviation]testing #001 -: vari ... -ok -testing #002 -: ap>wp ... -ok -pass 0.354678[xsd][expand abbreviation]testing #001 -: xsd:w3c ... -ok -pass 0.155347[mustache][expand abbreviation]testing #001 -: div#{{foo}} ... -ok -testing #002 -: div.{{foo}} ... -ok -pass 0.310753[scss][expand abbreviation]testing #001 -: @i$$$$ ... -ok -testing #002 -: {fs:n$$$$} ... -ok -testing #003 -: {fl:l|fc$$$$} ... -ok -testing #004 -: {bg+$$$$} ... -ok -testing #005 -: {bg+!$$$$} ... -ok -testing #006 -: {m$$$$} ... -ok -testing #007 -: {m0.1p$$$$} ... -ok -testing #008 -: {m1.0$$$$} ... -ok -testing #009 -: {m2$$$$} ... -ok -testing #010 -: {bdrs10$$$$} ... -ok -testing #011 -: {-bdrs20$$$$} ... -ok -testing #012 -: {lg(top,#fff,#000)$$$$} ... -ok -testing #013 -: {m10-5-0$$$$} ... -ok -testing #014 -: {m-10--5$$$$} ... -ok -testing #015 -: {m10-auto$$$$} ... -ok -testing #016 -: {w100p$$$$} ... -ok -testing #017 -: {h50e$$$$} ... -ok -testing #018 -: {(bg+)+c$$$$} ... -ok -pass 3.520060done \ No newline at end of file From 9cce773acbb02fc5c122803bcaf05d81fb67d961 Mon Sep 17 00:00:00 2001 From: jpsouzasilva Date: Tue, 28 Aug 2018 23:46:27 -0300 Subject: [PATCH 5/9] Case-insensitive type string matching Fixing the plugin for Vim 7.4 (Travis) --- autoload/emmet.vim | 48 +++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/autoload/emmet.vim b/autoload/emmet.vim index d5fcc18..eba988e 100644 --- a/autoload/emmet.vim +++ b/autoload/emmet.vim @@ -377,38 +377,38 @@ endfunction function! emmet#getFileType(...) abort let flg = get(a:000, 0, 0) + if has_key(s:emmet_settings, &filetype) + return &filetype + endif + let pos = emmet#util#getcurpos() let type = synIDattr(synID(pos[1], pos[2], 1), 'name') - if type =~# '^css\w' + if type =~? '^css\w' let type = 'css' - elseif type =~# '^html\w' + elseif type =~? '^html\w' let type = 'html' - elseif type =~# '^js\w' + elseif type =~? '^js\w' || '^javascript' let type = 'javascript' - elseif type =~# '^xml' + elseif type =~? '^xml' let type = 'xml' else - if has_key(s:emmet_settings, &filetype) - let type = &filetype - else - let types = split(&filetype, '\.') - for part in types - if emmet#lang#exists(part) - let type = part - break + let types = split(&filetype, '\.') + for part in types + if emmet#lang#exists(part) + let type = part + break + endif + let base = emmet#getBaseType(part) + if base !=# '' + if flg + let type = &filetype + else + let type = base endif - let base = emmet#getBaseType(part) - if base !=# '' - if flg - let type = &filetype - else - let type = base - endif - unlet base - break - endif - endfor - endif + unlet base + break + endif + endfor endif return len(type) == 0 ? 'html' : type From 581ba25bf86e301ff14940c14731e80e9f4b344d Mon Sep 17 00:00:00 2001 From: jpsouzasilva Date: Tue, 28 Aug 2018 23:55:27 -0300 Subject: [PATCH 6/9] Simplify pattern rules for matching single word syntax naming --- autoload/emmet.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/autoload/emmet.vim b/autoload/emmet.vim index eba988e..8a45ea8 100644 --- a/autoload/emmet.vim +++ b/autoload/emmet.vim @@ -383,11 +383,11 @@ function! emmet#getFileType(...) abort let pos = emmet#util#getcurpos() let type = synIDattr(synID(pos[1], pos[2], 1), 'name') - if type =~? '^css\w' + if type =~? '^css' let type = 'css' - elseif type =~? '^html\w' + elseif type =~? '^html' let type = 'html' - elseif type =~? '^js\w' || '^javascript' + elseif type =~? '^js' || '^javascript' let type = 'javascript' elseif type =~? '^xml' let type = 'xml' From 0e20db0cb72f32f105d3a9b9eca645cd3fd0c0bb Mon Sep 17 00:00:00 2001 From: jpsouzasilva Date: Wed, 29 Aug 2018 13:17:06 -0300 Subject: [PATCH 7/9] Changes from PR review #1 --- autoload/emmet.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/emmet.vim b/autoload/emmet.vim index 8a45ea8..163624a 100644 --- a/autoload/emmet.vim +++ b/autoload/emmet.vim @@ -387,7 +387,7 @@ function! emmet#getFileType(...) abort let type = 'css' elseif type =~? '^html' let type = 'html' - elseif type =~? '^js' || '^javascript' + elseif type =~? '^js\w' || type =~? '^javascript' let type = 'javascript' elseif type =~? '^xml' let type = 'xml' From 64656d8d4b9dc3b69c3d3cbf685e8297f18d1ac5 Mon Sep 17 00:00:00 2001 From: jpsouzasilva Date: Thu, 30 Aug 2018 08:11:50 -0300 Subject: [PATCH 8/9] Fixes the file identification for JSX --- autoload/emmet.vim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/autoload/emmet.vim b/autoload/emmet.vim index 163624a..ab4dc92 100644 --- a/autoload/emmet.vim +++ b/autoload/emmet.vim @@ -387,6 +387,8 @@ function! emmet#getFileType(...) abort let type = 'css' elseif type =~? '^html' let type = 'html' + elseif type =~? '^jsx' + let type = 'jsx' elseif type =~? '^js\w' || type =~? '^javascript' let type = 'javascript' elseif type =~? '^xml' From a33b7273a134ed47b513efe2022370351234b4a4 Mon Sep 17 00:00:00 2001 From: jpsouzasilva Date: Fri, 7 Sep 2018 22:22:44 -0300 Subject: [PATCH 9/9] Removes extra spaces at line 523 --- autoload/emmet.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/emmet.vim b/autoload/emmet.vim index ab4dc92..7944d81 100644 --- a/autoload/emmet.vim +++ b/autoload/emmet.vim @@ -520,7 +520,7 @@ function! emmet#expandAbbr(mode, abbr) range abort if len(filters) ==# 0 let filters = ['html'] endif - + if a:mode ==# 2 let leader = substitute(input('Tag: ', ''), '^\s*\(.*\)\s*$', '\1', 'g') if len(leader) ==# 0