Skip to content

Commit 40ec8fc

Browse files
Merge pull request #6 from shezhangzhang/fix/sort
release v0.3.4
2 parents 673b8fe + 46960aa commit 40ec8fc

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "antd-design-token",
33
"displayName": "antd Design Token",
44
"description": "VSCode extension for antd v5 design token.",
5-
"version": "0.3.3",
5+
"version": "0.3.4",
66
"publisher": "shezhangzhang",
77
"engines": {
88
"vscode": "^1.68.0"

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)