修复了i18n提示中找不到当前组件的i18n信息的bug,为提示列表提供了更加友好的顺序显示

This commit is contained in:
pqcqaq 2024-10-23 22:05:08 +08:00
parent 00fa81c3d4
commit 7daa599355
2 changed files with 5 additions and 2 deletions

View File

@ -109,13 +109,14 @@ const oakLocalesProvider = vscode.languages.registerCompletionItemProvider(
prefix
);
return localeItems.map((item) => {
return localeItems.map((item, index) => {
const completionItem = new vscode.CompletionItem(
item.label,
vscode.CompletionItemKind.Text
);
completionItem.detail = item.desc;
completionItem.insertText = item.value;
completionItem.sortText = index.toString();
return completionItem;
});
},

View File

@ -262,12 +262,14 @@ const getCachedComponentItems = (path: string): LocaleItem[] => {
* @returns LocaleItem数组
*/
export const getLocalesData = (
path: string,
rawPath: string,
prefix: string = '',
force?: boolean
): LocaleItem[] => {
setLoadingLocale(true);
const path = normalizePath(rawPath);
if (force) {
updatePathCached(path);
}