tweak opacity modifier completions

master
Brad Cornes 2021-06-04 17:00:27 +01:00
parent cf7bb68e35
commit 388cbb8351
1 changed files with 4 additions and 10 deletions

View File

@ -70,6 +70,7 @@ export function completionsFromClassList(
(context.triggerKind === 2 && context.triggerCharacter === '/')) && (context.triggerKind === 2 && context.triggerCharacter === '/')) &&
partialClassName.includes('/') partialClassName.includes('/')
) { ) {
// opacity modifiers
let beforeSlash = partialClassName.split('/').slice(0, -1).join('/') let beforeSlash = partialClassName.split('/').slice(0, -1).join('/')
let testClass = beforeSlash + '/[0]' let testClass = beforeSlash + '/[0]'
let { rules } = jit.generateRules(state, [testClass]) let { rules } = jit.generateRules(state, [testClass])
@ -94,21 +95,14 @@ export function completionsFromClassList(
} }
return { return {
label: opacity, label: className,
detail: stringifyConfigValue(opacities[opacity]),
documentation, documentation,
kind, kind,
sortText: naturalExpand(index), sortText: naturalExpand(index),
data: [className], data: [className],
textEdit: { textEdit: {
newText: opacity, newText: className,
range: { range: replacementRange,
...replacementRange,
start: {
...replacementRange.start,
character: replacementRange.start.character + beforeSlash.length + 1,
},
},
}, },
} }
}), }),