Skip to content
This repository was archived by the owner on Jan 15, 2022. It is now read-only.

Commit c8440c2

Browse files
Frederic ForjanFrederic Forjan
Frederic Forjan
authored and
Frederic Forjan
committed
from template
0 parents  commit c8440c2

14 files changed

+238
-0
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
out
2+
node_modules

.vscode/launch.json

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// A launch configuration that compiles the extension and then opens it inside a new window
2+
{
3+
"version": "0.1.0",
4+
"configurations": [
5+
{
6+
"name": "Launch Extension",
7+
"type": "extensionHost",
8+
"request": "launch",
9+
"runtimeExecutable": "${execPath}",
10+
"args": ["--extensionDevelopmentPath=${workspaceRoot}" ],
11+
"stopOnEntry": false,
12+
"sourceMaps": true,
13+
"outDir": "out/src",
14+
"preLaunchTask": "npm"
15+
},
16+
{
17+
"name": "Launch Tests",
18+
"type": "extensionHost",
19+
"request": "launch",
20+
"runtimeExecutable": "${execPath}",
21+
"args": ["--extensionDevelopmentPath=${workspaceRoot}", "--extensionTestsPath=${workspaceRoot}/out/test" ],
22+
"stopOnEntry": false,
23+
"sourceMaps": true,
24+
"outDir": "out/test",
25+
"preLaunchTask": "npm"
26+
}
27+
]
28+
}

.vscode/settings.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
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+
"typescript.tsdk": "./node_modules/typescript/lib" // we want to use the TS server from our node_modules folder to control its version
10+
}

.vscode/tasks.json

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Available variables which can be used inside of strings.
2+
// ${workspaceRoot}: the root folder of the team
3+
// ${file}: the current opened file
4+
// ${fileBasename}: the current opened file's basename
5+
// ${fileDirname}: the current opened file's dirname
6+
// ${fileExtname}: the current opened file's extension
7+
// ${cwd}: the current working directory of the spawned process
8+
9+
// A task runner that calls a custom npm script that compiles the extension.
10+
{
11+
"version": "0.1.0",
12+
13+
// we want to run npm
14+
"command": "npm",
15+
16+
// the command is a shell script
17+
"isShellCommand": true,
18+
19+
// show the output window only if unrecognized errors occur.
20+
"showOutput": "silent",
21+
22+
// we run the custom script "compile" as defined in package.json
23+
"args": ["run", "compile", "--loglevel", "silent"],
24+
25+
// The tsc compiler is started in watching mode
26+
"isWatching": true,
27+
28+
// use the standard tsc in watch mode problem matcher to find compile problems in the output.
29+
"problemMatcher": "$tsc-watch"
30+
}

.vscodeignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.vscode/**
2+
typings/**
3+
out/test/**
4+
test/**
5+
src/**
6+
**/*.map
7+
.gitignore
8+
tsconfig.json
9+
vsc-extension-quickstart.md

README.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# README
2+
## This is the README for your extension "nuget4code"
3+
You can author your README using Visual Studio Code. Here are some useful editor keyboard shortcuts:
4+
5+
* Split the editor (`Cmd+\` on OSX or `Ctrl+\` on Windows and Linux)
6+
* Toggle preview (`Shift+CMD+V` on OSX or `Shift+Ctrl+V` on Windows and Linux)
7+
* Press `Ctrl+Space` (Windows, Linux) or `Cmd+Space` (OSX) to see a list of Markdown snippets
8+
9+
### For more information
10+
* [Visual Studio Code's Markdown Support](http://code.visualstudio.com/docs/languages/markdown)
11+
* [Markdown Syntax Reference](https://help.github.com/articles/markdown-basics/)
12+
13+
** Enjoy!**

package.json

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"name": "nuget4code",
3+
"displayName": "Nuget4Code",
4+
"description": "manage nuget for aspnet5",
5+
"version": "0.0.1",
6+
"publisher": "fforjan",
7+
"engines": {
8+
"vscode": "^0.10.1"
9+
},
10+
"categories": [
11+
"Other"
12+
],
13+
"activationEvents": [
14+
"onCommand:extension.sayHello"
15+
],
16+
"main": "./out/src/extension",
17+
"contributes": {
18+
"commands": [{
19+
"command": "extension.sayHello",
20+
"title": "Hello World"
21+
}]
22+
},
23+
"scripts": {
24+
"vscode:prepublish": "node ./node_modules/vscode/bin/compile",
25+
"compile": "node ./node_modules/vscode/bin/compile -watch -p ./"
26+
},
27+
"devDependencies": {
28+
"typescript": "^1.6.2",
29+
"vscode": "0.10.x"
30+
}
31+
}

src/extension.ts

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// The module 'vscode' contains the VS Code extensibility API
2+
// Import the module and reference it with the alias vscode in your code below
3+
import * as vscode from 'vscode';
4+
5+
// this method is called when your extension is activated
6+
// your extension is activated the very first time the command is executed
7+
export function activate(context: vscode.ExtensionContext) {
8+
9+
// Use the console to output diagnostic information (console.log) and errors (console.error)
10+
// This line of code will only be executed once when your extension is activated
11+
console.log('Congratulations, your extension "nuget4code" is now active!');
12+
13+
// The command has been defined in the package.json file
14+
// Now provide the implementation of the command with registerCommand
15+
// The commandId parameter must match the command field in package.json
16+
var disposable = vscode.commands.registerCommand('extension.sayHello', () => {
17+
// The code you place here will be executed every time your command is executed
18+
19+
// Display a message box to the user
20+
vscode.window.showInformationMessage('Hello World!');
21+
});
22+
23+
context.subscriptions.push(disposable);
24+
}

test/extension.test.ts

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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 '../src/extension';
13+
14+
// Defines a Mocha test suite to group tests of similar kind together
15+
suite("Extension Tests", () => {
16+
17+
// Defines a Mocha unit test
18+
test("Something 1", () => {
19+
assert.equal(-1, [1, 2, 3].indexOf(5));
20+
assert.equal(-1, [1, 2, 3].indexOf(0));
21+
});
22+
});

test/index.ts

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+
var testRunner = require('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;

tsconfig.json

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"compilerOptions": {
3+
"module": "commonjs",
4+
"target": "ES5",
5+
"outDir": "out",
6+
"noLib": true,
7+
"sourceMap": true
8+
},
9+
"exclude": [
10+
"node_modules"
11+
]
12+
}

typings/node.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference path="../node_modules/vscode/typings/node.d.ts" />

typings/vscode-typings.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference path="../node_modules/vscode/typings/index.d.ts" />

vsc-extension-quickstart.md

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Welcome to your first 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

0 commit comments

Comments
 (0)