Rename completions and remove color information (#5662)

This commit is contained in:
Brad Cornes 2021-10-01 09:41:27 +01:00 • committed by GitHub
parent 84db333d46
commit ba9d177891
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 40 deletions

View file

@ -631,27 +631,17 @@ function registerPlugins(plugins, context) {
return output.map((value) => ({ raw: value, extension: 'html' }))
}
// Generate a list of strings for autocompletion purposes. Colors will have a
// tuple with options, e.g.:
// ['uppercase', 'lowercase', ['bg-red', { color: 'rgb(255 0 0)' }]]
context.completions = function () {
// TODO: Try and detect color from components?
// TODO: Should we provide a simple "public api" file with functions?
// Generate a list of strings for autocompletion purposes, e.g.
// ['uppercase', 'lowercase', ...]
context.getClassList = function () {
let output = []
for (let util of classList) {
if (Array.isArray(util)) {
let [utilName, options] = util
let isColor = [].concat(options.type).includes('color')
if (isColor) {
for (let [value, color] of Object.entries(options?.values ?? {})) {
output.push([formatClass(utilName, value), { color }])
}
} else {
for (let value of Object.keys(options?.values ?? {})) {
output.push(formatClass(utilName, value))
}
for (let value of Object.keys(options?.values ?? {})) {
output.push(formatClass(utilName, value))
}
} else {
output.push(util)