From 8650a786ee586cfe6804236793e9ee298510bdc2 Mon Sep 17 00:00:00 2001 From: Joao Moreno Date: Mon, 10 Oct 2016 17:37:20 +0200 Subject: [PATCH] git extension: first steps --- extensions/git/README.md | 65 +++++++++++++++++ extensions/git/package.json | 81 +++++++++++++--------- extensions/git/src/extension.ts | 11 +++ extensions/git/src/typings/ref.d.ts | 10 +++ extensions/git/test/extension.test.ts | 18 +++++ extensions/git/test/index.ts | 13 ++++ extensions/git/tsconfig.json | 16 +++++ extensions/git/vsc-extension-quickstart.md | 33 +++++++++ 8 files changed, 215 insertions(+), 32 deletions(-) create mode 100644 extensions/git/README.md create mode 100644 extensions/git/src/extension.ts create mode 100644 extensions/git/src/typings/ref.d.ts create mode 100644 extensions/git/test/extension.test.ts create mode 100644 extensions/git/test/index.ts create mode 100644 extensions/git/tsconfig.json create mode 100644 extensions/git/vsc-extension-quickstart.md diff --git a/extensions/git/README.md b/extensions/git/README.md new file mode 100644 index 00000000000..df55c13765d --- /dev/null +++ b/extensions/git/README.md @@ -0,0 +1,65 @@ +# git README + +This is the README for your extension "git". After writing up a brief description, we recommend including the following sections. + +## Features + +Describe specific features of your extension including screenshots of your extension in action. Image paths are relative to this README file. + +For example if there is an image subfolder under your extension project workspace: + +\!\[feature X\]\(images/feature-x.png\) + +> Tip: Many popular extensions utilize animations. This is an excellent way to show off your extension! We recommend short, focused animations that are easy to follow. + +## Requirements + +If you have any requirements or dependencies, add a section describing those and how to install and configure them. + +## Extension Settings + +Include if your extension adds any VS Code settings through the `contributes.configuration` extension point. + +For example: + +This extension contributes the following settings: + +* `myExtension.enable`: enable/disable this extension +* `myExtension.thing`: set to `blah` to do something + +## Known Issues + +Calling out known issues can help limit users opening duplicate issues against your extension. + +## Release Notes + +Users appreciate release notes as you update your extension. + +### 1.0.0 + +Initial release of ... + +### 1.0.1 + +Fixed issue #. + +### 1.1.0 + +Added features X, Y, and Z. + +----------------------------------------------------------------------------------------------------------- + +## Working with Markdown + +**Note:** You can author your README using Visual Studio Code. Here are some useful editor keyboard shortcuts: + +* Split the editor (`Cmd+\` on OSX or `Ctrl+\` on Windows and Linux) +* Toggle preview (`Shift+CMD+V` on OSX or `Shift+Ctrl+V` on Windows and Linux) +* Press `Ctrl+Space` (Windows, Linux) or `Cmd+Space` (OSX) to see a list of Markdown snippets + +### For more information + +* [Visual Studio Code's Markdown Support](http://code.visualstudio.com/docs/languages/markdown) +* [Markdown Syntax Reference](https://help.github.com/articles/markdown-basics/) + +**Enjoy!** \ No newline at end of file diff --git a/extensions/git/package.json b/extensions/git/package.json index 9c1a593b4fc..97460332837 100644 --- a/extensions/git/package.json +++ b/extensions/git/package.json @@ -1,34 +1,51 @@ { - "name": "gitmode", - "version": "0.1.0", - "publisher": "vscode", - "engines": { "vscode": "*" }, - "contributes": { - "languages": [ - { - "id": "git-commit", - "aliases": ["Git Commit Message", "git-commit"], - "filenames": ["COMMIT_EDITMSG", "MERGE_MSG"], - "configuration": "./git-commit.language-configuration.json" - }, - { - "id": "git-rebase", - "aliases": ["Git Rebase Message", "git-rebase"], - "filenames": ["git-rebase-todo"], - "configuration": "./git-rebase.language-configuration.json" - } - ], - "grammars": [ - { - "language": "git-commit", - "scopeName": "text.git-commit", - "path": "./syntaxes/git-commit.tmLanguage" - }, - { - "language": "git-rebase", - "scopeName": "text.git-rebase", - "path": "./syntaxes/git-rebase.tmLanguage" - } - ] - } + "name": "git", + "displayName": "git", + "description": "Git", + "version": "0.0.1", + "publisher": "joaomoreno", + "engines": { + "vscode": "^1.5.0" + }, + "categories": [ + "Other" + ], + "activationEvents": [ + "*" + ], + "main": "./out/extension", + "contributes": { + "commands": [], + "languages": [ + { + "id": "git-commit", + "aliases": ["Git Commit Message", "git-commit"], + "filenames": ["COMMIT_EDITMSG", "MERGE_MSG"], + "configuration": "./git-commit.language-configuration.json" + }, + { + "id": "git-rebase", + "aliases": ["Git Rebase Message", "git-rebase"], + "filenames": ["git-rebase-todo"], + "configuration": "./git-rebase.language-configuration.json" + } + ], + "grammars": [ + { + "language": "git-commit", + "scopeName": "text.git-commit", + "path": "./syntaxes/git-commit.tmLanguage" + }, + { + "language": "git-rebase", + "scopeName": "text.git-rebase", + "path": "./syntaxes/git-rebase.tmLanguage" + } + ] + }, + "scripts": { + "vscode:prepublish": "tsc -p ./", + "compile": "tsc -watch -p ./", + "postinstall": "node ./node_modules/vscode/bin/install" + } } \ No newline at end of file diff --git a/extensions/git/src/extension.ts b/extensions/git/src/extension.ts new file mode 100644 index 00000000000..7abb65c036e --- /dev/null +++ b/extensions/git/src/extension.ts @@ -0,0 +1,11 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +'use strict'; + +import * as vscode from 'vscode'; + +export function activate(context: vscode.ExtensionContext) { } +export function deactivate() { } \ No newline at end of file diff --git a/extensions/git/src/typings/ref.d.ts b/extensions/git/src/typings/ref.d.ts new file mode 100644 index 00000000000..95498a3fb9c --- /dev/null +++ b/extensions/git/src/typings/ref.d.ts @@ -0,0 +1,10 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +/// +/// +/// +/// +/// \ No newline at end of file diff --git a/extensions/git/test/extension.test.ts b/extensions/git/test/extension.test.ts new file mode 100644 index 00000000000..10747590799 --- /dev/null +++ b/extensions/git/test/extension.test.ts @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +// import * as assert from 'assert'; +// import * as vscode from 'vscode'; +// import * as myExtension from '../src/extension'; + +// Defines a Mocha test suite to group tests of similar kind together +// suite("Extension Tests", () => { + +// // Defines a Mocha unit test +// test("Something 1", () => { +// assert.equal(-1, [1, 2, 3].indexOf(5)); +// assert.equal(-1, [1, 2, 3].indexOf(0)); +// }); +// }); \ No newline at end of file diff --git a/extensions/git/test/index.ts b/extensions/git/test/index.ts new file mode 100644 index 00000000000..2ece79acc5c --- /dev/null +++ b/extensions/git/test/index.ts @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +const testRunner = require('vscode/lib/testrunner'); + +testRunner.configure({ + ui: 'tdd', + useColors: true +}); + +module.exports = testRunner; \ No newline at end of file diff --git a/extensions/git/tsconfig.json b/extensions/git/tsconfig.json new file mode 100644 index 00000000000..f72a72f83c7 --- /dev/null +++ b/extensions/git/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "outDir": "out", + "lib": [ + "es6" + ], + "sourceMap": true, + "rootDir": "." + }, + "exclude": [ + "node_modules", + ".vscode-test" + ] +} \ No newline at end of file diff --git a/extensions/git/vsc-extension-quickstart.md b/extensions/git/vsc-extension-quickstart.md new file mode 100644 index 00000000000..6cdea2b5dad --- /dev/null +++ b/extensions/git/vsc-extension-quickstart.md @@ -0,0 +1,33 @@ +# Welcome to your first VS Code Extension + +## What's in the folder +* This folder contains all of the files necessary for your extension +* `package.json` - this is the manifest file in which you declare your extension and command. +The sample plugin registers a command and defines its title and command name. With this information +VS Code can show the command in the command palette. It doesn’t yet need to load the plugin. +* `src/extension.ts` - this is the main file where you will provide the implementation of your command. +The file exports one function, `activate`, which is called the very first time your extension is +activated (in this case by executing the command). Inside the `activate` function we call `registerCommand`. +We pass the function containing the implementation of the command as the second parameter to +`registerCommand`. + +## Get up and running straight away +* press `F5` to open a new window with your extension loaded +* run your command from the command palette by pressing (`Ctrl+Shift+P` or `Cmd+Shift+P` on Mac) and typing `Hello World` +* set breakpoints in your code inside `src/extension.ts` to debug your extension +* find output from your extension in the debug console + +## Make changes +* you can relaunch the extension from the debug toolbar after changing code in `src/extension.ts` +* you can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes + +## Explore the API +* you can open the full set of our API when you open the file `node_modules/vscode/vscode.d.ts` + +## Run tests +* open the debug viewlet (`Ctrl+Shift+D` or `Cmd+Shift+D` on Mac) and from the launch configuration dropdown pick `Launch Tests` +* press `F5` to run the tests in a new window with your extension loaded +* see the output of the test result in the debug console +* make changes to `test/extension.test.ts` or create new test files inside the `test` folder + * by convention, the test runner will only consider files matching the name pattern `**.test.ts` + * you can create folders inside the `test` folder to structure your tests any way you want \ No newline at end of file