Skip to content

Commit 9275ea2

Browse files
perf: improve color completions
close #97
1 parent 34ae9ff commit 9275ea2

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

src/lib/core.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,25 @@ export async function init(): Promise<Core> {
6262
staticCompletions = staticCompletions.concat(complections);
6363
break;
6464
case '${color}':
65+
// const colorConfig = flatColors(processor.theme(config, colors) as any);
66+
// for (const [k, v] of Object.entries(colorConfig)) {
67+
// const name = `${prefix}-${k}`;
68+
// console.log(name)
69+
// const color = Array.isArray(v) ? v[0] : v;
70+
// colorCompletions.push({
71+
// label: name,
72+
// detail: processor.interpret(name).styleSheet.build(),
73+
// documentation: ['transparent', 'currentColor'].includes(color) ? color : `rgb(${hex2RGB(color)?.join(', ')})`,
74+
// });
75+
// }
6576
const colorConfig = flatColors(processor.theme(config, colors) as any);
66-
for (const [k, v] of Object.entries(colorConfig)) {
77+
for (const [k, v] of Object.entries(colors)) {
6778
const name = `${prefix}-${k}`;
6879
const color = Array.isArray(v) ? v[0] : v;
6980
colorCompletions.push({
7081
label: name,
71-
detail: processor.interpret(name).styleSheet.build(),
82+
// detail stylesheet interpret is hidden due to performance issues, TODO: workaround with an cache
83+
detail: "",
7284
documentation: ['transparent', 'currentColor'].includes(color) ? color : `rgb(${hex2RGB(color)?.join(', ')})`,
7385
});
7486
}

0 commit comments

Comments
 (0)