Skip to content

Commit 8650a78

Browse files
committed
git extension: first steps
1 parent 492264d commit 8650a78

8 files changed

Lines changed: 215 additions & 32 deletions

File tree

extensions/git/README.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# git README
2+
3+
This is the README for your extension "git". After writing up a brief description, we recommend including the following sections.
4+
5+
## Features
6+
7+
Describe specific features of your extension including screenshots of your extension in action. Image paths are relative to this README file.
8+
9+
For example if there is an image subfolder under your extension project workspace:
10+
11+
\!\[feature X\]\(images/feature-x.png\)
12+
13+
> 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.
14+
15+
## Requirements
16+
17+
If you have any requirements or dependencies, add a section describing those and how to install and configure them.
18+
19+
## Extension Settings
20+
21+
Include if your extension adds any VS Code settings through the `contributes.configuration` extension point.
22+
23+
For example:
24+
25+
This extension contributes the following settings:
26+
27+
* `myExtension.enable`: enable/disable this extension
28+
* `myExtension.thing`: set to `blah` to do something
29+
30+
## Known Issues
31+
32+
Calling out known issues can help limit users opening duplicate issues against your extension.
33+
34+
## Release Notes
35+
36+
Users appreciate release notes as you update your extension.
37+
38+
### 1.0.0
39+
40+
Initial release of ...
41+
42+
### 1.0.1
43+
44+
Fixed issue #.
45+
46+
### 1.1.0
47+
48+
Added features X, Y, and Z.
49+
50+
-----------------------------------------------------------------------------------------------------------
51+
52+
## Working with Markdown
53+
54+
**Note:** You can author your README using Visual Studio Code. Here are some useful editor keyboard shortcuts:
55+
56+
* Split the editor (`Cmd+\` on OSX or `Ctrl+\` on Windows and Linux)
57+
* Toggle preview (`Shift+CMD+V` on OSX or `Shift+Ctrl+V` on Windows and Linux)
58+
* Press `Ctrl+Space` (Windows, Linux) or `Cmd+Space` (OSX) to see a list of Markdown snippets
59+
60+
### For more information
61+
62+
* [Visual Studio Code's Markdown Support](http://code.visualstudio.com/docs/languages/markdown)
63+
* [Markdown Syntax Reference](https://help.github.com/articles/markdown-basics/)
64+
65+
**Enjoy!**

extensions/git/package.json

Lines changed: 49 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,51 @@
11
{
2-
"name": "gitmode",
3-
"version": "0.1.0",
4-
"publisher": "vscode",
5-
"engines": { "vscode": "*" },
6-
"contributes": {
7-
"languages": [
8-
{
9-
"id": "git-commit",
10-
"aliases": ["Git Commit Message", "git-commit"],
11-
"filenames": ["COMMIT_EDITMSG", "MERGE_MSG"],
12-
"configuration": "./git-commit.language-configuration.json"
13-
},
14-
{
15-
"id": "git-rebase",
16-
"aliases": ["Git Rebase Message", "git-rebase"],
17-
"filenames": ["git-rebase-todo"],
18-
"configuration": "./git-rebase.language-configuration.json"
19-
}
20-
],
21-
"grammars": [
22-
{
23-
"language": "git-commit",
24-
"scopeName": "text.git-commit",
25-
"path": "./syntaxes/git-commit.tmLanguage"
26-
},
27-
{
28-
"language": "git-rebase",
29-
"scopeName": "text.git-rebase",
30-
"path": "./syntaxes/git-rebase.tmLanguage"
31-
}
32-
]
33-
}
2+
"name": "git",
3+
"displayName": "git",
4+
"description": "Git",
5+
"version": "0.0.1",
6+
"publisher": "joaomoreno",
7+
"engines": {
8+
"vscode": "^1.5.0"
9+
},
10+
"categories": [
11+
"Other"
12+
],
13+
"activationEvents": [
14+
"*"
15+
],
16+
"main": "./out/extension",
17+
"contributes": {
18+
"commands": [],
19+
"languages": [
20+
{
21+
"id": "git-commit",
22+
"aliases": ["Git Commit Message", "git-commit"],
23+
"filenames": ["COMMIT_EDITMSG", "MERGE_MSG"],
24+
"configuration": "./git-commit.language-configuration.json"
25+
},
26+
{
27+
"id": "git-rebase",
28+
"aliases": ["Git Rebase Message", "git-rebase"],
29+
"filenames": ["git-rebase-todo"],
30+
"configuration": "./git-rebase.language-configuration.json"
31+
}
32+
],
33+
"grammars": [
34+
{
35+
"language": "git-commit",
36+
"scopeName": "text.git-commit",
37+
"path": "./syntaxes/git-commit.tmLanguage"
38+
},
39+
{
40+
"language": "git-rebase",
41+
"scopeName": "text.git-rebase",
42+
"path": "./syntaxes/git-rebase.tmLanguage"
43+
}
44+
]
45+
},
46+
"scripts": {
47+
"vscode:prepublish": "tsc -p ./",
48+
"compile": "tsc -watch -p ./",
49+
"postinstall": "node ./node_modules/vscode/bin/install"
50+
}
3451
}

extensions/git/src/extension.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
'use strict';
7+
8+
import * as vscode from 'vscode';
9+
10+
export function activate(context: vscode.ExtensionContext) { }
11+
export function deactivate() { }
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
/// <reference path='../../../../src/vs/vscode.d.ts'/>
7+
/// <reference path='../../../../src/typings/mocha.d.ts'/>
8+
/// <reference path='../../../../extensions/declares.d.ts'/>
9+
/// <reference path='../../../../extensions/node.d.ts'/>
10+
/// <reference path='../../../../extensions/lib.core.d.ts'/>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
// import * as assert from 'assert';
7+
// import * as vscode from 'vscode';
8+
// import * as myExtension from '../src/extension';
9+
10+
// Defines a Mocha test suite to group tests of similar kind together
11+
// suite("Extension Tests", () => {
12+
13+
// // Defines a Mocha unit test
14+
// test("Something 1", () => {
15+
// assert.equal(-1, [1, 2, 3].indexOf(5));
16+
// assert.equal(-1, [1, 2, 3].indexOf(0));
17+
// });
18+
// });

extensions/git/test/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
const testRunner = require('vscode/lib/testrunner');
7+
8+
testRunner.configure({
9+
ui: 'tdd',
10+
useColors: true
11+
});
12+
13+
module.exports = testRunner;

extensions/git/tsconfig.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"compilerOptions": {
3+
"module": "commonjs",
4+
"target": "es6",
5+
"outDir": "out",
6+
"lib": [
7+
"es6"
8+
],
9+
"sourceMap": true,
10+
"rootDir": "."
11+
},
12+
"exclude": [
13+
"node_modules",
14+
".vscode-test"
15+
]
16+
}
Lines changed: 33 additions & 0 deletions
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)