├── .gitignore
├── check.png
├── .gitattributes
├── assets
├── taskrunner.gif
└── refresh_icon.svg
├── .vscodeignore
├── CHANGELOG.md
├── .vscode
├── settings.json
├── tasks.json
└── launch.json
├── README.md
├── src
├── extension.ts
├── test
│ ├── extension.test.ts
│ └── index.ts
└── taskProvider.ts
├── tsconfig.json
├── LICENSE
├── package.json
└── vsc-extension-quickstart.md
/.gitignore:
--------------------------------------------------------------------------------
1 | out
2 | node_modules
3 | .vscode-test/
4 | *.vsix
5 |
--------------------------------------------------------------------------------
/check.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sana-ajani/taskrunner-code/HEAD/check.png
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Set default behavior to automatically normalize line endings.
2 | * text=auto
3 |
4 |
--------------------------------------------------------------------------------
/assets/taskrunner.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sana-ajani/taskrunner-code/HEAD/assets/taskrunner.gif
--------------------------------------------------------------------------------
/.vscodeignore:
--------------------------------------------------------------------------------
1 | .vscode/**
2 | .vscode-test/**
3 | out/test/**
4 | out/**/*.map
5 | src/**
6 | .gitignore
7 | tsconfig.json
8 | vsc-extension-quickstart.md
9 | tslint.json
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Change Log
2 | All notable changes to the "taskrunnercode" extension will be documented in this file.
3 |
4 | Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.
5 |
6 | ## [Unreleased]
7 | - Initial release
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | // Place your settings in this file to overwrite default and user settings.
2 | {
3 | "files.exclude": {
4 | "out": false // set this to true to hide the "out" folder with the compiled JS files
5 | },
6 | "search.exclude": {
7 | "out": true // set this to false to include "out" folder in search results
8 | },
9 | // Turn off tsc task auto detection since we have the necessary tasks as npm scripts
10 | "typescript.tsc.autoDetect": "off"
11 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Task Runner
2 |
3 | Test change!
4 |
5 | There are many tools that exist to automate parts of your project, including for installing dependencies, building, testing, linting, deploying. This extension adds an additional "Task Runner" view in your Explorer Pane to visualize and individually run the auto-detected tasks in your project. VS Code auto-detects the following task runners: Gulp, Grunt, Jake and npm.
6 |
7 | ## Demo
8 |
9 | 
10 |
11 | ---
12 |
13 |
--------------------------------------------------------------------------------
/assets/refresh_icon.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.vscode/tasks.json:
--------------------------------------------------------------------------------
1 | // See https://go.microsoft.com/fwlink/?LinkId=733558
2 | // for the documentation about the tasks.json format
3 | {
4 | "version": "2.0.0",
5 | "tasks": [
6 | {
7 | "type": "npm",
8 | "script": "watch",
9 | "problemMatcher": "$tsc-watch",
10 | "isBackground": true,
11 | "presentation": {
12 | "reveal": "never"
13 | },
14 | "group": {
15 | "kind": "build",
16 | "isDefault": true
17 | }
18 | },
19 | {
20 | "type": "npm",
21 | "script": "compile",
22 | "problemMatcher": [
23 | "$tsc"
24 | ]
25 | }
26 | ]
27 | }
--------------------------------------------------------------------------------
/src/extension.ts:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | import * as vscode from 'vscode';
4 | import { TaskTreeDataProvider } from './taskProvider'
5 |
6 | export function activate(context: vscode.ExtensionContext) {
7 |
8 | const taskTreeDataProvider = new TaskTreeDataProvider(context);
9 |
10 | vscode.window.registerTreeDataProvider('taskOutline', taskTreeDataProvider);
11 | vscode.commands.registerCommand('taskOutline.refresh', () => taskTreeDataProvider.refresh());
12 |
13 | vscode.commands.registerCommand('taskOutline.executeTask', function(task) {
14 | console.log(task);
15 | vscode.tasks.executeTask(task).then(function (value) {
16 | return value;
17 | }, function(e) {
18 | console.error('I am error');
19 | });
20 | });
21 | }
22 |
23 | export function deactivate(): void {
24 |
25 | }
--------------------------------------------------------------------------------
/src/test/extension.test.ts:
--------------------------------------------------------------------------------
1 | //
2 | // Note: This example test is leveraging the Mocha test framework.
3 | // Please refer to their documentation on https://mochajs.org/ for help.
4 | //
5 |
6 | // The module 'assert' provides assertion methods from node
7 | import * as assert from 'assert';
8 |
9 | // You can import and use all API from the 'vscode' module
10 | // as well as import your extension to test it
11 | // import * as vscode from 'vscode';
12 | // import * as myExtension from '../extension';
13 |
14 | // Defines a Mocha test suite to group tests of similar kind together
15 | suite("Extension Tests", function () {
16 |
17 | // Defines a Mocha unit test
18 | test("Something 1", function() {
19 | assert.equal(-1, [1, 2, 3].indexOf(5));
20 | assert.equal(-1, [1, 2, 3].indexOf(0));
21 | });
22 | });
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "module": "commonjs",
4 | "target": "es6",
5 | "outDir": "out",
6 | "lib": [
7 | "dom",
8 | "es6"
9 | ],
10 | "sourceMap": true,
11 | "rootDir": "src",
12 | /* Strict Type-Checking Option */
13 | "strict": false, /* enable all strict type-checking options */
14 | /* Additional Checks */
15 | "noUnusedLocals": false /* Report errors on unused locals. */
16 | // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
17 | // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
18 | // "noUnusedParameters": true, /* Report errors on unused parameters. */
19 | },
20 | "exclude": [
21 | "node_modules",
22 | ".vscode-test"
23 | ]
24 | }
--------------------------------------------------------------------------------
/src/test/index.ts:
--------------------------------------------------------------------------------
1 | //
2 | // PLEASE DO NOT MODIFY / DELETE UNLESS YOU KNOW WHAT YOU ARE DOING
3 | //
4 | // This file is providing the test runner to use when running extension tests.
5 | // By default the test runner in use is Mocha based.
6 | //
7 | // You can provide your own test runner if you want to override it by exporting
8 | // a function run(testRoot: string, clb: (error:Error) => void) that the extension
9 | // host can call to run the tests. The test runner is expected to use console.log
10 | // to report the results back to the caller. When the tests are finished, return
11 | // a possible error to the callback or null if none.
12 |
13 | import * as testRunner from 'vscode/lib/testrunner';
14 |
15 | // You can directly control Mocha options by uncommenting the following lines
16 | // See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options for more info
17 | testRunner.configure({
18 | ui: 'tdd', // the TDD UI is being used in extension.test.ts (suite, test, etc.)
19 | useColors: true // colored output from test results
20 | });
21 |
22 | module.exports = testRunner;
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 Sana Ajani
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | // A launch configuration that compiles the extension and then opens it inside a new window
2 | // Use IntelliSense to learn about possible attributes.
3 | // Hover to view descriptions of existing attributes.
4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5 | {
6 | "version": "0.2.0",
7 | "configurations": [
8 | {
9 | "name": "Extension",
10 | "type": "extensionHost",
11 | "request": "launch",
12 | "runtimeExecutable": "${execPath}",
13 | "args": [
14 | "--extensionDevelopmentPath=${workspaceFolder}"
15 | ],
16 | "outFiles": [
17 | "${workspaceFolder}/out/**/*.js"
18 | ],
19 | "preLaunchTask": "npm: watch"
20 | },
21 | {
22 | "name": "Extension Tests",
23 | "type": "extensionHost",
24 | "request": "launch",
25 | "runtimeExecutable": "${execPath}",
26 | "args": [
27 | "--extensionDevelopmentPath=${workspaceFolder}",
28 | "--extensionTestsPath=${workspaceFolder}/out/test"
29 | ],
30 | "outFiles": [
31 | "${workspaceFolder}/out/test/**/*.js"
32 | ],
33 | "preLaunchTask": "npm: watch"
34 | }
35 | ]
36 | }
37 |
--------------------------------------------------------------------------------
/src/taskProvider.ts:
--------------------------------------------------------------------------------
1 | import * as vscode from 'vscode';
2 |
3 | export class TaskTreeDataProvider implements vscode.TreeDataProvider {
4 |
5 | private _onDidChangeTreeData: vscode.EventEmitter = new vscode.EventEmitter();
6 | readonly onDidChangeTreeData: vscode.Event = this._onDidChangeTreeData.event;
7 |
8 | private autoRefresh: boolean = true;
9 |
10 | constructor(private context: vscode.ExtensionContext) {
11 | this.autoRefresh = vscode.workspace.getConfiguration('taskOutline').get('autorefresh');
12 | }
13 |
14 | refresh(): void {
15 | this._onDidChangeTreeData.fire();
16 | }
17 |
18 | public async getChildren(task?: TreeTask): Promise {
19 |
20 | let tasks = await vscode.tasks.fetchTasks().then(function (value) {
21 | return value;
22 | });
23 |
24 | let taskNames: TreeTask[] = [];
25 | if (tasks.length != 0) {
26 | for (var i = 0; i < tasks.length; i++ ) {
27 | taskNames[i] = new TreeTask(tasks[i].definition.type, tasks[i].name, vscode.TreeItemCollapsibleState.None, { command: 'taskOutline.executeTask', title: "Execute", arguments: [tasks[i]] });
28 | }
29 | }
30 | return taskNames;
31 |
32 | }
33 |
34 | getTreeItem(task: TreeTask): vscode.TreeItem {
35 | return task;
36 | }
37 | }
38 |
39 | class TreeTask extends vscode.TreeItem {
40 | type: string;
41 |
42 | constructor(
43 | type: string,
44 | label: string,
45 | collapsibleState: vscode.TreeItemCollapsibleState,
46 | command?: vscode.Command
47 | ) {
48 | super(label, collapsibleState);
49 | this.type = type;
50 | this.command = command;
51 | }
52 |
53 | }
54 |
55 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "taskrunnercode",
3 | "displayName": "Task Runner",
4 | "description": "VS Code extension to view and run tasks from Explorer pane",
5 | "icon": "check.png",
6 | "version": "0.2.0",
7 | "publisher": "SanaAjani",
8 | "repository": {
9 | "type": "git",
10 | "url": "https://github.com/sana-ajani/taskrunner-code.git"
11 | },
12 | "engines": {
13 | "vscode": "^1.26.0"
14 | },
15 | "categories": [
16 | "Other"
17 | ],
18 | "keywords": [
19 | "tasks",
20 | "packages",
21 | "execute"
22 | ],
23 | "galleryBanner": {
24 | "color": "#d7ede1"
25 | },
26 | "activationEvents": [
27 | "*"
28 | ],
29 | "main": "./out/extension",
30 | "contributes": {
31 | "views": {
32 | "explorer": [
33 | {
34 | "id": "taskOutline",
35 | "name": "Task Runner"
36 | }
37 | ]
38 | },
39 | "commands": [
40 | {
41 | "command": "taskOutline.executeTask",
42 | "title": "Execute"
43 | },
44 | {
45 | "command": "taskOutline.refresh",
46 | "title": "Refresh",
47 | "icon": "assets/refresh_icon.svg"
48 | }
49 | ],
50 | "menus": {
51 | "view/title": [
52 | {
53 | "command": "taskOutline.refresh",
54 | "group": "navigation"
55 | }
56 | ]
57 | }
58 | },
59 | "scripts": {
60 | "vscode:prepublish": "npm run compile",
61 | "compile": "tsc -p ./",
62 | "watch": "tsc -watch -p ./",
63 | "postinstall": "node ./node_modules/vscode/bin/install",
64 | "test": "npm run compile && node ./node_modules/vscode/bin/test"
65 | },
66 | "devDependencies": {
67 | "@types/mocha": "^2.2.42",
68 | "@types/node": "^8.10.25",
69 | "typescript": "^3.0.3",
70 | "vscode": "^1.1.21",
71 | "tslint": "^5.8.0"
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/vsc-extension-quickstart.md:
--------------------------------------------------------------------------------
1 | # Welcome to your VS Code Extension
2 |
3 | ## What's in the folder
4 | * This folder contains all of the files necessary for your extension.
5 | * `package.json` - this is the manifest file in which you declare your extension and command.
6 | The sample plugin registers a command and defines its title and command name. With this information
7 | VS Code can show the command in the command palette. It doesn’t yet need to load the plugin.
8 | * `src/extension.ts` - this is the main file where you will provide the implementation of your command.
9 | The file exports one function, `activate`, which is called the very first time your extension is
10 | activated (in this case by executing the command). Inside the `activate` function we call `registerCommand`.
11 | We pass the function containing the implementation of the command as the second parameter to
12 | `registerCommand`.
13 |
14 | ## Get up and running straight away
15 | * Press `F5` to open a new window with your extension loaded.
16 | * Run your command from the command palette by pressing (`Ctrl+Shift+P` or `Cmd+Shift+P` on Mac) and typing `Hello World`.
17 | * Set breakpoints in your code inside `src/extension.ts` to debug your extension.
18 | * Find output from your extension in the debug console.
19 |
20 | ## Make changes
21 | * You can relaunch the extension from the debug toolbar after changing code in `src/extension.ts`.
22 | * You can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes.
23 |
24 | ## Explore the API
25 | * You can open the full set of our API when you open the file `node_modules/vscode/vscode.d.ts`.
26 |
27 | ## Run tests
28 | * Open the debug viewlet (`Ctrl+Shift+D` or `Cmd+Shift+D` on Mac) and from the launch configuration dropdown pick `Launch Tests`.
29 | * Press `F5` to run the tests in a new window with your extension loaded.
30 | * See the output of the test result in the debug console.
31 | * Make changes to `test/extension.test.ts` or create new test files inside the `test` folder.
32 | * By convention, the test runner will only consider files matching the name pattern `**.test.ts`.
33 | * You can create folders inside the `test` folder to structure your tests any way you want.
34 |
--------------------------------------------------------------------------------