added icons

This commit is contained in:
Erich Gamma 2018-03-31 17:24:32 +02:00
parent f27b68cdcc
commit 41b49e2dc1
4 changed files with 18 additions and 4 deletions

View file

@ -37,7 +37,8 @@
"explorer": [
{
"id": "npm",
"name": "npm scripts"
"name": "npm scripts",
"when": "config.npm.explorerVisible"
}
]
},
@ -136,6 +137,12 @@
},
"description": "%config.npm.exclude%",
"scope": "resource"
},
"npm.explorerVisible": {
"type": "boolean",
"default": true,
"scope": "resource",
"description": "Show the npm scripts explorer"
}
}
},

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><style>.icon-canvas-transparent{opacity:0;fill:#2d2d30}.icon-vs-out{fill:#2d2d30}.icon-vs-bg{fill:#c5c5c5}</style><path class="icon-canvas-transparent" d="M16 16H0V0h16v16z" id="canvas"/><path class="icon-vs-out" d="M16 5.5a5.5 5.5 0 0 1-5.5 5.5c-.275 0-.543-.027-.807-.066l-.079-.012a5.429 5.429 0 0 1-.81-.192l-4.537 4.537c-.472.473-1.1.733-1.767.733s-1.295-.26-1.768-.732a2.502 2.502 0 0 1 0-3.535l4.537-4.537a5.452 5.452 0 0 1-.191-.812c-.005-.025-.008-.051-.012-.077A5.503 5.503 0 0 1 5 5.5a5.5 5.5 0 1 1 11 0z" id="outline"/><path class="icon-vs-bg" d="M15 5.5a4.5 4.5 0 0 1-4.5 4.5c-.693 0-1.342-.17-1.929-.45l-5.01 5.01c-.293.294-.677.44-1.061.44s-.768-.146-1.061-.439a1.5 1.5 0 0 1 0-2.121l5.01-5.01A4.483 4.483 0 0 1 6 5.5 4.5 4.5 0 0 1 10.5 1c.693 0 1.342.17 1.929.45L9.636 4.243l2.121 2.121 2.793-2.793c.28.587.45 1.236.45 1.929z" id="iconBg"/></svg>

After

Width:  |  Height:  |  Size: 922 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><style>.icon-canvas-transparent{opacity:0;fill:#f6f6f6}.icon-vs-out{fill:#f6f6f6}.icon-vs-bg{fill:#424242}</style><path class="icon-canvas-transparent" d="M16 16H0V0h16v16z" id="canvas"/><path class="icon-vs-out" d="M16 5.5a5.5 5.5 0 0 1-5.5 5.5c-.275 0-.543-.027-.807-.066l-.079-.012a5.429 5.429 0 0 1-.81-.192l-4.537 4.537c-.472.473-1.1.733-1.767.733s-1.295-.26-1.768-.732a2.502 2.502 0 0 1 0-3.535l4.537-4.537a5.452 5.452 0 0 1-.191-.812c-.005-.025-.008-.051-.012-.077A5.503 5.503 0 0 1 5 5.5a5.5 5.5 0 1 1 11 0z" id="outline"/><path class="icon-vs-bg" d="M15 5.5a4.5 4.5 0 0 1-4.5 4.5c-.693 0-1.342-.17-1.929-.45l-5.01 5.01c-.293.294-.677.44-1.061.44s-.768-.146-1.061-.439a1.5 1.5 0 0 1 0-2.121l5.01-5.01A4.483 4.483 0 0 1 6 5.5 4.5 4.5 0 0 1 10.5 1c.693 0 1.342.17 1.929.45L9.636 4.243l2.121 2.121 2.793-2.793c.28.587.45 1.236.45 1.929z" id="iconBg"/></svg>

After

Width:  |  Height:  |  Size: 922 B

View file

@ -65,7 +65,7 @@ class NpmScript extends TreeItem {
task: Task;
package: PackageJSON;
constructor(packageJson: PackageJSON, task: Task) {
constructor(context: ExtensionContext, packageJson: PackageJSON, task: Task) {
super(task.name, TreeItemCollapsibleState.None);
this.contextValue = 'script';
this.package = packageJson;
@ -75,6 +75,10 @@ class NpmScript extends TreeItem {
command: 'npm.runScript',
arguments: [this]
};
this.iconPath = {
light: context.asAbsolutePath(path.join('resources', 'light', 'script.svg')),
dark: context.asAbsolutePath(path.join('resources', 'dark', 'script.svg'))
};
}
getFolder(): WorkspaceFolder {
@ -86,6 +90,7 @@ export class NpmScriptsTreeDataProvider implements TreeDataProvider<TreeItem> {
private taskTree: Folder[] | PackageJSON[] | null = null;
private taskProvider: TaskProvider;
private localize: any;
private extensionContext: ExtensionContext;
private _onDidChangeTreeData: EventEmitter<TreeItem | null> = new EventEmitter<TreeItem | null>();
readonly onDidChangeTreeData: Event<TreeItem | null> = this._onDidChangeTreeData.event;
@ -94,7 +99,7 @@ export class NpmScriptsTreeDataProvider implements TreeDataProvider<TreeItem> {
const subscriptions = context.subscriptions;
this.taskProvider = taskProvider;
this.localize = localize;
this.extensionContext = context;
subscriptions.push(commands.registerCommand('npm.runScript', this.runScript, this));
subscriptions.push(commands.registerCommand('npm.debugScript', this.debugScript, this));
subscriptions.push(commands.registerCommand('npm.openScript', this.openScript, this));
@ -245,7 +250,7 @@ export class NpmScriptsTreeDataProvider implements TreeDataProvider<TreeItem> {
folder.addPackage(packageJson);
packages.set(path, packageJson);
}
let script = new NpmScript(packageJson, each);
let script = new NpmScript(this.extensionContext, packageJson, each);
packageJson.addScript(script);
}
});