Skip to content

Commit

Permalink
update iconPath property to Uri object instead of string paths
Browse files Browse the repository at this point in the history
  • Loading branch information
marwan37 committed Mar 10, 2025
1 parent 9c35999 commit e576791
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/views/activityBar/environmentView/EnvironmentItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
// or implied.See the License for the specific language governing
// permissions and limitations under the License.
import path from 'path';
import { ThemeColor, ThemeIcon, TreeItem, TreeItemCollapsibleState } from 'vscode';
import * as path from 'path';
import { ThemeColor, ThemeIcon, TreeItem, TreeItemCollapsibleState, Uri } from 'vscode';

export class EnvironmentItem extends TreeItem {
pythonLogo = path.join(__dirname, '..', 'resources', 'python.png');
zenmlLogo = path.join(__dirname, '..', 'resources', 'logo.png');

constructor(
public readonly label: string,
public readonly description?: string,
Expand All @@ -32,7 +35,9 @@ export class EnvironmentItem extends TreeItem {
* @param label The label of the tree item.
* @returns The icon for the tree item.
*/
private determineIcon(label: string): { light: string; dark: string } | ThemeIcon | undefined {
private determineIcon(
label: string
): string | Uri | { light: Uri; dark: Uri } | ThemeIcon | undefined {
if (this.customIcon) {
switch (this.customIcon) {
case 'check':
Expand All @@ -57,17 +62,15 @@ export class EnvironmentItem extends TreeItem {
case 'Python Version':
case 'Path':
case 'EnvType':
const pythonLogo = path.join(__dirname, '..', 'resources', 'python.png');
return {
light: pythonLogo,
dark: pythonLogo,
light: Uri.file(this.pythonLogo),
dark: Uri.file(this.pythonLogo),
};
case 'ZenML Local':
case 'ZenML Client':
const zenmlLogo = path.join(__dirname, '..', 'resources', 'logo.png');
return {
light: zenmlLogo,
dark: zenmlLogo,
light: Uri.file(this.zenmlLogo),
dark: Uri.file(this.zenmlLogo),
};
default:
return undefined;
Expand Down

0 comments on commit e576791

Please sign in to comment.