diff --git a/README.md b/README.md index 9710e4b..22a6650 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,7 @@ HTML tag and attribe autocompletions in Atom. Install [autocomplete-plus](https://github.com/atom-community/autocomplete-plus) before installing this package. -This is powered by the list of HTML tags [here](https://github.com/adobe/brackets/blob/master/src/extensions/default/HTMLCodeHints/HtmlTags.json) -and HTML attributes [here](https://github.com/adobe/brackets/blob/master/src/extensions/default/HTMLCodeHints/HtmlAttributes.json) +This is powered by the list of HTML tags [here](https://github.com/adobe/brackets/blob/master/src/extensions/default/HTMLCodeHints/HtmlTags.json), HTML attributes [here](https://github.com/adobe/brackets/blob/master/src/extensions/default/HTMLCodeHints/HtmlAttributes.json) and Special Chars [here](https://raw.githubusercontent.com/adobe/brackets/master/src/extensions/default/HtmlEntityCodeHints/SpecialChars.json) ![html-completions](https://cloud.githubusercontent.com/assets/4392286/7382905/705e6174-ee59-11e4-88bf-40bd553a336c.gif) diff --git a/completions.json b/completions.json index 3f9af41..09ebf43 100644 --- a/completions.json +++ b/completions.json @@ -1 +1 @@ -{"tags":{"a":{"attributes":["href","hreflang","media","rel","target","type"]},"abbr":{},"address":{},"area":{"attributes":["alt","coords","href","hreflang","media","rel","shape","target","type"]},"article":{},"aside":{},"audio":{"attributes":["autoplay","controls","loop","mediagroup","muted","preload","src"]},"b":{},"base":{"attributes":["href","target"]},"bdi":{},"bdo":{},"big":{},"blockquote":{"attributes":["cite"]},"body":{"attributes":["onafterprint","onbeforeprint","onbeforeunload","onhashchange","onmessage","onoffline","ononline","onpagehide","onpageshow","onpopstate","onredo","onresize","onstorage","onundo","onunload"]},"br":{},"button":{"attributes":["autofocus","disabled","form","formaction","formenctype","formmethod","formnovalidate","formtarget","name","type","value"]},"canvas":{"attributes":["height","width"]},"caption":{},"cite":{},"code":{},"col":{"attributes":["span"]},"colgroup":{"attributes":["span"]},"command":{"attributes":["checked","disabled","icon","label","radiogroup","type"]},"datalist":{},"dd":{},"del":{"attributes":["cite","datetime"]},"details":{"attributes":["open"]},"dfn":{},"dialog":{"attributes":["open"]},"div":{},"dl":{},"dt":{},"em":{},"embed":{"attributes":["height","src","type","width"]},"fieldset":{"attributes":["disabled","form","name"]},"figcaption":{},"figure":{},"footer":{},"form":{"attributes":["accept-charset","action","autocomplete","enctype","method","name","novalidate","target"]},"h1":{},"h2":{},"h3":{},"h4":{},"h5":{},"h6":{},"head":{},"header":{},"hgroup":{},"hr":{},"html":{"attributes":["manifest","xml:lang","xmlns"]},"i":{},"iframe":{"attributes":["height","name","sandbox","seamless","src","srcdoc","width"]},"ilayer":{},"img":{"attributes":["alt","height","ismap","longdesc","src","usemap","width"]},"input":{"attributes":["accept","alt","autocomplete","autofocus","checked","dirname","disabled","form","formaction","formenctype","formmethod","formnovalidate","formtarget","height","list","max","maxlength","min","multiple","name","pattern","placeholder","readonly","required","size","src","step","type","value","width"]},"ins":{"attributes":["cite","datetime"]},"kbd":{},"keygen":{"attributes":["autofocus","challenge","disabled","form","keytype","name"]},"label":{"attributes":["for","form"]},"legend":{},"li":{"attributes":["value"]},"link":{"attributes":["disabled","href","hreflang","media","rel","sizes","type"]},"main":{},"map":{"attributes":["name"]},"mark":{},"marquee":{"attributes":["align","behavior","bgcolor","direction","height","hspace","loop","scrollamount","scrolldelay","truespeed","vspace","width"]},"menu":{"attributes":["label","type"]},"meta":{"attributes":["charset","content","http-equiv","name"]},"meter":{"attributes":["form","high","low","max","min","optimum","value"]},"nav":{},"noscript":{},"object":{"attributes":["archive","codebase","codetype","data","declare","form","height","name","standby","type","usemap","width"]},"ol":{"attributes":["reversed","start","type"]},"optgroup":{"attributes":["disabled","label"]},"option":{"attributes":["disabled","label","selected","value"]},"output":{"attributes":["for","form","name"]},"p":{},"param":{"attributes":["name","value"]},"pre":{},"progress":{"attributes":["form","max","value"]},"q":{"attributes":["cite"]},"rp":{},"rt":{},"ruby":{},"samp":{},"script":{"attributes":["async","charset","defer","src","type"]},"section":{},"select":{"attributes":["autofocus","disabled","form","multiple","name","required","size"]},"small":{},"source":{"attributes":["media","src","type"]},"span":{},"strong":{},"style":{"attributes":["disabled","media","scoped","type"]},"sub":{},"summary":{},"sup":{},"table":{"attributes":["border"]},"tbody":{},"td":{"attributes":["colspan","headers","rowspan"]},"textarea":{"attributes":["autofocus","cols","dirname","disabled","form","label","maxlength","name","placeholder","readonly","required","rows","wrap"]},"tfoot":{},"th":{"attributes":["colspan","headers","rowspan","scope"]},"thead":{},"time":{"attributes":["datetime","pubdate"]},"title":{},"tr":{},"track":{"attributes":["default","kind","label","src","srclang"]},"tt":{},"ul":{},"var":{},"video":{"attributes":["autoplay","controls","height","loop","mediagroup","muted","poster","preload","src","width"]},"wbr":{}},"attributes":{"accesskey":{"global":"true"},"class":{"global":"true","type":"cssStyle"},"contenteditable":{"global":"true","type":"boolean"},"contextmenu":{"global":"true"},"dir":{"attribOption":["ltr","rtl"],"global":"true"},"draggable":{"attribOption":["auto","false","true"],"global":"true"},"dropzone":{"attribOption":["copy","move","link"],"global":"true"},"hidden":{"attribOption":["hidden"],"global":"true"},"id":{"global":"true","type":"cssId"},"lang":{"attribOption":["ab","aa","af","sq","am","ar","an","hy","as","ay","az","ba","eu","bn","dz","bh","bi","br","bg","my","be","km","ca","zh","co","hr","cs","da","nl","en","eo","et","fo","fa","fi","fr","fy","gl","gd","gv","ka","de","el","kl","gn","gu","ht","ha","he","hi","hu","is","io","id","ia","ie","iu","ik","ga","it","ja","jv","kn","ks","kk","rw","ky","rn","ko","ku","lo","la","lv","li","ln","lt","mk","mg","ms","ml","mt","mi","mr","mo","mn","na","ne","no","oc","or","om","ps","pl","pt","pa","qu","rm","ro","ru","sz","sm","sg","sa","sr","sh","st","tn","sn","ii","sd","si","ss","sk","sl","so","es","su","sw","sv","tl","tg","ta","tt","te","th","bo","ti","to","ts","tr","tk","tw","ug","uk","ur","uz","vi","vo","wa","cy","wo","xh","yi","yo","zu"],"global":"true"},"role":{"attribOption":["alert","alertdialog","article","application","banner","button","checkbox","columnheader","combobox","complementary","contentinfo","definition","directory","dialog","document","form","grid","gridcell","group","heading","img","link","list","listbox","listitem","log","main","marquee","math","menu","menubar","menuitem","menuitemcheckbox","menuitemradio","navigation","note","option","presentation","progressbar","radio","radiogroup","region","row","rowgroup","rowheader","scrollbar","search","separator","slider","spinbutton","status","tab","tablist","tabpanel","textbox","timer","toolbar","tooltip","tree","treegrid","treeitem"],"global":"true"},"spellcheck":{"global":"true","type":"boolean"},"style":{"global":"true","type":"style"},"tabindex":{"global":"true"},"title":{"global":"true"},"onabort":{"global":"true"},"onblur":{"global":"true"},"oncanplay":{"global":"true"},"oncanplaythrough":{"global":"true"},"onchange":{"global":"true"},"onclick":{"global":"true"},"oncontextmenu":{"global":"true"},"oncuechange":{"global":"true"},"ondblclick":{"global":"true"},"ondrag":{"global":"true"},"ondragend":{"global":"true"},"ondragenter":{"global":"true"},"ondragleave":{"global":"true"},"ondragover":{"global":"true"},"ondragstart":{"global":"true"},"ondrop":{"global":"true"},"ondurationchange":{"global":"true"},"onemptied":{"global":"true"},"onended":{"global":"true"},"onerror":{"global":"true"},"onfocus":{"global":"true"},"oninput":{"global":"true"},"oninvalid":{"global":"true"},"onkeydown":{"global":"true"},"onkeypress":{"global":"true"},"onkeyup":{"global":"true"},"onload":{"global":"true"},"onloadeddata":{"global":"true"},"onloadedmetadata":{"global":"true"},"onloadstart":{"global":"true"},"onmousedown":{"global":"true"},"onmousemove":{"global":"true"},"onmouseout":{"global":"true"},"onmouseover":{"global":"true"},"onmouseup":{"global":"true"},"onmousewheel":{"global":"true"},"onpause":{"global":"true"},"onplay":{"global":"true"},"onplaying":{"global":"true"},"onprogress":{"global":"true"},"onratechange":{"global":"true"},"onreadystatechange":{"global":"true"},"onreset":{"global":"true"},"onscroll":{"global":"true"},"onseeked":{"global":"true"},"onseeking":{"global":"true"},"onselect":{"global":"true"},"onshow":{"global":"true"},"onstalled":{"global":"true"},"onsubmit":{"global":"true"},"onsuspend":{"global":"true"},"ontimeupdate":{"global":"true"},"onvolumechange":{"global":"true"},"onwaiting":{"global":"true"},"accept":{"attribOption":["text/html","text/plain","application/msword","application/msexcel","application/postscript","application/x-zip-compressed","application/pdf","application/rtf","video/x-msvideo","video/quicktime","video/x-mpeg2","audio/x-pn/realaudio","audio/x-mpeg","audio/x-waw","audio/x-aiff","audio/basic","image/tiff","image/jpeg","image/gif","image/x-png","image/x-photo-cd","image/x-MS-bmp","image/x-rgb","image/x-portable-pixmap","image/x-portable-greymap","image/x-portablebitmap"]},"accept-charset":{},"action":{},"align":{},"alt":{},"archive":{},"async":{"type":"flag"},"autocomplete":{"attribOption":["off","on"]},"autofocus":{"type":"flag"},"autoplay":{"type":"flag"},"behavior":{"attribOption":["scroll","slide","alternate"]},"bgcolor":{"type":"color"},"border":{},"challenge":{},"charset":{"attribOption":["iso-8859-1","utf-8","shift_jis","euc-jp","big5","gb2312","euc-kr","din_66003-kr","ns_4551-1-kr","sen_850200_b","csISO2022jp","hz-gb-2312","ibm852","ibm866","irv","iso-2022-kr","iso-8859-2","iso-8859-3","iso-8859-4","iso-8859-5","iso-8859-6","iso-8859-7","iso-8859-8","iso-8859-9","koi8-r","ks_c_5601","windows-1250","windows-1251","windows-1252","windows-1253","windows-1254","windows-1255","windows-1256","windows-1257","windows-1258","windows-874","x-euc","asmo-708","dos-720","dos-862","dos-874","cp866","cp1256"]},"checked":{"type":"flag"},"cite":{},"codebase":{},"codetype":{},"cols":{},"colspan":{},"content":{},"controls":{"type":"flag"},"coords":{},"data":{},"datetime":{},"declare":{"type":"flag"},"default":{"type":"flag"},"defer":{"type":"flag"},"direction":{"attribOption":["left","right","up","down"]},"dirname":{},"disabled":{"type":"flag"},"enctype":{"attribOption":["application/x-www-form-urlencoded","multipart/form-data","text/plain"]},"for":{},"form":{},"formaction":{},"formenctype":{"attribOption":["application/x-www-form-urlencoded","multipart/form-data","text/plain"]},"formmethod":{"attribOption":["get","post"]},"formnovalidate":{"type":"flag"},"formtarget":{"attribOption":["_blank","_parent","_self","_top"]},"headers":{},"height":{},"high":{},"href":{},"hreflang":{},"hspace":{},"http-equiv":{"attribOption":["content-type","default-style","refresh"]},"icon":{},"ismap":{"type":"flag"},"keytype":{"attribOption":["dsa","ec","rsa"]},"kind":{"attribOption":["captions","chapters","descriptions","metadata","subtitles"]},"label":{},"list":{},"longdesc":{},"loop":{"type":"flag"},"low":{},"manifest":{},"max":{},"maxlength":{},"media":{"attribOption":["screen","tty","tv","projection","handheld","print","aural","braille","embossed","speech","all","width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","orientation","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid"],"allowMultipleValues":"true"},"mediagroup":{},"method":{"attribOption":["get","post"]},"min":{},"multiple":{"type":"flag"},"muted":{"type":"flag"},"name":{},"novalidate":{"type":"flag"},"open":{"type":"flag"},"optimum":{},"pattern":{},"placeholder":{},"poster":{},"preload":{"attribOption":["auto","metadata","none"]},"pubdate":{},"radiogroup":{},"rel":{"attribOption":["alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","sidebar","tag","external"]},"readonly":{"type":"flag"},"required":{"type":"flag"},"reversed":{"type":"flag"},"rows":{},"rowspan":{},"sandbox":{"attribOption":["allow-forms","allow-same-origin","allow-scripts","allow-top-navigation"]},"seamless":{"type":"flag"},"selected":{"type":"flag"},"scope":{"attribOption":["col","colgroup","row","rowgroup"]},"scoped":{"type":"boolean"},"scrollamount":{},"scrolldelay":{},"shape":{"attribOption":["circle","default","poly","rect"]},"size":{},"sizes":{"attribOption":["any"]},"span":{},"src":{},"srcdoc":{},"srclang":{},"standby":{},"start":{},"step":{},"target":{"attribOption":["_blank","_parent","_self","_top"]},"truespeed":{"type":"flag"},"type":{},"usemap":{},"value":{},"vspace":{},"width":{},"wrap":{"attribOption":["hard","soft"]},"xml:lang":{},"xmlns":{}}} +{"tags":{"a":{"attributes":["href","hreflang","media","rel","target","type"]},"abbr":{},"address":{},"area":{"attributes":["alt","coords","href","hreflang","media","rel","shape","target","type"]},"article":{},"aside":{},"audio":{"attributes":["autoplay","controls","loop","mediagroup","muted","preload","src"]},"b":{},"base":{"attributes":["href","target"]},"bdi":{},"bdo":{},"big":{},"blockquote":{"attributes":["cite"]},"body":{"attributes":["onafterprint","onbeforeprint","onbeforeunload","onhashchange","onmessage","onoffline","ononline","onpagehide","onpageshow","onpopstate","onredo","onresize","onstorage","onundo","onunload"]},"br":{},"button":{"attributes":["autofocus","disabled","form","formaction","formenctype","formmethod","formnovalidate","formtarget","name","type","value"]},"canvas":{"attributes":["height","width"]},"caption":{},"cite":{},"code":{},"col":{"attributes":["span"]},"colgroup":{"attributes":["span"]},"command":{"attributes":["checked","disabled","icon","label","radiogroup","type"]},"datalist":{},"dd":{},"del":{"attributes":["cite","datetime"]},"details":{"attributes":["open"]},"dfn":{},"dialog":{"attributes":["open"]},"div":{},"dl":{},"dt":{},"em":{},"embed":{"attributes":["height","src","type","width"]},"fieldset":{"attributes":["disabled","form","name"]},"figcaption":{},"figure":{},"footer":{},"form":{"attributes":["accept-charset","action","autocomplete","enctype","method","name","novalidate","target"]},"h1":{},"h2":{},"h3":{},"h4":{},"h5":{},"h6":{},"head":{},"header":{},"hgroup":{},"hr":{},"html":{"attributes":["manifest","xml:lang","xmlns"]},"i":{},"iframe":{"attributes":["height","name","sandbox","seamless","src","srcdoc","width"]},"ilayer":{},"img":{"attributes":["alt","height","ismap","longdesc","src","usemap","width"]},"input":{"attributes":["accept","alt","autocomplete","autofocus","checked","dirname","disabled","form","formaction","formenctype","formmethod","formnovalidate","formtarget","height","list","max","maxlength","min","multiple","name","pattern","placeholder","readonly","required","size","src","step","type","value","width"]},"ins":{"attributes":["cite","datetime"]},"kbd":{},"keygen":{"attributes":["autofocus","challenge","disabled","form","keytype","name"]},"label":{"attributes":["for","form"]},"legend":{},"li":{"attributes":["value"]},"link":{"attributes":["disabled","href","hreflang","media","rel","sizes","type"]},"main":{},"map":{"attributes":["name"]},"mark":{},"marquee":{"attributes":["align","behavior","bgcolor","direction","height","hspace","loop","scrollamount","scrolldelay","truespeed","vspace","width"]},"menu":{"attributes":["label","type"]},"meta":{"attributes":["charset","content","http-equiv","name"]},"meter":{"attributes":["form","high","low","max","min","optimum","value"]},"nav":{},"noscript":{},"object":{"attributes":["archive","codebase","codetype","data","declare","form","height","name","standby","type","usemap","width"]},"ol":{"attributes":["reversed","start","type"]},"optgroup":{"attributes":["disabled","label"]},"option":{"attributes":["disabled","label","selected","value"]},"output":{"attributes":["for","form","name"]},"p":{},"param":{"attributes":["name","value"]},"pre":{},"progress":{"attributes":["form","max","value"]},"q":{"attributes":["cite"]},"rp":{},"rt":{},"ruby":{},"samp":{},"script":{"attributes":["async","charset","defer","src","type"]},"section":{},"select":{"attributes":["autofocus","disabled","form","multiple","name","required","size"]},"small":{},"source":{"attributes":["media","src","type"]},"span":{},"strong":{},"style":{"attributes":["disabled","media","scoped","type"]},"sub":{},"summary":{},"sup":{},"table":{"attributes":["border"]},"tbody":{},"td":{"attributes":["colspan","headers","rowspan"]},"template":{"attributes":["content"]},"textarea":{"attributes":["autofocus","cols","dirname","disabled","form","label","maxlength","name","placeholder","readonly","required","rows","wrap"]},"tfoot":{},"th":{"attributes":["colspan","headers","rowspan","scope"]},"thead":{},"time":{"attributes":["datetime","pubdate"]},"title":{},"tr":{},"track":{"attributes":["default","kind","label","src","srclang"]},"tt":{},"ul":{},"var":{},"video":{"attributes":["autoplay","controls","height","loop","mediagroup","muted","poster","preload","src","width"]},"wbr":{}},"attributes":{"accesskey":{"global":"true"},"class":{"global":"true","type":"cssStyle"},"contenteditable":{"global":"true","type":"boolean"},"contextmenu":{"global":"true"},"dir":{"attribOption":["ltr","rtl"],"global":"true"},"draggable":{"attribOption":["auto","false","true"],"global":"true"},"dropzone":{"attribOption":["copy","move","link"],"global":"true"},"hidden":{"attribOption":["hidden"],"global":"true"},"id":{"global":"true","type":"cssId"},"lang":{"attribOption":["ab","aa","af","sq","am","ar","an","hy","as","ay","az","ba","eu","bn","dz","bh","bi","br","bg","my","be","km","ca","zh","co","hr","cs","da","nl","en","eo","et","fo","fa","fi","fr","fy","gl","gd","gv","ka","de","el","kl","gn","gu","ht","ha","he","hi","hu","is","io","id","ia","ie","iu","ik","ga","it","ja","jv","kn","ks","kk","rw","ky","rn","ko","ku","lo","la","lv","li","ln","lt","mk","mg","ms","ml","mt","mi","mr","mo","mn","na","ne","no","oc","or","om","ps","pl","pt","pa","qu","rm","ro","ru","sz","sm","sg","sa","sr","sh","st","tn","sn","ii","sd","si","ss","sk","sl","so","es","su","sw","sv","tl","tg","ta","tt","te","th","bo","ti","to","ts","tr","tk","tw","ug","uk","ur","uz","vi","vo","wa","cy","wo","xh","yi","yo","zu"],"global":"true"},"role":{"attribOption":["alert","alertdialog","article","application","banner","button","checkbox","columnheader","combobox","complementary","contentinfo","definition","directory","dialog","document","form","grid","gridcell","group","heading","img","link","list","listbox","listitem","log","main","marquee","math","menu","menubar","menuitem","menuitemcheckbox","menuitemradio","navigation","note","option","presentation","progressbar","radio","radiogroup","region","row","rowgroup","rowheader","scrollbar","search","separator","slider","spinbutton","status","tab","tablist","tabpanel","textbox","timer","toolbar","tooltip","tree","treegrid","treeitem"],"global":"true"},"spellcheck":{"global":"true","type":"boolean"},"style":{"global":"true","type":"style"},"tabindex":{"global":"true"},"title":{"global":"true"},"onabort":{"global":"true"},"onblur":{"global":"true"},"oncanplay":{"global":"true"},"oncanplaythrough":{"global":"true"},"onchange":{"global":"true"},"onclick":{"global":"true"},"oncontextmenu":{"global":"true"},"oncuechange":{"global":"true"},"ondblclick":{"global":"true"},"ondrag":{"global":"true"},"ondragend":{"global":"true"},"ondragenter":{"global":"true"},"ondragleave":{"global":"true"},"ondragover":{"global":"true"},"ondragstart":{"global":"true"},"ondrop":{"global":"true"},"ondurationchange":{"global":"true"},"onemptied":{"global":"true"},"onended":{"global":"true"},"onerror":{"global":"true"},"onfocus":{"global":"true"},"oninput":{"global":"true"},"oninvalid":{"global":"true"},"onkeydown":{"global":"true"},"onkeypress":{"global":"true"},"onkeyup":{"global":"true"},"onload":{"global":"true"},"onloadeddata":{"global":"true"},"onloadedmetadata":{"global":"true"},"onloadstart":{"global":"true"},"onmousedown":{"global":"true"},"onmousemove":{"global":"true"},"onmouseout":{"global":"true"},"onmouseover":{"global":"true"},"onmouseup":{"global":"true"},"onmousewheel":{"global":"true"},"onpause":{"global":"true"},"onplay":{"global":"true"},"onplaying":{"global":"true"},"onprogress":{"global":"true"},"onratechange":{"global":"true"},"onreadystatechange":{"global":"true"},"onreset":{"global":"true"},"onscroll":{"global":"true"},"onseeked":{"global":"true"},"onseeking":{"global":"true"},"onselect":{"global":"true"},"onshow":{"global":"true"},"onstalled":{"global":"true"},"onsubmit":{"global":"true"},"onsuspend":{"global":"true"},"ontimeupdate":{"global":"true"},"onvolumechange":{"global":"true"},"onwaiting":{"global":"true"},"accept":{"attribOption":["text/html","text/plain","application/msword","application/msexcel","application/postscript","application/x-zip-compressed","application/pdf","application/rtf","video/x-msvideo","video/quicktime","video/x-mpeg2","audio/x-pn/realaudio","audio/x-mpeg","audio/x-waw","audio/x-aiff","audio/basic","image/tiff","image/jpeg","image/gif","image/x-png","image/x-photo-cd","image/x-MS-bmp","image/x-rgb","image/x-portable-pixmap","image/x-portable-greymap","image/x-portablebitmap"]},"accept-charset":{},"action":{},"align":{},"alt":{},"archive":{},"async":{"type":"flag"},"autocomplete":{"attribOption":["off","on"]},"autofocus":{"type":"flag"},"autoplay":{"type":"flag"},"behavior":{"attribOption":["scroll","slide","alternate"]},"bgcolor":{"type":"color"},"border":{},"challenge":{},"charset":{"attribOption":["iso-8859-1","utf-8","shift_jis","euc-jp","big5","gb2312","euc-kr","din_66003-kr","ns_4551-1-kr","sen_850200_b","csISO2022jp","hz-gb-2312","ibm852","ibm866","irv","iso-2022-kr","iso-8859-2","iso-8859-3","iso-8859-4","iso-8859-5","iso-8859-6","iso-8859-7","iso-8859-8","iso-8859-9","koi8-r","ks_c_5601","windows-1250","windows-1251","windows-1252","windows-1253","windows-1254","windows-1255","windows-1256","windows-1257","windows-1258","windows-874","x-euc","asmo-708","dos-720","dos-862","dos-874","cp866","cp1256"]},"checked":{"type":"flag"},"cite":{},"codebase":{},"codetype":{},"cols":{},"colspan":{},"content":{},"controls":{"type":"flag"},"coords":{},"data":{},"datetime":{},"declare":{"type":"flag"},"default":{"type":"flag"},"defer":{"type":"flag"},"direction":{"attribOption":["left","right","up","down"]},"dirname":{},"disabled":{"type":"flag"},"enctype":{"attribOption":["application/x-www-form-urlencoded","multipart/form-data","text/plain"]},"for":{},"form":{},"formaction":{},"formenctype":{"attribOption":["application/x-www-form-urlencoded","multipart/form-data","text/plain"]},"formmethod":{"attribOption":["get","post"]},"formnovalidate":{"type":"flag"},"formtarget":{"attribOption":["_blank","_parent","_self","_top"]},"headers":{},"height":{},"high":{},"href":{},"hreflang":{},"hspace":{},"http-equiv":{"attribOption":["content-type","default-style","refresh"]},"icon":{},"ismap":{"type":"flag"},"keytype":{"attribOption":["dsa","ec","rsa"]},"kind":{"attribOption":["captions","chapters","descriptions","metadata","subtitles"]},"label":{},"list":{},"longdesc":{},"loop":{"type":"flag"},"low":{},"manifest":{},"max":{},"maxlength":{},"media":{"attribOption":["screen","tty","tv","projection","handheld","print","aural","braille","embossed","speech","all","width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","orientation","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid"],"allowMultipleValues":"true"},"mediagroup":{},"method":{"attribOption":["get","post"]},"min":{},"multiple":{"type":"flag"},"muted":{"type":"flag"},"name":{},"novalidate":{"type":"flag"},"open":{"type":"flag"},"optimum":{},"pattern":{},"placeholder":{},"poster":{},"preload":{"attribOption":["auto","metadata","none"]},"pubdate":{},"radiogroup":{},"rel":{"attribOption":["alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","sidebar","tag","external"]},"readonly":{"type":"flag"},"required":{"type":"flag"},"reversed":{"type":"flag"},"rows":{},"rowspan":{},"sandbox":{"attribOption":["allow-forms","allow-same-origin","allow-scripts","allow-top-navigation"]},"seamless":{"type":"flag"},"selected":{"type":"flag"},"scope":{"attribOption":["col","colgroup","row","rowgroup"]},"scoped":{"type":"boolean"},"scrollamount":{},"scrolldelay":{},"shape":{"attribOption":["circle","default","poly","rect"]},"size":{},"sizes":{"attribOption":["any"]},"span":{},"src":{},"srcdoc":{},"srclang":{},"standby":{},"start":{},"step":{},"target":{"attribOption":["_blank","_parent","_self","_top"]},"truespeed":{"type":"flag"},"type":{},"usemap":{},"value":{},"vspace":{},"width":{},"wrap":{"attribOption":["hard","soft"]},"xml:lang":{},"xmlns":{}},"entities":["#33;","#35;","#36;","#37;","#39;","#40;","#41;","#42;","#43;","#44;","#45;","#46;","#58;","#59;","#61;","#63;","#64;","#91;","#92;","#93;","#94;","#95;","#96;","#123;","#124;","#125;","#126;","#8226;","#9679;","aacute;","Aacute;","acirc;","Acirc;","acute;","aelig;","AElig;","agrave;","Agrave;","alefsym;","alpha;","Alpha;","amp;","and;","ang;","aring;","Aring;","asymp;","atilde;","Atilde;","auml;","Auml;","bdquo;","beta;","Beta;","brvbar;","bull;","cap;","ccedil;","Ccedil;","cedil;","cent;","chi;","Chi;","circ;","clubs;","cong;","copy;","crarr;","cup;","curren;","dagger;","Dagger;","darr;","dArr;","deg;","delta;","Delta;","diams;","die;","divide;","eacute;","Eacute;","ecirc;","Ecirc;","egrave;","Egrave;","empty;","emsp;","ensp;","epsilon;","Epsilon;","equiv;","eta;","Eta;","eth;","ETH;","euml;","Euml;","euro;","exist;","forall;","frac12;","frac14;","frac34;","frasl;","gamma;","Gamma;","ge;","gt;","harr;","hArr;","hearts;","hellip;","iacute;","Iacute;","icirc;","Icirc;","iexcl;","igrave;","Igrave;","image;","infin;","int;","iota;","Iota;","iquest;","isin;","iuml;","Iuml;","kappa;","Kappa;","lambda;","Lambda;","lang;","laquo;","larr;","lArr;","lceil;","ldquo;","le;","lfloor;","lowast;","loz;","lrm;","lsaquo;","lsquo;","lt;","macr;","mdash;","micro;","middot;","minus;","mu;","Mu;","nabla;","nbsp;","ndash;","ne;","ni;","not;","notin;","nsub;","ntilde;","Ntilde;","nu;","Nu;","oacute;","Oacute;","ocirc;","Ocirc;","ograve;","Ograve;","oline;","omega;","Omega;","omicron;","Omicron;","oplus;","or;","ordf;","ordm;","oslash;","Oslash;","otilde;","Otilde;","otimes;","ouml;","Ouml;","para;","part;","permil;","perp;","phi;","Phi;","pi;","Pi;","piv;","plusmn;","pound;","prime;","Prime;","prod;","prop;","psi;","Psi;","quot;","radic;","rang;","raquo;","rarr;","rArr;","rceil;","rdquo;","real;","reg;","rfloor;","rho;","Rho;","rlm;","rsaquo;","rsquo;","sbquo;","Scaron;","scaron;","sdot;","sect;","shy;","sigma;","Sigma;","sim;","spades;","sub;","sube;","sum;","sup;","supe;","sup1;","sup2;","sup3;","szlig;","tau;","Tau;","there4;","theta;","Theta;","thetasym;","thinsp;","thorn;","THORN;","times;","tilde;","trade;","uacute;","Uacute;","uarr;","uArr;","ucirc;","Ucirc;","ugrave;","Ugrave;","uml;","upsih;","upsilon;","Upsilon;","uuml;","Uuml;","weierp;","xi;","Xi;","yacute;","Yacute;","yen;","yuml;","zeta;","Zeta;","zwnj;"]} diff --git a/lib/provider.coffee b/lib/provider.coffee index 08512a4..227f1a6 100644 --- a/lib/provider.coffee +++ b/lib/provider.coffee @@ -1,5 +1,6 @@ fs = require 'fs' path = require 'path' +he = require 'he' trailingWhitespace = /\s$/ attributePattern = /\s+([a-zA-Z][-a-zA-Z]*)\s*=\s*$/ @@ -12,7 +13,11 @@ module.exports = getSuggestions: (request) -> {prefix} = request - if @isAttributeValueStartWithNoPrefix(request) + if @isEntityStartWithNoPrefix(request) + @getEntityNameCompletions() + else if @isEntityStartWithPrefix(request) + @getEntityNameCompletions(prefix) + else if @isAttributeValueStartWithNoPrefix(request) @getAttributeValueCompletions(request) else if @isAttributeValueStartWithPrefix(request) @getAttributeValueCompletions(request, prefix) @@ -74,6 +79,22 @@ module.exports = scopes = scopeDescriptor.getScopesArray() @hasStringScope(scopes) and @hasTagScope(scopes) + + isEntityStartWithNoPrefix: ({scopeDescriptor, prefix}) -> + scopes = scopeDescriptor.getScopesArray() + if prefix is '&' and scopes.length is 1 + scopes[0] is 'text.html.basic' + else if prefix is '&' and scopes.length is 2 + scopes[0] is 'text.html.basic' and scopes[1] is 'invalid.illegal.bad-ampersand.html' + else + false + + isEntityStartWithPrefix: ({scopeDescriptor, prefix}) -> + return false unless prefix + return false if trailingWhitespace.test(prefix) + + @hasEntityScope(scopeDescriptor.getScopesArray()) + hasTagScope: (scopes) -> scopes.indexOf('meta.tag.any.html') isnt -1 or scopes.indexOf('meta.tag.other.html') isnt -1 or @@ -85,18 +106,34 @@ module.exports = scopes.indexOf('string.quoted.double.html') isnt -1 or scopes.indexOf('string.quoted.single.html') isnt -1 + hasEntityScope: (scopes) -> + scopes.indexOf('constant.character.entity.html') isnt -1 or + scopes.indexOf('entity.name.entity.other.html') isnt -1 + getTagNameCompletions: (prefix) -> completions = [] for tag, attributes of @completions.tags when not prefix or firstCharsEqual(tag, prefix) completions.push(@buildTagCompletion(tag)) completions + getEntityNameCompletions: (prefix) -> + completions = [] + for entity in @completions.entities when not prefix or firstCharsEqual(entity, prefix) + completions.push(@buildEntityCompletion(entity)) + completions + buildTagCompletion: (tag) -> text: tag type: 'tag' description: "HTML <#{tag}> tag" descriptionMoreURL: @getTagDocsURL(tag) + buildEntityCompletion: (entity) -> + text: entity + type: 'entity' + description: he.decode("&#{entity}") + descriptionMoreURL: @getEntityDocsURL(entity) + getAttributeNameCompletions: ({editor, bufferPosition}, prefix) -> completions = [] tag = @getPreviousTag(editor, bufferPosition) @@ -184,5 +221,8 @@ module.exports = getGlobalAttributeDocsURL: (attribute) -> "https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/#{attribute}" + getEntityDocsURL: (entity) -> + "https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Character_entity_references_in_HTML" + firstCharsEqual = (str1, str2) -> str1[0].toLowerCase() is str2[0].toLowerCase() diff --git a/package.json b/package.json index 21c84c0..0e5796e 100644 --- a/package.json +++ b/package.json @@ -18,5 +18,8 @@ "devDependencies": { "coffeelint": "^1.9.7", "request": "^2.53.0" + }, + "dependencies": { + "he": "^0.5.0" } } diff --git a/spec/provider-spec.coffee b/spec/provider-spec.coffee index 883b3b1..49038a9 100644 --- a/spec/provider-spec.coffee +++ b/spec/provider-spec.coffee @@ -283,3 +283,39 @@ describe "HTML autocompletions", -> args = atom.commands.dispatch.mostRecentCall.args expect(args[0].tagName.toLowerCase()).toBe 'atom-text-editor' expect(args[1]).toBe 'autocomplete-plus:activate' + + it "autocompletes entity without a prefix", -> + editor.setText('&') + editor.setCursorBufferPosition([0, 1]) + + completions = getCompletions() + expect(completions.length).toBe 276 + expect(completions[0].descriptionMoreURL.endsWith('/wiki/List_of_XML_and_HTML_character_entity_references#Character_entity_references_in_HTML')).toBe true + + expect(completions[0].text).toBe '#33;' + expect(completions[1].text).toBe '#35;' + expect(completions[2].text).toBe '#36;' + expect(completions[3].text).toBe '#37;' + expect(completions[4].text).toBe '#39;' + expect(completions[5].text).toBe '#40;' + + for completion in completions + expect(completion.type).toBe 'entity' + + it "autocompletes entity with a prefix", -> + editor.setText('&a') + editor.setCursorBufferPosition([0, 2]) + + completions = getCompletions() + expect(completions.length).toBe 22 + expect(completions[0].descriptionMoreURL.endsWith('/wiki/List_of_XML_and_HTML_character_entity_references#Character_entity_references_in_HTML')).toBe true + + expect(completions[0].text).toBe 'aacute;' + expect(completions[1].text).toBe 'Aacute;' + expect(completions[2].text).toBe 'acirc;' + expect(completions[3].text).toBe 'Acirc;' + expect(completions[4].text).toBe 'acute;' + expect(completions[5].text).toBe 'aelig;' + + for completion in completions + expect(completion.type).toBe 'entity' diff --git a/update.coffee b/update.coffee index 91479af..5c1b337 100644 --- a/update.coffee +++ b/update.coffee @@ -43,11 +43,29 @@ getAttributes = (callback) -> callback(null, attributes) +getEntities = (callback) -> + requestOptions = + url: 'https://raw.githubusercontent.com/adobe/brackets/master/src/extensions/default/HtmlEntityCodeHints/SpecialChars.json' + json: true + + request requestOptions, (error, response, entities) -> + return callback(error) if error? + + if response.statusCode isnt 200 + return callback(new Error("Request for SpecialChars.json failed: #{response.statusCode}")) + + entities = ((entity.substring 1) + ';' for entity in entities) + + callback(null, entities) + getTags (error, tags) -> exitIfError(error) getAttributes (error, attributes) -> exitIfError(error) - completions = {tags, attributes} - fs.writeFileSync(path.join(__dirname, 'completions.json'), "#{JSON.stringify(completions, null, 0)}\n") + getEntities (error, entities) -> + exitIfError(error) + + completions = {tags, attributes, entities} + fs.writeFileSync(path.join(__dirname, 'completions.json'), "#{JSON.stringify(completions, null, 0)}\n")