修复了查找key的问题,将hover的提示改为显示中文信息
This commit is contained in:
parent
7d123427cb
commit
d601a9dae9
|
|
@ -60,7 +60,9 @@ class LocaleDocumentLinkProvider implements vscode.DocumentLinkProvider {
|
|||
range,
|
||||
vscode.Uri.file(filePath)
|
||||
);
|
||||
documentLink.tooltip = '点击跳转到定义';
|
||||
documentLink.tooltip = localePath.desc
|
||||
? `CN: ${localePath.desc}`
|
||||
: `[未找到中文] 跳转到定义`;
|
||||
documentLinks.push(documentLink);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ export const findValueByKey = (
|
|||
* @param key key
|
||||
* @returns 返回一个string
|
||||
*/
|
||||
export const getLocaleItem = (key: string): LocaleItem | undefined => {
|
||||
const getLocaleItem = (key: string): LocaleItem | undefined => {
|
||||
// 如果是namespace,则为xxxx::开头
|
||||
if (key.includes('::')) {
|
||||
// 从cachedLocaleItems中找到对应的值
|
||||
|
|
@ -186,8 +186,10 @@ const getNamespacedLocaleItems = (
|
|||
label: key,
|
||||
value: key,
|
||||
desc:
|
||||
findValueByKey(locales.namespaced[namespaceName], key) ||
|
||||
'',
|
||||
findValueByKey(
|
||||
locales.namespaced[namespaceName],
|
||||
key.split('::')[1]
|
||||
) || '',
|
||||
path: join(pathConfig.localesHome, namespaceName),
|
||||
};
|
||||
}),
|
||||
|
|
@ -211,7 +213,11 @@ const getEntityLocaleItems = (
|
|||
return {
|
||||
label: key,
|
||||
value: key,
|
||||
desc: findValueByKey(locales.entities[name], key) || '',
|
||||
desc:
|
||||
findValueByKey(
|
||||
locales.entities[name],
|
||||
key.split(':')[1]
|
||||
) || '',
|
||||
path: getEntityLocalePath(key.split(':')[0]),
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue