-
Notifications
You must be signed in to change notification settings - Fork 149
Expand file tree
/
Copy pathtreeUtils.ts
More file actions
30 lines (25 loc) · 1.26 KB
/
treeUtils.ts
File metadata and controls
30 lines (25 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { type AzExtTreeItem, type TreeItemIconPath } from '@microsoft/vscode-azext-utils';
import * as path from 'path';
import { ext } from '../extensionVariables';
export namespace treeUtils {
export function getIconPath(iconName: string): string {
return path.join(getResourcesPath(), `${iconName}.svg`);
}
export function getThemedIconPath(iconName: string): TreeItemIconPath {
return {
light: path.join(getResourcesPath(), 'light', `${iconName}.svg`),
dark: path.join(getResourcesPath(), 'dark', `${iconName}.svg`)
};
}
function getResourcesPath(): string {
return ext.context.asAbsolutePath('resources');
}
// replace with azext-utils when it's released
export function isAzExtTreeItem(ti: unknown): ti is AzExtTreeItem {
return !!ti && (ti as AzExtTreeItem).fullId !== undefined && (ti as AzExtTreeItem).fullId !== null;
}
}