名称添加中文
This commit is contained in:
parent
993a7f6b26
commit
6773b16420
|
|
@ -1,6 +1,7 @@
|
|||
import * as vscode from 'vscode';
|
||||
import {
|
||||
entityConfig,
|
||||
getEntityName,
|
||||
getProjectEntityList,
|
||||
subscribe,
|
||||
} from '../utils/entities';
|
||||
|
|
@ -140,7 +141,10 @@ export class EntityItem extends TreeItem {
|
|||
public readonly label: string,
|
||||
public readonly collapsibleState: vscode.TreeItemCollapsibleState
|
||||
) {
|
||||
super(label, collapsibleState, label);
|
||||
const name = getEntityName(label);
|
||||
const labelWithZhCN = name ? label + ` (${name})` : label;
|
||||
super(labelWithZhCN, collapsibleState, label);
|
||||
this.label = labelWithZhCN; // 不知道为什么,上面的super方法不生效,所以这里再设置一次
|
||||
this.contextValue = 'entityItem'; // 添加这行,用于识别右键菜单项
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -522,6 +522,10 @@ export const syncProjectEntityList = () => {
|
|||
updateProjectEntityList(entities);
|
||||
};
|
||||
|
||||
export const getEntityName = (en: string) => {
|
||||
return entityConfig.getEntityDesc(en)?.locales.zh_CN?.name || "";
|
||||
};
|
||||
|
||||
export function findEntityDefFile(entityName: string): string[] {
|
||||
const fileName = toUpperFirst(`${entityName}.ts`);
|
||||
const possiblePaths: string[] = [];
|
||||
|
|
|
|||
Loading…
Reference in New Issue