comparison runtime/autoload/csscomplete.vim @ 7707:41768bcebc9b

commit https://github.com/vim/vim/commit/13d5aeef56e3140a8eb8f40c7062aa1c5700f76e Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jan 21 23:36:05 2016 +0100 Update runtime files
author Christian Brabandt <cb@256bit.org>
date Thu, 21 Jan 2016 23:45:07 +0100
parents 2bf08b6fa352
children 4543777545a3
comparison
equal deleted inserted replaced
7706:dd457970efc8 7707:41768bcebc9b
1 " Vim completion script 1 " Vim completion script
2 " Language: CSS 2.1 2 " Language: CSS
3 " Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl ) 3 " Based on MDN CSS Reference at 2016 Jan <https://developer.mozilla.org/en-US/docs/Web/CSS/Reference>
4 " Last Change: 2007 May 5 4 " plus CSS Speech Module <http://www.w3.org/TR/css3-speech/>
5 5 " Maintainer: Kao, Wei-Ko(othree) ( othree AT gmail DOT com )
6 let s:values = split("azimuth background background-attachment background-color background-image background-position background-repeat border bottom border-collapse border-color border-spacing border-style border-top border-right border-bottom border-left border-top-color border-right-color border-bottom-color border-left-color border-top-style border-right-style border-bottom-style border-left-style border-top-width border-right-width border-bottom-width border-left-width border-width caption-side clear clip color content counter-increment counter-reset cue cue-after cue-before cursor display direction elevation empty-cells float font font-family font-size font-style font-variant font-weight height left letter-spacing line-height list-style list-style-image list-style-position list-style-type margin margin-right margin-left margin-top margin-bottom max-height max-width min-height min-width orphans outline outline-color outline-style outline-width overflow padding padding-top padding-right padding-bottom padding-left page-break-after page-break-before page-break-inside pause pause-after pause-before pitch pitch-range play-during position quotes right richness speak speak-header speak-numeral speak-punctuation speech-rate stress table-layout text-align text-decoration text-indent text-transform top unicode-bidi vertical-align visibility voice-family volume white-space width widows word-spacing z-index") 6 " Original Author: Mikolaj Machowski ( mikmach AT wp DOT pl )
7 " Last Change: 2016 Jan 11
8
9 let s:values = split("all additive-symbols align-content align-items align-self animation animation-delay animation-direction animation-duration animation-fill-mode animation-iteration-count animation-name animation-play-state animation-timing-function backface-visibility background background-attachment background-blend-mode background-clip background-color background-image background-origin background-position background-repeat background-size block-size border border-block-end border-block-end-color border-block-end-style border-block-end-width border-block-start border-block-start-color border-block-start-style border-block-start-width border-bottom border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-collapse border-color border-image border-image-outset border-image-repeat border-image-slice border-image-source border-image-width border-inline-end border-inline-end-color border-inline-end-style border-inline-end-width border-inline-start border-inline-start-color border-inline-start-style border-inline-start-width border-left border-left-color border-left-style border-left-width border-radius border-right border-right-color border-right-style border-right-width border-spacing border-style border-top border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width border-width bottom box-decoration-break box-shadow box-sizing break-after break-before break-inside caption-side clear clip clip-path color columns column-count column-fill column-gap column-rule column-rule-color column-rule-style column-rule-width column-span column-width content counter-increment counter-reset cue cue-before cue-after cursor direction display empty-cells fallback filter flex flex-basis flex-direction flex-flow flex-grow flex-shrink flex-wrap float font font-family font-feature-settings font-kerning font-language-override font-size font-size-adjust font-stretch font-style font-synthesis font-variant font-variant-alternates font-variant-caps font-variant-east-asian font-variant-ligatures font-variant-numeric font-variant-position font-weight grid grid-area grid-auto-columns grid-auto-flow grid-auto-position grid-auto-rows grid-column grid-column-start grid-column-end grid-row grid-row-start grid-row-end grid-template grid-template-areas grid-template-rows grid-template-columns height hyphens image-rendering image-resolution image-orientation ime-mode inline-size isolation justify-content left letter-spacing line-break line-height list-style list-style-image list-style-position list-style-type margin margin-block-end margin-block-start margin-bottom margin-inline-end margin-inline-start margin-left margin-right margin-top marks mask mask-type max-block-size max-height max-inline-size max-width max-zoom min-block-size min-height min-inline-size min-width min-zoom mix-blend-mode negative object-fit object-position offset-block-end offset-block-start offset-inline-end offset-inline-start opacity order orientation orphans outline outline-color outline-offset outline-style outline-width overflow overflow-wrap overflow-x overflow-y pad padding padding-block-end padding-block-start padding-bottom padding-inline-end padding-inline-start padding-left padding-right padding-top page-break-after page-break-before page-break-inside pause-before pause-after pause perspective perspective-origin pointer-events position prefix quotes range resize rest rest-before rest-after right ruby-align ruby-merge ruby-position scroll-behavior scroll-snap-coordinate scroll-snap-destination scroll-snap-points-x scroll-snap-points-y scroll-snap-type scroll-snap-type-x scroll-snap-type-y shape-image-threshold shape-margin shape-outside speak speak-as suffix symbols system table-layout tab-size text-align text-align-last text-combine-upright text-decoration text-decoration-color text-decoration-line text-emphasis text-emphasis-color text-emphasis-position text-emphasis-style text-indent text-orientation text-overflow text-rendering text-shadow text-transform text-underline-position top touch-action transform transform-box transform-origin transform-style transition transition-delay transition-duration transition-property transition-timing-function unicode-bidi unicode-range user-zoom vertical-align visibility voice-balance voice-duration voice-family voice-pitch voice-rate voice-range voice-stress voice-volume white-space widows width will-change word-break word-spacing word-wrap writing-mode z-index zoom")
10
7 11
8 function! csscomplete#CompleteCSS(findstart, base) 12 function! csscomplete#CompleteCSS(findstart, base)
9 13
10 if a:findstart 14 if a:findstart
11 " We need whole line to proper checking 15 " We need whole line to proper checking
12 let line = getline('.') 16 let line = getline('.')
13 let start = col('.') - 1 17 let start = col('.') - 1
14 let compl_begin = col('.') - 2 18 let compl_begin = col('.') - 2
15 while start >= 0 && line[start - 1] =~ '\%(\k\|-\)' 19 while start >= 0 && line[start - 1] =~ '\%(\k\|-\)'
16 let start -= 1 20 let start -= 1
17 endwhile 21 endwhile
18 let b:compl_context = line[0:compl_begin] 22 let b:after = line[compl_begin :]
19 return start 23 let b:compl_context = line[0:compl_begin]
20 endif 24 return start
21 25 endif
22 " There are few chars important for context: 26
23 " ^ ; : { } /* */ 27 " There are few chars important for context:
24 " Where ^ is start of line and /* */ are comment borders 28 " ^ ; : { } /* */
25 " Depending on their relative position to cursor we will know what should 29 " Where ^ is start of line and /* */ are comment borders
26 " be completed. 30 " Depending on their relative position to cursor we will know what should
27 " 1. if nearest are ^ or { or ; current word is property 31 " be completed.
28 " 2. if : it is value (with exception of pseudo things) 32 " 1. if nearest are ^ or { or ; current word is property
29 " 3. if } we are outside of css definitions 33 " 2. if : it is value (with exception of pseudo things)
30 " 4. for comments ignoring is be the easiest but assume they are the same 34 " 3. if } we are outside of css definitions
31 " as 1. 35 " 4. for comments ignoring is be the easiest but assume they are the same
32 " 5. if @ complete at-rule 36 " as 1.
33 " 6. if ! complete important 37 " 5. if @ complete at-rule
34 if exists("b:compl_context") 38 " 6. if ! complete important
35 let line = b:compl_context 39 if exists("b:compl_context")
36 unlet! b:compl_context 40 let line = b:compl_context
37 else 41 let after = b:after
38 let line = a:base 42 unlet! b:compl_context
39 endif 43 else
40 44 let line = a:base
41 let res = [] 45 endif
42 let res2 = [] 46
43 let borders = {} 47 let res = []
44 48 let res2 = []
45 " Check last occurrence of sequence 49 let borders = {}
46 50
47 let openbrace = strridx(line, '{') 51 " Check last occurrence of sequence
48 let closebrace = strridx(line, '}') 52
49 let colon = strridx(line, ':') 53 let openbrace = strridx(line, '{')
50 let semicolon = strridx(line, ';') 54 let closebrace = strridx(line, '}')
51 let opencomm = strridx(line, '/*') 55 let colon = strridx(line, ':')
52 let closecomm = strridx(line, '*/') 56 let semicolon = strridx(line, ';')
53 let style = strridx(line, 'style\s*=') 57 let opencomm = strridx(line, '/*')
54 let atrule = strridx(line, '@') 58 let closecomm = strridx(line, '*/')
55 let exclam = strridx(line, '!') 59 let style = strridx(line, 'style\s*=')
56 60 let atrule = strridx(line, '@')
57 if openbrace > -1 61 let exclam = strridx(line, '!')
58 let borders[openbrace] = "openbrace" 62
59 endif 63 if openbrace > -1
60 if closebrace > -1 64 let borders[openbrace] = "openbrace"
61 let borders[closebrace] = "closebrace" 65 endif
62 endif 66 if closebrace > -1
63 if colon > -1 67 let borders[closebrace] = "closebrace"
64 let borders[colon] = "colon" 68 endif
65 endif 69 if colon > -1
66 if semicolon > -1 70 let borders[colon] = "colon"
67 let borders[semicolon] = "semicolon" 71 endif
68 endif 72 if semicolon > -1
69 if opencomm > -1 73 let borders[semicolon] = "semicolon"
70 let borders[opencomm] = "opencomm" 74 endif
71 endif 75 if opencomm > -1
72 if closecomm > -1 76 let borders[opencomm] = "opencomm"
73 let borders[closecomm] = "closecomm" 77 endif
74 endif 78 if closecomm > -1
75 if style > -1 79 let borders[closecomm] = "closecomm"
76 let borders[style] = "style" 80 endif
77 endif 81 if style > -1
78 if atrule > -1 82 let borders[style] = "style"
79 let borders[atrule] = "atrule" 83 endif
80 endif 84 if atrule > -1
81 if exclam > -1 85 let borders[atrule] = "atrule"
82 let borders[exclam] = "exclam" 86 endif
83 endif 87 if exclam > -1
84 88 let borders[exclam] = "exclam"
85 89 endif
86 if len(borders) == 0 || borders[max(keys(borders))] =~ '^\%(openbrace\|semicolon\|opencomm\|closecomm\|style\)$' 90
87 " Complete properties 91
88 92 if len(borders) == 0 || borders[max(keys(borders))] =~ '^\%(openbrace\|semicolon\|opencomm\|closecomm\|style\)$'
89 93 " Complete properties
90 let entered_property = matchstr(line, '.\{-}\zs[a-zA-Z-]*$') 94
91 95
92 for m in s:values 96 let entered_property = matchstr(line, '.\{-}\zs[a-zA-Z-]*$')
93 if m =~? '^'.entered_property 97
94 call add(res, m . ':') 98 for m in s:values
95 elseif m =~? entered_property 99 if m =~? '^'.entered_property
96 call add(res2, m . ':') 100 call add(res, m . ':')
97 endif 101 elseif m =~? entered_property
98 endfor 102 call add(res2, m . ':')
99 103 endif
100 return res + res2 104 endfor
101 105
102 elseif borders[max(keys(borders))] == 'colon' 106 return res + res2
103 " Get name of property 107
104 let prop = tolower(matchstr(line, '\zs[a-zA-Z-]*\ze\s*:[^:]\{-}$')) 108 elseif borders[max(keys(borders))] == 'colon'
105 109 " Get name of property
106 if prop == 'azimuth' 110 let prop = tolower(matchstr(line, '\zs[a-zA-Z-]*\ze\s*:[^:]\{-}$'))
107 let values = ["left-side", "far-left", "left", "center-left", "center", "center-right", "right", "far-right", "right-side", "behind", "leftwards", "rightwards"] 111
108 elseif prop == 'background-attachment' 112 let wide_keywords = ["initial", "inherit", "unset"]
109 let values = ["scroll", "fixed"] 113 let color_values = ["transparent", "rgb(", "rgba(", "hsl(", "hsla(", "#"]
110 elseif prop == 'background-color' 114 let border_style_values = ["none", "hidden", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"]
111 let values = ["transparent", "rgb(", "#"] 115 let border_width_values = ["thin", "thick", "medium"]
112 elseif prop == 'background-image' 116 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"]
113 let values = ["url(", "none"] 117 let timing_functions = ["cubic-bezier(", "steps(", "linear", "ease", "ease-in", "ease-in-out", "ease-out", "step-start", "step-end"]
114 elseif prop == 'background-position' 118
115 let vals = matchstr(line, '.*:\s*\zs.*') 119 if prop == 'all'
116 if vals =~ '^\%([a-zA-Z]\+\)\?$' 120 let values = []
117 let values = ["top", "center", "bottom"] 121 elseif prop == 'additive-symbols'
118 elseif vals =~ '^[a-zA-Z]\+\s\+\%([a-zA-Z]\+\)\?$' 122 let values = []
119 let values = ["left", "center", "right"] 123 elseif prop == 'align-content'
120 else 124 let values = ["flex-start", "flex-end", "center", "space-between", "space-around", "stretch"]
121 return [] 125 elseif prop == 'align-items'
122 endif 126 let values = ["flex-start", "flex-end", "center", "baseline", "stretch"]
123 elseif prop == 'background-repeat' 127 elseif prop == 'align-self'
124 let values = ["repeat", "repeat-x", "repeat-y", "no-repeat"] 128 let values = ["auto", "flex-start", "flex-end", "center", "baseline", "stretch"]
125 elseif prop == 'background' 129 elseif prop == 'animation'
126 let values = ["url(", "scroll", "fixed", "transparent", "rgb(", "#", "none", "top", "center", "bottom" , "left", "right", "repeat", "repeat-x", "repeat-y", "no-repeat"] 130 let values = timing_functions + ["normal", "reverse", "alternate", "alternate-reverse"] + ["none", "forwards", "backwards", "both"] + ["running", "paused"]
127 elseif prop == 'border-collapse' 131 elseif prop == 'animation-delay'
128 let values = ["collapse", "separate"] 132 let values = []
129 elseif prop == 'border-color' 133 elseif prop == 'animation-direction'
130 let values = ["rgb(", "#", "transparent"] 134 let values = ["normal", "reverse", "alternate", "alternate-reverse"]
131 elseif prop == 'border-spacing' 135 elseif prop == 'animation-duration'
132 return [] 136 let values = []
133 elseif prop == 'border-style' 137 elseif prop == 'animation-fill-mode'
134 let values = ["none", "hidden", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"] 138 let values = ["none", "forwards", "backwards", "both"]
135 elseif prop =~ 'border-\%(top\|right\|bottom\|left\)$' 139 elseif prop == 'animation-iteration-count'
136 let vals = matchstr(line, '.*:\s*\zs.*') 140 let values = []
137 if vals =~ '^\%([a-zA-Z0-9.]\+\)\?$' 141 elseif prop == 'animation-name'
138 let values = ["thin", "thick", "medium"] 142 let values = []
139 elseif vals =~ '^[a-zA-Z0-9.]\+\s\+\%([a-zA-Z]\+\)\?$' 143 elseif prop == 'animation-play-state'
140 let values = ["none", "hidden", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"] 144 let values = ["running", "paused"]
141 elseif vals =~ '^[a-zA-Z0-9.]\+\s\+[a-zA-Z]\+\s\+\%([a-zA-Z(]\+\)\?$' 145 elseif prop == 'animation-timing-function'
142 let values = ["rgb(", "#", "transparent"] 146 let values = timing_functions
143 else 147 elseif prop == 'background-attachment'
144 return [] 148 let values = ["scroll", "fixed"]
145 endif 149 elseif prop == 'background-color'
146 elseif prop =~ 'border-\%(top\|right\|bottom\|left\)-color' 150 let values = color_values
147 let values = ["rgb(", "#", "transparent"] 151 elseif prop == 'background-image'
148 elseif prop =~ 'border-\%(top\|right\|bottom\|left\)-style' 152 let values = ["url(", "none"]
149 let values = ["none", "hidden", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"] 153 elseif prop == 'background-position'
150 elseif prop =~ 'border-\%(top\|right\|bottom\|left\)-width' 154 let vals = matchstr(line, '.*:\s*\zs.*')
151 let values = ["thin", "thick", "medium"] 155 if vals =~ '^\%([a-zA-Z]\+\)\?$'
152 elseif prop == 'border-width' 156 let values = ["top", "center", "bottom"]
153 let values = ["thin", "thick", "medium"] 157 elseif vals =~ '^[a-zA-Z]\+\s\+\%([a-zA-Z]\+\)\?$'
154 elseif prop == 'border' 158 let values = ["left", "center", "right"]
155 let vals = matchstr(line, '.*:\s*\zs.*') 159 else
156 if vals =~ '^\%([a-zA-Z0-9.]\+\)\?$' 160 return []
157 let values = ["thin", "thick", "medium"] 161 endif
158 elseif vals =~ '^[a-zA-Z0-9.]\+\s\+\%([a-zA-Z]\+\)\?$' 162 elseif prop == 'background-repeat'
159 let values = ["none", "hidden", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"] 163 let values = ["repeat", "repeat-x", "repeat-y", "no-repeat"]
160 elseif vals =~ '^[a-zA-Z0-9.]\+\s\+[a-zA-Z]\+\s\+\%([a-zA-Z(]\+\)\?$' 164 elseif prop == 'background-size'
161 let values = ["rgb(", "#", "transparent"] 165 let values = ["auto", "contain", "cover"]
162 else 166 elseif prop == 'background'
163 return [] 167 let values = ["scroll", "fixed"] + color_values + ["url(", "none"] + ["top", "center", "bottom", "left", "right"] + ["repeat", "repeat-x", "repeat-y", "no-repeat"] + ["auto", "contain", "cover"]
164 endif 168 elseif prop =~ 'border\%(-top\|-right\|-bottom\|-left\|-block-start\|-block-end\)\?$'
165 elseif prop == 'bottom' 169 let vals = matchstr(line, '.*:\s*\zs.*')
166 let values = ["auto"] 170 if vals =~ '^\%([a-zA-Z0-9.]\+\)\?$'
167 elseif prop == 'caption-side' 171 let values = border_width_values
168 let values = ["top", "bottom"] 172 elseif vals =~ '^[a-zA-Z0-9.]\+\s\+\%([a-zA-Z]\+\)\?$'
169 elseif prop == 'clear' 173 let values = border_style_values
170 let values = ["none", "left", "right", "both"] 174 elseif vals =~ '^[a-zA-Z0-9.]\+\s\+[a-zA-Z]\+\s\+\%([a-zA-Z(]\+\)\?$'
171 elseif prop == 'clip' 175 let values = color_values
172 let values = ["auto", "rect("] 176 else
173 elseif prop == 'color' 177 return []
174 let values = ["rgb(", "#"] 178 endif
175 elseif prop == 'content' 179 elseif prop =~ 'border-\%(top\|right\|bottom\|left\|block-start\|block-end\)-color'
176 let values = ["normal", "attr(", "open-quote", "close-quote", "no-open-quote", "no-close-quote"] 180 let values = color_values
177 elseif prop =~ 'counter-\%(increment\|reset\)$' 181 elseif prop =~ 'border-\%(top\|right\|bottom\|left\|block-start\|block-end\)-style'
178 let values = ["none"] 182 let values = border_style_values
179 elseif prop =~ '^\%(cue-after\|cue-before\|cue\)$' 183 elseif prop =~ 'border-\%(top\|right\|bottom\|left\|block-start\|block-end\)-width'
180 let values = ["url(", "none"] 184 let values = border_width_values
181 elseif prop == 'cursor' 185 elseif prop == 'border-color'
182 let values = ["url(", "auto", "crosshair", "default", "pointer", "move", "e-resize", "ne-resize", "nw-resize", "n-resize", "se-resize", "sw-resize", "s-resize", "w-resize", "text", "wait", "help", "progress"] 186 let values = color_values
183 elseif prop == 'direction' 187 elseif prop == 'border-style'
184 let values = ["ltr", "rtl"] 188 let values = border_style_values
185 elseif prop == 'display' 189 elseif prop == 'border-width'
186 let values = ["inline", "block", "list-item", "run-in", "inline-block", "table", "inline-table", "table-row-group", "table-header-group", "table-footer-group", "table-row", "table-column-group", "table-column", "table-cell", "table-caption", "none"] 190 let values = border_width_values
187 elseif prop == 'elevation' 191 elseif prop == 'bottom'
188 let values = ["below", "level", "above", "higher", "lower"] 192 let values = ["auto"]
189 elseif prop == 'empty-cells' 193 elseif prop == 'box-decoration-break'
190 let values = ["show", "hide"] 194 let values = ["slice", "clone"]
191 elseif prop == 'float' 195 elseif prop == 'box-shadow'
192 let values = ["left", "right", "none"] 196 let values = ["inset"]
193 elseif prop == 'font-family' 197 elseif prop == 'box-sizing'
194 let values = ["sans-serif", "serif", "monospace", "cursive", "fantasy"] 198 let values = ["border-box", "content-box"]
195 elseif prop == 'font-size' 199 elseif prop =~ 'break-\%(before\|after\)'
196 let values = ["xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large", "larger", "smaller"] 200 let values = ["auto", "always", "avoid", "left", "right", "page", "column", "region", "recto", "verso", "avoid-page", "avoid-column", "avoid-region"]
197 elseif prop == 'font-style' 201 elseif prop == 'break-inside'
198 let values = ["normal", "italic", "oblique"] 202 let values = ["auto", "avoid", "avoid-page", "avoid-column", "avoid-region"]
199 elseif prop == 'font-variant' 203 elseif prop == 'caption-side'
200 let values = ["normal", "small-caps"] 204 let values = ["top", "bottom"]
201 elseif prop == 'font-weight' 205 elseif prop == 'clear'
202 let values = ["normal", "bold", "bolder", "lighter", "100", "200", "300", "400", "500", "600", "700", "800", "900"] 206 let values = ["none", "left", "right", "both"]
203 elseif prop == 'font' 207 elseif prop == 'clip'
204 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"] 208 let values = ["auto", "rect("]
205 elseif prop =~ '^\%(height\|width\)$' 209 elseif prop == 'clip-path'
206 let values = ["auto"] 210 let values = ["fill-box", "stroke-box", "view-box", "none"]
207 elseif prop =~ '^\%(left\|rigth\)$' 211 elseif prop == 'color'
208 let values = ["auto"] 212 let values = color_values
209 elseif prop == 'letter-spacing' 213 elseif prop == 'columns'
210 let values = ["normal"] 214 let values = []
211 elseif prop == 'line-height' 215 elseif prop == 'column-count'
212 let values = ["normal"] 216 let values = ['auto']
213 elseif prop == 'list-style-image' 217 elseif prop == 'column-fill'
214 let values = ["url(", "none"] 218 let values = ['auto', 'balance']
215 elseif prop == 'list-style-position' 219 elseif prop == 'column-rule-color'
216 let values = ["inside", "outside"] 220 let values = color_values
217 elseif prop == 'list-style-type' 221 elseif prop == 'column-rule-style'
218 let values = ["disc", "circle", "square", "decimal", "decimal-leading-zero", "lower-roman", "upper-roman", "lower-latin", "upper-latin", "none"] 222 let values = border_style_values
219 elseif prop == 'list-style' 223 elseif prop == 'column-rule-width'
220 return [] 224 let values = border_width_values
221 elseif prop == 'margin' 225 elseif prop == 'column-rule'
222 let values = ["auto"] 226 let vals = matchstr(line, '.*:\s*\zs.*')
223 elseif prop =~ 'margin-\%(right\|left\|top\|bottom\)$' 227 if vals =~ '^\%([a-zA-Z0-9.]\+\)\?$'
224 let values = ["auto"] 228 let values = border_width_values
225 elseif prop == 'max-height' 229 elseif vals =~ '^[a-zA-Z0-9.]\+\s\+\%([a-zA-Z]\+\)\?$'
226 let values = ["auto"] 230 let values = border_style_values
227 elseif prop == 'max-width' 231 elseif vals =~ '^[a-zA-Z0-9.]\+\s\+[a-zA-Z]\+\s\+\%([a-zA-Z(]\+\)\?$'
228 let values = ["none"] 232 let values = color_values
229 elseif prop == 'min-height' 233 else
230 let values = ["none"] 234 return []
231 elseif prop == 'min-width' 235 endif
232 let values = ["none"] 236 elseif prop == 'column-span'
233 elseif prop == 'orphans' 237 let values = ["none", "all"]
234 return [] 238 elseif prop == 'column-width'
235 elseif prop == 'outline-color' 239 let values = ["auto"]
236 let values = ["rgb(", "#"] 240 elseif prop == 'content'
237 elseif prop == 'outline-style' 241 let values = ["normal", "attr(", "open-quote", "close-quote", "no-open-quote", "no-close-quote"]
238 let values = ["none", "hidden", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"] 242 elseif prop =~ 'counter-\%(increment\|reset\)$'
239 elseif prop == 'outline-width' 243 let values = ["none"]
240 let values = ["thin", "thick", "medium"] 244 elseif prop =~ 'cue\%(-after\|-before\)\=$'
241 elseif prop == 'outline' 245 let values = ["url("]
242 let vals = matchstr(line, '.*:\s*\zs.*') 246 elseif prop == 'cursor'
243 if vals =~ '^\%([a-zA-Z0-9,()#]\+\)\?$' 247 let values = ["url(", "auto", "crosshair", "default", "pointer", "move", "e-resize", "ne-resize", "nw-resize", "n-resize", "se-resize", "sw-resize", "s-resize", "w-resize", "text", "wait", "help", "progress"]
244 let values = ["rgb(", "#"] 248 elseif prop == 'direction'
245 elseif vals =~ '^[a-zA-Z0-9,()#]\+\s\+\%([a-zA-Z]\+\)\?$' 249 let values = ["ltr", "rtl"]
246 let values = ["none", "hidden", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"] 250 elseif prop == 'display'
247 elseif vals =~ '^[a-zA-Z0-9,()#]\+\s\+[a-zA-Z]\+\s\+\%([a-zA-Z(]\+\)\?$' 251 let values = ["inline", "block", "list-item", "inline-list-item", "run-in", "inline-block", "table", "inline-table", "table-row-group", "table-header-group", "table-footer-group", "table-row", "table-column-group", "table-column", "table-cell", "table-caption", "none", "flex", "inline-flex", "grid", "inline-grid", "ruby", "ruby-base", "ruby-text", "ruby-base-container", "ruby-text-container", "contents"]
248 let values = ["thin", "thick", "medium"] 252 elseif prop == 'elevation'
249 else 253 let values = ["below", "level", "above", "higher", "lower"]
250 return [] 254 elseif prop == 'empty-cells'
251 endif 255 let values = ["show", "hide"]
252 elseif prop == 'overflow' 256 elseif prop == 'fallback'
253 let values = ["visible", "hidden", "scroll", "auto"] 257 let values = list_style_type_values
254 elseif prop == 'padding' 258 elseif prop == 'filter'
255 return [] 259 let values = ["blur(", "brightness(", "contrast(", "drop-shadow(", "grayscale(", "hue-rotate(", "invert(", "opacity(", "sepia(", "saturate("]
256 elseif prop =~ 'padding-\%(top\|right\|bottom\|left\)$' 260 elseif prop == 'flex-basis'
257 return [] 261 let values = ["auto", "content"]
258 elseif prop =~ 'page-break-\%(after\|before\)$' 262 elseif prop == 'flex-flow'
259 let values = ["auto", "always", "avoid", "left", "right"] 263 let values = ["row", "row-reverse", "column", "column-reverse", "nowrap", "wrap", "wrap-reverse"]
260 elseif prop == 'page-break-inside' 264 elseif prop == 'flex-grow'
261 let values = ["auto", "avoid"] 265 let values = []
262 elseif prop =~ 'pause-\%(after\|before\)$' 266 elseif prop == 'flex-shrink'
263 return [] 267 let values = []
264 elseif prop == 'pause' 268 elseif prop == 'flex-wrap'
265 return [] 269 let values = ["nowrap", "wrap", "wrap-reverse"]
266 elseif prop == 'pitch-range' 270 elseif prop == 'flex'
267 return [] 271 let values = ["nowrap", "wrap", "wrap-reverse"] + ["row", "row-reverse", "column", "column-reverse", "nowrap", "wrap", "wrap-reverse"] + ["auto", "content"]
268 elseif prop == 'pitch' 272 elseif prop == 'float'
269 let values = ["x-low", "low", "medium", "high", "x-high"] 273 let values = ["left", "right", "none"]
270 elseif prop == 'play-during' 274 elseif prop == 'font-family'
271 let values = ["url(", "mix", "repeat", "auto", "none"] 275 let values = ["sans-serif", "serif", "monospace", "cursive", "fantasy"]
272 elseif prop == 'position' 276 elseif prop == 'font-feature-settings'
273 let values = ["static", "relative", "absolute", "fixed"] 277 let values = ["normal", '"aalt"', '"abvf"', '"abvm"', '"abvs"', '"afrc"', '"akhn"', '"blwf"', '"blwm"', '"blws"', '"calt"', '"case"', '"ccmp"', '"cfar"', '"cjct"', '"clig"', '"cpct"', '"cpsp"', '"cswh"', '"curs"', '"cv', '"c2pc"', '"c2sc"', '"dist"', '"dlig"', '"dnom"', '"dtls"', '"expt"', '"falt"', '"fin2"', '"fin3"', '"fina"', '"flac"', '"frac"', '"fwid"', '"half"', '"haln"', '"halt"', '"hist"', '"hkna"', '"hlig"', '"hngl"', '"hojo"', '"hwid"', '"init"', '"isol"', '"ital"', '"jalt"', '"jp78"', '"jp83"', '"jp90"', '"jp04"', '"kern"', '"lfbd"', '"liga"', '"ljmo"', '"lnum"', '"locl"', '"ltra"', '"ltrm"', '"mark"', '"med2"', '"medi"', '"mgrk"', '"mkmk"', '"mset"', '"nalt"', '"nlck"', '"nukt"', '"numr"', '"onum"', '"opbd"', '"ordn"', '"ornm"', '"palt"', '"pcap"', '"pkna"', '"pnum"', '"pref"', '"pres"', '"pstf"', '"psts"', '"pwid"', '"qwid"', '"rand"', '"rclt"', '"rkrf"', '"rlig"', '"rphf"', '"rtbd"', '"rtla"', '"rtlm"', '"ruby"', '"salt"', '"sinf"', '"size"', '"smcp"', '"smpl"', '"ss01"', '"ss02"', '"ss03"', '"ss04"', '"ss05"', '"ss06"', '"ss07"', '"ss08"', '"ss09"', '"ss10"', '"ss11"', '"ss12"', '"ss13"', '"ss14"', '"ss15"', '"ss16"', '"ss17"', '"ss18"', '"ss19"', '"ss20"', '"ssty"', '"stch"', '"subs"', '"sups"', '"swsh"', '"titl"', '"tjmo"', '"tnam"', '"tnum"', '"trad"', '"twid"', '"unic"', '"valt"', '"vatu"', '"vert"', '"vhal"', '"vjmo"', '"vkna"', '"vkrn"', '"vpal"', '"vrt2"', '"zero"']
274 elseif prop == 'quotes' 278 elseif prop == 'font-kerning'
275 let values = ["none"] 279 let values = ["auto", "normal", "none"]
276 elseif prop == 'richness' 280 elseif prop == 'font-language-override'
277 return [] 281 let values = ["normal"]
278 elseif prop == 'speak-header' 282 elseif prop == 'font-size'
279 let values = ["once", "always"] 283 let values = ["xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large", "larger", "smaller"]
280 elseif prop == 'speak-numeral' 284 elseif prop == 'font-size-adjust'
281 let values = ["digits", "continuous"] 285 let values = []
282 elseif prop == 'speak-punctuation' 286 elseif prop == 'font-stretch'
283 let values = ["code", "none"] 287 let values = ["normal", "ultra-condensed", "extra-condensed", "condensed", "semi-condensed", "semi-expanded", "expanded", "extra-expanded", "ultra-expanded"]
284 elseif prop == 'speak' 288 elseif prop == 'font-style'
285 let values = ["normal", "none", "spell-out"] 289 let values = ["normal", "italic", "oblique"]
286 elseif prop == 'speech-rate' 290 elseif prop == 'font-synthesis'
287 let values = ["x-slow", "slow", "medium", "fast", "x-fast", "faster", "slower"] 291 let values = ["none", "weight", "style"]
288 elseif prop == 'stress' 292 elseif prop == 'font-variant-alternates'
289 return [] 293 let values = ["normal", "historical-forms", "stylistic(", "styleset(", "character-variant(", "swash(", "ornaments(", "annotation("]
290 elseif prop == 'table-layout' 294 elseif prop == 'font-variant-caps'
291 let values = ["auto", "fixed"] 295 let values = ["normal", "small-caps", "all-small-caps", "petite-caps", "all-petite-caps", "unicase", "titling-caps"]
292 elseif prop == 'text-align' 296 elseif prop == 'font-variant-asian'
293 let values = ["left", "right", "center", "justify"] 297 let values = ["normal", "ruby", "jis78", "jis83", "jis90", "jis04", "simplified", "traditional"]
294 elseif prop == 'text-decoration' 298 elseif prop == 'font-variant-ligatures'
295 let values = ["none", "underline", "overline", "line-through", "blink"] 299 let values = ["normal", "none", "common-ligatures", "no-common-ligatures", "discretionary-ligatures", "no-discretionary-ligatures", "historical-ligatures", "no-historical-ligatures", "contextual", "no-contextual"]
296 elseif prop == 'text-indent' 300 elseif prop == 'font-variant-numeric'
297 return [] 301 let values = ["normal", "ordinal", "slashed-zero", "lining-nums", "oldstyle-nums", "proportional-nums", "tabular-nums", "diagonal-fractions", "stacked-fractions"]
298 elseif prop == 'text-transform' 302 elseif prop == 'font-variant-position'
299 let values = ["capitalize", "uppercase", "lowercase", "none"] 303 let values = ["normal", "sub", "super"]
300 elseif prop == 'top' 304 elseif prop == 'font-variant'
301 let values = ["auto"] 305 let values = ["normal", "historical-forms", "stylistic(", "styleset(", "character-variant(", "swash(", "ornaments(", "annotation("] + ["small-caps", "all-small-caps", "petite-caps", "all-petite-caps", "unicase", "titling-caps"] + ["ruby", "jis78", "jis83", "jis90", "jis04", "simplified", "traditional"] + ["none", "common-ligatures", "no-common-ligatures", "discretionary-ligatures", "no-discretionary-ligatures", "historical-ligatures", "no-historical-ligatures", "contextual", "no-contextual"] + ["ordinal", "slashed-zero", "lining-nums", "oldstyle-nums", "proportional-nums", "tabular-nums", "diagonal-fractions", "stacked-fractions"] + ["sub", "super"]
302 elseif prop == 'unicode-bidi' 306 elseif prop == 'font-weight'
303 let values = ["normal", "embed", "bidi-override"] 307 let values = ["normal", "bold", "bolder", "lighter", "100", "200", "300", "400", "500", "600", "700", "800", "900"]
304 elseif prop == 'vertical-align' 308 elseif prop == 'font'
305 let values = ["baseline", "sub", "super", "top", "text-top", "middle", "bottom", "text-bottom"] 309 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"]
306 elseif prop == 'visibility' 310 elseif prop =~ '^\%(height\|width\)$'
307 let values = ["visible", "hidden", "collapse"] 311 let values = ["auto", "border-box", "content-box", "max-content", "min-content", "available", "fit-content"]
308 elseif prop == 'voice-family' 312 elseif prop =~ '^\%(left\|rigth\)$'
309 return [] 313 let values = ["auto"]
310 elseif prop == 'volume' 314 elseif prop == 'image-rendering'
311 let values = ["silent", "x-soft", "soft", "medium", "loud", "x-loud"] 315 let values = ["auto", "crisp-edges", "pixelated"]
312 elseif prop == 'white-space' 316 elseif prop == 'image-orientation'
313 let values = ["normal", "pre", "nowrap", "pre-wrap", "pre-line"] 317 let values = ["from-image", "flip"]
314 elseif prop == 'widows' 318 elseif prop == 'ime-mode'
315 return [] 319 let values = ["auto", "normal", "active", "inactive", "disabled"]
316 elseif prop == 'word-spacing' 320 elseif prop == 'inline-size'
317 let values = ["normal"] 321 let values = ["auto", "border-box", "content-box", "max-content", "min-content", "available", "fit-content"]
318 elseif prop == 'z-index' 322 elseif prop == 'isolation'
319 let values = ["auto"] 323 let values = ["auto", "isolate"]
320 else 324 elseif prop == 'justify-content'
321 " If no property match it is possible we are outside of {} and 325 let values = ["flex-start", "flex-end", "center", "space-between", "space-around"]
322 " trying to complete pseudo-(class|element) 326 elseif prop == 'letter-spacing'
323 let element = tolower(matchstr(line, '\zs[a-zA-Z1-6]*\ze:[^:[:space:]]\{-}$')) 327 let values = ["normal"]
324 if stridx(',a,abbr,acronym,address,area,b,base,bdo,big,blockquote,body,br,button,caption,cite,code,col,colgroup,dd,del,dfn,div,dl,dt,em,fieldset,form,head,h1,h2,h3,h4,h5,h6,hr,html,i,img,input,ins,kbd,label,legend,li,link,map,meta,noscript,object,ol,optgroup,option,p,param,pre,q,samp,script,select,small,span,strong,style,sub,sup,table,tbody,td,textarea,tfoot,th,thead,title,tr,tt,ul,var,', ','.element.',') > -1 328 elseif prop == 'line-break'
325 let values = ["first-child", "link", "visited", "hover", "active", "focus", "lang", "first-line", "first-letter", "before", "after"] 329 let values = ["auto", "loose", "normal", "strict"]
326 else 330 elseif prop == 'line-height'
327 return [] 331 let values = ["normal"]
328 endif 332 elseif prop == 'list-style-image'
329 endif 333 let values = ["url(", "none"]
330 334 elseif prop == 'list-style-position'
331 " Complete values 335 let values = ["inside", "outside"]
332 let entered_value = matchstr(line, '.\{-}\zs[a-zA-Z0-9#,.(_-]*$') 336 elseif prop == 'list-style-type'
333 337 let values = list_style_type_values
334 for m in values 338 elseif prop == 'list-style'
335 if m =~? '^'.entered_value 339 let values = list_style_type_values + ["inside", "outside"] + ["url(", "none"]
336 call add(res, m) 340 elseif prop == 'margin'
337 elseif m =~? entered_value 341 let values = ["auto"]
338 call add(res2, m) 342 elseif prop =~ 'margin-\%(right\|left\|top\|bottom\|block-start\|block-end\|inline-start\|inline-end\)$'
339 endif 343 let values = ["auto"]
340 endfor 344 elseif prop == 'marks'
341 345 let values = ["crop", "cross", "none"]
342 return res + res2 346 elseif prop == 'mask'
343 347 let values = ["url("]
344 elseif borders[max(keys(borders))] == 'closebrace' 348 elseif prop == 'mask-type'
345 349 let values = ["luminance", "alpha"]
346 return [] 350 elseif prop == '\%(max\|min\)-\%(block\|inline\)-size'
347 351 let values = ["auto", "border-box", "content-box", "max-content", "min-content", "available", "fit-content"]
348 elseif borders[max(keys(borders))] == 'exclam' 352 elseif prop == '\%(max\|min\)-\%(height\|width\)'
349 353 let values = ["auto", "border-box", "content-box", "max-content", "min-content", "available", "fit-content"]
350 " Complete values 354 elseif prop == '\%(max\|min\)-zoom'
351 let entered_imp = matchstr(line, '.\{-}!\s*\zs[a-zA-Z ]*$') 355 let values = ["auto"]
352 356 elseif prop == 'mix-blend-mode'
353 let values = ["important"] 357 let values = ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"]
354 358 elseif prop == 'opacity'
355 for m in values 359 let values = []
356 if m =~? '^'.entered_imp 360 elseif prop == 'orientation'
357 call add(res, m) 361 let values = ["auto", "portrait", "landscape"]
358 endif 362 elseif prop == 'orphans'
359 endfor 363 let values = []
360 364 elseif prop == 'outline-offset'
361 return res 365 let values = []
362 366 elseif prop == 'outline-color'
363 elseif borders[max(keys(borders))] == 'atrule' 367 let values = color_values
364 368 elseif prop == 'outline-style'
365 let afterat = matchstr(line, '.*@\zs.*') 369 let values = ["none", "hidden", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"]
366 370 elseif prop == 'outline-width'
367 if afterat =~ '\s' 371 let values = ["thin", "thick", "medium"]
368 372 elseif prop == 'outline'
369 let atrulename = matchstr(line, '.*@\zs[a-zA-Z-]\+\ze') 373 let vals = matchstr(line, '.*:\s*\zs.*')
370 374 if vals =~ '^\%([a-zA-Z0-9,()#]\+\)\?$'
371 if atrulename == 'media' 375 let values = color_values
372 let values = ["screen", "tty", "tv", "projection", "handheld", "print", "braille", "aural", "all"] 376 elseif vals =~ '^[a-zA-Z0-9,()#]\+\s\+\%([a-zA-Z]\+\)\?$'
373 377 let values = ["none", "hidden", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"]
374 let entered_atruleafter = matchstr(line, '.*@media\s\+\zs.*$') 378 elseif vals =~ '^[a-zA-Z0-9,()#]\+\s\+[a-zA-Z]\+\s\+\%([a-zA-Z(]\+\)\?$'
375 379 let values = ["thin", "thick", "medium"]
376 elseif atrulename == 'import' 380 else
377 let entered_atruleafter = matchstr(line, '.*@import\s\+\zs.*$') 381 return []
378 382 endif
379 if entered_atruleafter =~ "^[\"']" 383 elseif prop == 'overflow-wrap'
380 let filestart = matchstr(entered_atruleafter, '^.\zs.*') 384 let values = ["normal", "break-word"]
381 let files = split(glob(filestart.'*'), '\n') 385 elseif prop =~ 'overflow\%(-x\|-y\)\='
382 let values = map(copy(files), '"\"".v:val') 386 let values = ["visible", "hidden", "scroll", "auto"]
383 387 elseif prop == 'pad'
384 elseif entered_atruleafter =~ "^url(" 388 let values = []
385 let filestart = matchstr(entered_atruleafter, "^url([\"']\\?\\zs.*") 389 elseif prop == 'padding'
386 let files = split(glob(filestart.'*'), '\n') 390 let values = []
387 let values = map(copy(files), '"url(".v:val') 391 elseif prop =~ 'padding-\%(top\|right\|bottom\|left\|inline-start\|inline-end\|block-start\|block-end\)$'
388 392 let values = []
389 else 393 elseif prop =~ 'page-break-\%(after\|before\)$'
390 let values = ['"', 'url('] 394 let values = ["auto", "always", "avoid", "left", "right", "recto", "verso"]
391 395 elseif prop == 'page-break-inside'
392 endif 396 let values = ["auto", "avoid"]
393 397 elseif prop =~ 'pause\%(-after\|-before\)\=$'
394 else 398 let values = ["none", "x-weak", "weak", "medium", "strong", "x-strong"]
395 return [] 399 elseif prop == 'perspective'
396 400 let values = ["none"]
397 endif 401 elseif prop == 'perspective-origin'
398 402 let values = ["top", "bottom", "left", "center", " right"]
399 for m in values 403 elseif prop == 'pointer-events'
400 if m =~? '^'.entered_atruleafter 404 let values = ["auto", "none", "visiblePainted", "visibleFill", "visibleStroke", "visible", "painted", "fill", "stroke", "all"]
401 call add(res, m) 405 elseif prop == 'position'
402 elseif m =~? entered_atruleafter 406 let values = ["static", "relative", "absolute", "fixed", "sticky"]
403 call add(res2, m) 407 elseif prop == 'prefix'
404 endif 408 let values = []
405 endfor 409 elseif prop == 'quotes'
406 410 let values = ["none"]
407 return res + res2 411 elseif prop == 'range'
408 412 let values = ["auto", "infinite"]
409 endif 413 elseif prop == 'resize'
410 414 let values = ["none", "both", "horizontal", "vertical"]
411 let values = ["charset", "page", "media", "import", "font-face"] 415 elseif prop =~ 'rest\%(-after\|-before\)\=$'
412 416 let values = ["none", "x-weak", "weak", "medium", "strong", "x-strong"]
413 let entered_atrule = matchstr(line, '.*@\zs[a-zA-Z-]*$') 417 elseif prop == 'ruby-align'
414 418 let values = ["start", "center", "space-between", "space-around"]
415 for m in values 419 elseif prop == 'ruby-merge'
416 if m =~? '^'.entered_atrule 420 let values = ["separate", "collapse", "auto"]
417 call add(res, m .' ') 421 elseif prop == 'ruby-position'
418 elseif m =~? entered_atrule 422 let values = ["over", "under", "inter-character"]
419 call add(res2, m .' ') 423 elseif prop == 'scroll-behavior'
420 endif 424 let values = ["auto", "smooth"]
421 endfor 425 elseif prop == 'scroll-snap-coordinate'
422 426 let values = ["none"]
423 return res + res2 427 elseif prop == 'scroll-snap-destination'
424 428 return []
425 endif 429 elseif prop == 'scroll-snap-points-\%(x\|y\)$'
426 430 let values = ["none", "repeat("]
427 return [] 431 elseif prop == 'scroll-snap-type\%(-x\|-y\)\=$'
432 let values = ["none", "mandatory", "proximity"]
433 elseif prop == 'shape-image-threshold'
434 let values = []
435 elseif prop == 'shape-margin'
436 let values = []
437 elseif prop == 'shape-outside'
438 let values = ["margin-box", "border-box", "padding-box", "content-box", 'inset(', 'circle(', 'ellipse(', 'polygon(', 'url(']
439 elseif prop == 'speak'
440 let values = ["auto", "none", "normal"]
441 elseif prop == 'speak-as'
442 let values = ["auto", "normal", "spell-out", "digits"]
443 elseif prop == 'src'
444 let values = ["url("]
445 elseif prop == 'suffix'
446 let values = []
447 elseif prop == 'symbols'
448 let values = []
449 elseif prop == 'system'
450 let vals = matchstr(line, '.*:\s*\zs.*')
451 if vals =~ '^extends'
452 let values = list_style_type_values
453 else
454 let values = ["cyclic", "numeric", "alphabetic", "symbolic", "additive", "fixed", "extends"]
455 endif
456 elseif prop == 'table-layout'
457 let values = ["auto", "fixed"]
458 elseif prop == 'tab-size'
459 let values = []
460 elseif prop == 'text-align'
461 let values = ["start", "end", "left", "right", "center", "justify", "match-parent"]
462 elseif prop == 'text-align-last'
463 let values = ["auto", "start", "end", "left", "right", "center", "justify"]
464 elseif prop == 'text-combine-upright'
465 let values = ["none", "all", "digits"]
466 elseif prop == 'text-decoration-line'
467 let values = ["none", "underline", "overline", "line-through", "blink"]
468 elseif prop == 'text-decoration-color'
469 let values = color_values
470 elseif prop == 'text-decoration-style'
471 let values = ["solid", "double", "dotted", "dashed", "wavy"]
472 elseif prop == 'text-decoration'
473 let values = ["none", "underline", "overline", "line-through", "blink"] + ["solid", "double", "dotted", "dashed", "wavy"] + color_values
474 elseif prop == 'text-emphasis-color'
475 let values = color_values
476 elseif prop == 'text-emphasis-position'
477 let values = ["over", "under", "left", "right"]
478 elseif prop == 'text-emphasis-style'
479 let values = ["none", "filled", "open", "dot", "circle", "double-circle", "triangle", "sesame"]
480 elseif prop == 'text-emphasis'
481 let values = color_values + ["over", "under", "left", "right"] + ["none", "filled", "open", "dot", "circle", "double-circle", "triangle", "sesame"]
482 elseif prop == 'text-indent'
483 let values = ["hanging", "each-line"]
484 elseif prop == 'text-orientation'
485 let values = ["mixed", "upright", "sideways", "sideways-right", "use-glyph-orientation"]
486 elseif prop == 'text-overflow'
487 let values = ["clip", "ellipsis"]
488 elseif prop == 'text-rendering'
489 let values = ["auto", "optimizeSpeed", "optimizeLegibility", "geometricPrecision"]
490 elseif prop == 'text-shadow'
491 let values = color_values
492 elseif prop == 'text-transform'
493 let values = ["capitalize", "uppercase", "lowercase", "full-width", "none"]
494 elseif prop == 'text-underline-position'
495 let values = ["auto", "under", "left", "right"]
496 elseif prop == 'touch-action'
497 let values = ["auto", "none", "pan-x", "pan-y", "manipulation", "pan-left", "pan-right", "pan-top", "pan-down"]
498 elseif prop == 'transform'
499 let values = ["matrix(", "translate(", "translateX(", "translateY(", "scale(", "scaleX(", "scaleY(", "rotate(", "skew(", "skewX(", "skewY(", "matrix3d(", "translate3d(", "translateZ(", "scale3d(", "scaleZ(", "rotate3d(", "rotateX(", "rotateY(", "rotateZ(", "perspective("]
500 elseif prop == 'transform-box'
501 let values = ["border-box", "fill-box", "view-box"]
502 elseif prop == 'transform-origin'
503 let values = ["left", "center", "right", "top", "bottom"]
504 elseif prop == 'transform-style'
505 let values = ["flat", "preserve-3d"]
506 elseif prop == 'top'
507 let values = ["auto"]
508 elseif prop == 'transition-property'
509 let values = ["all", "none"] + s:values
510 elseif prop == 'transition-duration'
511 let values = []
512 elseif prop == 'transition-delay'
513 let values = []
514 elseif prop == 'transition-timing-function'
515 let values = timing_functions
516 elseif prop == 'transition'
517 let values = ["all", "none"] + s:values + timing_functions
518 elseif prop == 'unicode-bidi'
519 let values = ["normal", "embed", "isolate", "bidi-override", "isolate-override", "plaintext"]
520 elseif prop == 'unicode-range'
521 let values = ["U+"]
522 elseif prop == 'user-zoom'
523 let values = ["zoom", "fixed"]
524 elseif prop == 'vertical-align'
525 let values = ["baseline", "sub", "super", "top", "text-top", "middle", "bottom", "text-bottom"]
526 elseif prop == 'visibility'
527 let values = ["visible", "hidden", "collapse"]
528 elseif prop == 'voice-volume'
529 let values = ["silent", "x-soft", "soft", "medium", "loud", "x-loud"]
530 elseif prop == 'voice-balance'
531 let values = ["left", "center", "right", "leftwards", "rightwards"]
532 elseif prop == 'voice-family'
533 let values = []
534 elseif prop == 'voice-rate'
535 let values = ["normal", "x-slow", "slow", "medium", "fast", "x-fast"]
536 elseif prop == 'voice-pitch'
537 let values = ["absolute", "x-low", "low", "medium", "high", "x-high"]
538 elseif prop == 'voice-range'
539 let values = ["absolute", "x-low", "low", "medium", "high", "x-high"]
540 elseif prop == 'voice-stress'
541 let values = ["normal", "strong", "moderate", "none", "reduced "]
542 elseif prop == 'voice-duration'
543 let values = ["auto"]
544 elseif prop == 'white-space'
545 let values = ["normal", "pre", "nowrap", "pre-wrap", "pre-line"]
546 elseif prop == 'widows'
547 let values = []
548 elseif prop == 'will-change'
549 let values = ["auto", "scroll-position", "contents"] + s:values
550 elseif prop == 'word-break'
551 let values = ["normal", "break-all", "keep-all"]
552 elseif prop == 'word-spacing'
553 let values = ["normal"]
554 elseif prop == 'word-wrap'
555 let values = ["normal", "break-word"]
556 elseif prop == 'writing-mode'
557 let values = ["horizontal-tb", "vertical-rl", "vertical-lr", "sideways-rl", "sideways-lr"]
558 elseif prop == 'z-index'
559 let values = ["auto"]
560 elseif prop == 'zoom'
561 let values = ["auto"]
562 else
563 " If no property match it is possible we are outside of {} and
564 " trying to complete pseudo-(class|element)
565 let element = tolower(matchstr(line, '\zs[a-zA-Z1-6]*\ze:[^:[:space:]]\{-}$'))
566 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
567 let values = ["active", "any", "checked", "default", "dir(", "disabled", "empty", "enabled", "first", "first-child", "first-of-type", "fullscreen", "focus", "hover", "indeterminate", "in-range", "invalid", "lang(", "last-child", "last-of-type", "left", "link", "not(", "nth-child(", "nth-last-child(", "nth-last-of-type(", "nth-of-type(", "only-child", "only-of-type", "optional", "out-of-range", "read-only", "read-write", "required", "right", "root", "scope", "target", "valid", "visited", "first-line", "first-letter", "before", "after", "selection", "backdrop"]
568 else
569 return []
570 endif
571 endif
572
573 let values = wide_keywords + values
574 " Complete values
575 let entered_value = matchstr(line, '.\{-}\zs[a-zA-Z0-9#,.(_-]*$')
576
577 for m in values
578 if m =~? '^'.entered_value
579 call add(res, m)
580 elseif m =~? entered_value
581 call add(res2, m)
582 endif
583 endfor
584
585 return res + res2
586
587 elseif borders[max(keys(borders))] == 'closebrace'
588
589 return []
590
591 elseif borders[max(keys(borders))] == 'exclam'
592
593 " Complete values
594 let entered_imp = matchstr(line, '.\{-}!\s*\zs[a-zA-Z ]*$')
595
596 let values = ["important"]
597
598 for m in values
599 if m =~? '^'.entered_imp
600 call add(res, m)
601 endif
602 endfor
603
604 return res
605
606 elseif borders[max(keys(borders))] == 'atrule'
607
608 let afterat = matchstr(line, '.*@\zs.*')
609
610 if afterat =~ '\s'
611
612 let atrulename = matchstr(line, '.*@\zs[a-zA-Z-]\+\ze')
613
614 if atrulename == 'media'
615 let entered_atruleafter = matchstr(line, '.*@media\s\+\zs.*$')
616
617 if entered_atruleafter =~ "([^)]*$"
618 let entered_atruleafter = matchstr(entered_atruleafter, '(\s*\zs[^)]*$')
619 let values = ["max-width", "min-width", "width", "max-height", "min-height", "height", "max-aspect-ration", "min-aspect-ration", "aspect-ratio", "orientation", "max-resolution", "min-resolution", "resolution", "scan", "grid", "update-frequency", "overflow-block", "overflow-inline", "max-color", "min-color", "color", "max-color-index", "min-color-index", "color-index", "monochrome", "inverted-colors", "pointer", "hover", "any-pointer", "any-hover", "light-level", "scripting"]
620 else
621 let values = ["screen", "print", "speech", "all", "not", "and", "("]
622 endif
623
624 elseif atrulename == 'supports'
625 let entered_atruleafter = matchstr(line, '.*@supports\s\+\zs.*$')
626
627 if entered_atruleafter =~ "([^)]*$"
628 let entered_atruleafter = matchstr(entered_atruleafter, '(\s*\zs.*$')
629 let values = s:values
630 else
631 let values = ["("]
632 endif
633
634 elseif atrulename == 'charset'
635 let entered_atruleafter = matchstr(line, '.*@charset\s\+\zs.*$')
636 let values = [
637 \ '"UTF-8";', '"ANSI_X3.4-1968";', '"ISO_8859-1:1987";', '"ISO_8859-2:1987";', '"ISO_8859-3:1988";', '"ISO_8859-4:1988";', '"ISO_8859-5:1988";',
638 \ '"ISO_8859-6:1987";', '"ISO_8859-7:1987";', '"ISO_8859-8:1988";', '"ISO_8859-9:1989";', '"ISO-8859-10";', '"ISO_6937-2-add";', '"JIS_X0201";',
639 \ '"JIS_Encoding";', '"Shift_JIS";', '"Extended_UNIX_Code_Packed_Format_for_Japanese";', '"Extended_UNIX_Code_Fixed_Width_for_Japanese";',
640 \ '"BS_4730";', '"SEN_850200_C";', '"IT";', '"ES";', '"DIN_66003";', '"NS_4551-1";', '"NF_Z_62-010";', '"ISO-10646-UTF-1";', '"ISO_646.basic:1983";',
641 \ '"INVARIANT";', '"ISO_646.irv:1983";', '"NATS-SEFI";', '"NATS-SEFI-ADD";', '"NATS-DANO";', '"NATS-DANO-ADD";', '"SEN_850200_B";', '"KS_C_5601-1987";',
642 \ '"ISO-2022-KR";', '"EUC-KR";', '"ISO-2022-JP";', '"ISO-2022-JP-2";', '"JIS_C6220-1969-jp";', '"JIS_C6220-1969-ro";', '"PT";', '"greek7-old";',
643 \ '"latin-greek";', '"NF_Z_62-010_(1973)";', '"Latin-greek-1";', '"ISO_5427";', '"JIS_C6226-1978";', '"BS_viewdata";', '"INIS";', '"INIS-8";',
644 \ '"INIS-cyrillic";', '"ISO_5427:1981";', '"ISO_5428:1980";', '"GB_1988-80";', '"GB_2312-80";', '"NS_4551-2";', '"videotex-suppl";', '"PT2";',
645 \ '"ES2";', '"MSZ_7795.3";', '"JIS_C6226-1983";', '"greek7";', '"ASMO_449";', '"iso-ir-90";', '"JIS_C6229-1984-a";', '"JIS_C6229-1984-b";',
646 \ '"JIS_C6229-1984-b-add";', '"JIS_C6229-1984-hand";', '"JIS_C6229-1984-hand-add";', '"JIS_C6229-1984-kana";', '"ISO_2033-1983";',
647 \ '"ANSI_X3.110-1983";', '"T.61-7bit";', '"T.61-8bit";', '"ECMA-cyrillic";', '"CSA_Z243.4-1985-1";', '"CSA_Z243.4-1985-2";', '"CSA_Z243.4-1985-gr";',
648 \ '"ISO_8859-6-E";', '"ISO_8859-6-I";', '"T.101-G2";', '"ISO_8859-8-E";', '"ISO_8859-8-I";', '"CSN_369103";', '"JUS_I.B1.002";', '"IEC_P27-1";',
649 \ '"JUS_I.B1.003-serb";', '"JUS_I.B1.003-mac";', '"greek-ccitt";', '"NC_NC00-10:81";', '"ISO_6937-2-25";', '"GOST_19768-74";', '"ISO_8859-supp";',
650 \ '"ISO_10367-box";', '"latin-lap";', '"JIS_X0212-1990";', '"DS_2089";', '"us-dk";', '"dk-us";', '"KSC5636";', '"UNICODE-1-1-UTF-7";', '"ISO-2022-CN";',
651 \ '"ISO-2022-CN-EXT";', '"ISO-8859-13";', '"ISO-8859-14";', '"ISO-8859-15";', '"ISO-8859-16";', '"GBK";', '"GB18030";', '"OSD_EBCDIC_DF04_15";',
652 \ '"OSD_EBCDIC_DF03_IRV";', '"OSD_EBCDIC_DF04_1";', '"ISO-11548-1";', '"KZ-1048";', '"ISO-10646-UCS-2";', '"ISO-10646-UCS-4";', '"ISO-10646-UCS-Basic";',
653 \ '"ISO-10646-Unicode-Latin1";', '"ISO-10646-J-1";', '"ISO-Unicode-IBM-1261";', '"ISO-Unicode-IBM-1268";', '"ISO-Unicode-IBM-1276";',
654 \ '"ISO-Unicode-IBM-1264";', '"ISO-Unicode-IBM-1265";', '"UNICODE-1-1";', '"SCSU";', '"UTF-7";', '"UTF-16BE";', '"UTF-16LE";', '"UTF-16";', '"CESU-8";',
655 \ '"UTF-32";', '"UTF-32BE";', '"UTF-32LE";', '"BOCU-1";', '"ISO-8859-1-Windows-3.0-Latin-1";', '"ISO-8859-1-Windows-3.1-Latin-1";',
656 \ '"ISO-8859-2-Windows-Latin-2";', '"ISO-8859-9-Windows-Latin-5";', '"hp-roman8";', '"Adobe-Standard-Encoding";', '"Ventura-US";',
657 \ '"Ventura-International";', '"DEC-MCS";', '"IBM850";', '"PC8-Danish-Norwegian";', '"IBM862";', '"PC8-Turkish";', '"IBM-Symbols";', '"IBM-Thai";',
658 \ '"HP-Legal";', '"HP-Pi-font";', '"HP-Math8";', '"Adobe-Symbol-Encoding";', '"HP-DeskTop";', '"Ventura-Math";', '"Microsoft-Publishing";',
659 \ '"Windows-31J";', '"GB2312";', '"Big5";', '"macintosh";', '"IBM037";', '"IBM038";', '"IBM273";', '"IBM274";', '"IBM275";', '"IBM277";', '"IBM278";',
660 \ '"IBM280";', '"IBM281";', '"IBM284";', '"IBM285";', '"IBM290";', '"IBM297";', '"IBM420";', '"IBM423";', '"IBM424";', '"IBM437";', '"IBM500";', '"IBM851";',
661 \ '"IBM852";', '"IBM855";', '"IBM857";', '"IBM860";', '"IBM861";', '"IBM863";', '"IBM864";', '"IBM865";', '"IBM868";', '"IBM869";', '"IBM870";', '"IBM871";',
662 \ '"IBM880";', '"IBM891";', '"IBM903";', '"IBM904";', '"IBM905";', '"IBM918";', '"IBM1026";', '"EBCDIC-AT-DE";', '"EBCDIC-AT-DE-A";', '"EBCDIC-CA-FR";',
663 \ '"EBCDIC-DK-NO";', '"EBCDIC-DK-NO-A";', '"EBCDIC-FI-SE";', '"EBCDIC-FI-SE-A";', '"EBCDIC-FR";', '"EBCDIC-IT";', '"EBCDIC-PT";', '"EBCDIC-ES";',
664 \ '"EBCDIC-ES-A";', '"EBCDIC-ES-S";', '"EBCDIC-UK";', '"EBCDIC-US";', '"UNKNOWN-8BIT";', '"MNEMONIC";', '"MNEM";', '"VISCII";', '"VIQR";', '"KOI8-R";',
665 \ '"HZ-GB-2312";', '"IBM866";', '"IBM775";', '"KOI8-U";', '"IBM00858";', '"IBM00924";', '"IBM01140";', '"IBM01141";', '"IBM01142";', '"IBM01143";',
666 \ '"IBM01144";', '"IBM01145";', '"IBM01146";', '"IBM01147";', '"IBM01148";', '"IBM01149";', '"Big5-HKSCS";', '"IBM1047";', '"PTCP154";', '"Amiga-1251";',
667 \ '"KOI7-switched";', '"BRF";', '"TSCII";', '"windows-1250";', '"windows-1251";', '"windows-1252";', '"windows-1253";', '"windows-1254";', '"windows-1255";',
668 \ '"windows-1256";', '"windows-1257";', '"windows-1258";', '"TIS-620";']
669
670 elseif atrulename == 'namespace'
671 let entered_atruleafter = matchstr(line, '.*@namespace\s\+\zs.*$')
672 let values = ["url("]
673
674 elseif atrulename == 'document'
675 let entered_atruleafter = matchstr(line, '.*@document\s\+\zs.*$')
676 let values = ["url(", "url-prefix(", "domain(", "regexp("]
677
678 elseif atrulename == 'import'
679 let entered_atruleafter = matchstr(line, '.*@import\s\+\zs.*$')
680
681 if entered_atruleafter =~ "^[\"']"
682 let filestart = matchstr(entered_atruleafter, '^.\zs.*')
683 let files = split(glob(filestart.'*'), '\n')
684 let values = map(copy(files), '"\"".v:val')
685
686 elseif entered_atruleafter =~ "^url("
687 let filestart = matchstr(entered_atruleafter, "^url([\"']\\?\\zs.*")
688 let files = split(glob(filestart.'*'), '\n')
689 let values = map(copy(files), '"url(".v:val')
690
691 else
692 let values = ['"', 'url(']
693
694 endif
695
696 else
697 return []
698
699 endif
700
701 for m in values
702 if m =~? '^'.entered_atruleafter
703 if entered_atruleafter =~? '^"' && m =~? '^"'
704 let m = m[1:]
705 endif
706 if b:after =~? '"' && stridx(m, '"') > -1
707 let m = m[0:stridx(m, '"')-1]
708 endif
709 call add(res, m)
710 elseif m =~? entered_atruleafter
711 if m =~? '^"'
712 let m = m[1:]
713 endif
714 call add(res2, m)
715 endif
716 endfor
717
718 return res + res2
719
720 endif
721
722 let values = ["charset", "page", "media", "import", "font-face", "namespace", "supports", "keyframes", "viewport", "document"]
723
724 let entered_atrule = matchstr(line, '.*@\zs[a-zA-Z-]*$')
725
726 for m in values
727 if m =~? '^'.entered_atrule
728 call add(res, m .' ')
729 elseif m =~? entered_atrule
730 call add(res2, m .' ')
731 endif
732 endfor
733
734 return res + res2
735
736 endif
737
738 return []
428 739
429 endfunction 740 endfunction