simplify label of dependency node (#679)

Signed-off-by: Yan Zhang <yanzh@microsoft.com>
This commit is contained in:
Yan Zhang 2021-07-28 09:49:16 +08:00 коммит произвёл GitHub
Родитель 6ef9d51ba8
Коммит afd6a09b04
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 13 добавлений и 3 удалений

Просмотреть файл

@ -68,7 +68,8 @@ export class Dependency extends TreeNode implements ITreeItem {
}
public getTreeItem(): vscode.TreeItem | Thenable<vscode.TreeItem> {
const treeItem: vscode.TreeItem = new vscode.TreeItem(this.fullArtifactName);
const label = [this.groupId, this.artifactId, this.version].join(":");
const treeItem: vscode.TreeItem = new vscode.TreeItem(label);
treeItem.resourceUri = this.uri;
treeItem.tooltip = this.fullArtifactName;
if (this.children.length !== 0) {
@ -77,23 +78,32 @@ export class Dependency extends TreeNode implements ITreeItem {
treeItem.collapsibleState = vscode.TreeItemCollapsibleState.None;
}
// icons
if (this._omittedStatus.status === "duplicate") {
const iconFile: string = "library-remove.svg";
treeItem.iconPath = {
light: getPathToExtensionRoot("resources", "icons", "light", iconFile),
dark: getPathToExtensionRoot("resources", "icons", "dark", iconFile)
};
treeItem.description = this._omittedStatus.description;
} else if (this._omittedStatus.status === "conflict") {
const iconFile: string = "library-warning.svg";
treeItem.iconPath = {
light: getPathToExtensionRoot("resources", "icons", "light", iconFile),
dark: getPathToExtensionRoot("resources", "icons", "dark", iconFile)
};
treeItem.description = this._omittedStatus.description;
} else {
treeItem.iconPath = new vscode.ThemeIcon("library");
}
// description
const descriptions: string[] = [];
if (!this.scope.includes("compile")) {
descriptions.push(`(${this.scope})`);
}
if (this._omittedStatus.description !== undefined) {
descriptions.push(this._omittedStatus.description);
}
treeItem.description = descriptions.join(" ");
return treeItem;
}
}