@@ -116,6 +116,8 @@ function! csscomplete#CompleteCSS(findstart, base)
116116 let list_style_type_values = [" decimal" , " decimal-leading-zero" , " arabic-indic" , " armenian" , " upper-armenian" , " lower-armenian" , " bengali" , " cambodian" , " khmer" , " cjk-decimal" , " devanagari" , " georgian" , " gujarati" , " gurmukhi" , " hebrew" , " kannada" , " lao" , " malayalam" , " mongolian" , " myanmar" , " oriya" , " persian" , " lower-roman" , " upper-roman" , " tamil" , " telugu" , " thai" , " tibetan" , " lower-alpha" , " lower-latin" , " upper-alpha" , " upper-latin" , " cjk-earthly-branch" , " cjk-heavenly-stem" , " lower-greek" , " hiragana" , " hiragana-iroha" , " katakana" , " katakana-iroha" , " disc" , " circle" , " square" , " disclosure-open" , " disclosure-closed" ]
117117 let timing_functions = [" cubic-bezier(" , " steps(" , " linear" , " ease" , " ease-in" , " ease-in-out" , " ease-out" , " step-start" , " step-end" ]
118118
119+ let postfix = " ;"
120+
119121 if prop == ' all'
120122 let values = []
121123 elseif prop == ' additive-symbols'
@@ -128,6 +130,7 @@ function! csscomplete#CompleteCSS(findstart, base)
128130 let values = [" auto" , " flex-start" , " flex-end" , " center" , " baseline" , " stretch" ]
129131 elseif prop == ' animation'
130132 let values = timing_functions + [" normal" , " reverse" , " alternate" , " alternate-reverse" ] + [" none" , " forwards" , " backwards" , " both" ] + [" running" , " paused" ]
133+ let postfix = " "
131134 elseif prop == ' animation-delay'
132135 let values = []
133136 elseif prop == ' animation-direction'
@@ -158,6 +161,7 @@ function! csscomplete#CompleteCSS(findstart, base)
158161 let values = [" top" , " center" , " bottom" ]
159162 elseif vals = ~ ' ^[a-zA-Z]\+\s\+\%([a-zA-Z]\+\)\?$'
160163 let values = [" left" , " center" , " right" ]
164+ let postfix = " "
161165 else
162166 return []
163167 endif
@@ -167,8 +171,10 @@ function! csscomplete#CompleteCSS(findstart, base)
167171 let values = [" auto" , " contain" , " cover" ]
168172 elseif prop == ' background'
169173 let values = [" scroll" , " fixed" ] + color_values + [" url(" , " none" ] + [" top" , " center" , " bottom" , " left" , " right" ] + [" repeat" , " repeat-x" , " repeat-y" , " no-repeat" ] + [" auto" , " contain" , " cover" ]
174+ let postfix = " "
170175 elseif prop = ~ ' border\%(-top\|-right\|-bottom\|-left\|-block-start\|-block-end\)\?$'
171176 let vals = matchstr (line , ' .*:\s*\zs.*' )
177+ let postfix = " "
172178 if vals = ~ ' ^\%([a-zA-Z0-9.]\+\)\?$'
173179 let values = border_width_values
174180 elseif vals = ~ ' ^[a-zA-Z0-9.]\+\s\+\%([a-zA-Z]\+\)\?$'
@@ -271,6 +277,7 @@ function! csscomplete#CompleteCSS(findstart, base)
271277 let values = [" nowrap" , " wrap" , " wrap-reverse" ]
272278 elseif prop == ' flex'
273279 let values = [" nowrap" , " wrap" , " wrap-reverse" ] + [" row" , " row-reverse" , " column" , " column-reverse" , " nowrap" , " wrap" , " wrap-reverse" ] + [" auto" , " content" ]
280+ let postfix = " "
274281 elseif prop == ' float'
275282 let values = [" left" , " right" , " none" ]
276283 elseif prop == ' font-family'
@@ -309,6 +316,7 @@ function! csscomplete#CompleteCSS(findstart, base)
309316 let values = [" normal" , " bold" , " bolder" , " lighter" , " 100" , " 200" , " 300" , " 400" , " 500" , " 600" , " 700" , " 800" , " 900" ]
310317 elseif prop == ' font'
311318 let values = [" normal" , " italic" , " oblique" , " small-caps" , " bold" , " bolder" , " lighter" , " 100" , " 200" , " 300" , " 400" , " 500" , " 600" , " 700" , " 800" , " 900" , " xx-small" , " x-small" , " small" , " medium" , " large" , " x-large" , " xx-large" , " larger" , " smaller" , " sans-serif" , " serif" , " monospace" , " cursive" , " fantasy" , " caption" , " icon" , " menu" , " message-box" , " small-caption" , " status-bar" ]
319+ let postfix = " "
312320 elseif prop = ~ ' ^\%(height\|width\)$'
313321 let values = [" auto" , " border-box" , " content-box" , " max-content" , " min-content" , " available" , " fit-content" ]
314322 elseif prop = ~ ' ^\%(left\|rigth\)$'
@@ -566,6 +574,7 @@ function! csscomplete#CompleteCSS(findstart, base)
566574 else
567575 " If no property match it is possible we are outside of {} and
568576 " trying to complete pseudo-(class|element)
577+ let postfix = " "
569578 let element = tolower (matchstr (line , ' \zs[a-zA-Z1-6]*\ze:[^:[:space:]]\{-}$' ))
570579 if stridx (' a,abbr,address,area,article,aside,audio,b,base,bdi,bdo,bgsound,blockquote,body,br,button,canvas,caption,center,cite,code,col,colgroup,command,content,data,datalist,dd,del,details,dfn,dialog,div,dl,dt,element,em,embed,fieldset,figcaption,figure,font,footer,form,frame,frameset,head,header,hgroup,hr,html,i,iframe,image,img,input,ins,isindex,kbd,keygen,label,legend,li,link,main,map,mark,menu,menuitem,meta,meter,nav,nobr,noframes,noscript,object,ol,optgroup,option,output,p,param,picture,pre,progress,q,rp,rt,rtc,ruby,s,samp,script,section,select,shadow,small,source,span,strong,style,sub,summary,sup,table,tbody,td,template,textarea,tfoot,th,thead,time,title,tr,track,u,ul,var,video,wbr' , ' ,' .element.' ,' ) > -1
571580 let values = [" active" , " any" , " any-link" , " blank" , " checked" , " disabled" , " enabled" , " default" , " dir(" , " disabled" , " drop" , " drop(" , " empty" , " enabled" , " first" , " first-child" , " first-of-type" , " fullscreen" , " focus" , " focus-within" , " has(" , " hover" , " indeterminate" , " in-range" , " invalid" , " lang(" , " last-child" , " last-of-type" , " left" , " link" , " matches(" , " not(" , " nth-child(" , " nth-column(" , " nth-last-child(" , " nth-last-column(" , " nth-last-of-type(" , " nth-of-type(" , " only-child" , " only-of-type" , " optional" , " out-of-range" , " paused" , " placeholder-shown" , " playing" , " read-only" , " read-write" , " required" , " right" , " root" , " scope" , " target" , " user-invalid" , " valid" , " visited" , " first-line" , " first-letter" , " before" , " after" , " selection" , " backdrop" ]
@@ -579,10 +588,15 @@ function! csscomplete#CompleteCSS(findstart, base)
579588 let entered_value = matchstr (line , ' .\{-}\zs[a-zA-Z0-9#,.(_-]*$' )
580589
581590 for m in values
591+ let entry = m
592+ if strlen (postfix) && m !~? ' ($'
593+ let entry = {' word' : m . postfix, ' abbr' : m }
594+ endif
595+
582596 if m = ~? ' ^' .entered_value
583- call add (res , m )
597+ call add (res , entry )
584598 elseif m = ~? entered_value
585- call add (res2, m )
599+ call add (res2, entry )
586600 endif
587601 endfor
588602
0 commit comments