Skip to content

Commit 3f3f62a

Browse files
committed
fix: fix color sort
1 parent 673b8fe commit 3f3f62a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/typing.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,16 @@ export default function setupAntdTokenCompletion(
1717
const items: any[] | undefined = [];
1818

1919
for (let key in fullToken) {
20-
const value = String(fullToken[key as keyof typeof fullToken]);
20+
let value = fullToken[key as keyof typeof fullToken];
2121
const item = new vscode.CompletionItem(`antd-${key}: ${value}`, 11);
2222
item.insertText = key.includes("-") ? `['${key}']` : key;
2323

24-
const sortValue = value.padStart(5, "0");
25-
item.sortText = `a-${sortValue}-${key}`;
24+
if (typeof value === "number") {
25+
const sortValue = String(value).padStart(5, "0");
26+
item.sortText = `a-${sortValue}-${key}`;
27+
} else {
28+
item.sortText = `a-${key}`;
29+
}
2630

2731
const colorSpan = genMarkdownString(value);
2832
let documentContent: vscode.MarkdownString | string = "";

0 commit comments

Comments
 (0)