Skip to content

Commit 06f7238

Browse files
committed
version 0.3.0
1 parent bdfb3cc commit 06f7238

14 files changed

Lines changed: 751 additions & 263 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
node_modules/
22
out/
3+
tmp/

.vscode/launch.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,20 @@
1313
"sourceMaps": true,
1414
"outDir": "${workspaceRoot}/out"
1515
//"preLaunchTask": "npm"
16+
},
17+
{
18+
"name": "Launch Tests",
19+
"type": "extensionHost",
20+
"request": "launch",
21+
"runtimeExecutable": "${execPath}",
22+
"args": [
23+
"--extensionDevelopmentPath=${workspaceRoot}",
24+
"--extensionTestsPath=${workspaceRoot}/out/test"
25+
],
26+
"stopOnEntry": false,
27+
"sourceMaps": true,
28+
"outDir": "${workspaceRoot}/out/test"
29+
//"preLaunchTask": "npm"
1630
}
1731
]
1832
}

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Platzieren Sie Ihre Einstellungen in dieser Datei, um Standard- und Benutzereinstellungen zu überschreiben.
2+
{
3+
}

.vscodeignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
tmp/
3+
tmp
4+
tmp/*
5+
.vscode/*
6+
src/*
7+
test/*
8+
typings/*
9+
.gitignore
10+
settings.json

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ You can configure your Username. Go to `File > Preferences > User Settings` and
2424
```
2525

2626
## Change Log
27+
### Version 0.3.0
28+
* Menu items added
29+
* Share selected text
30+
* Open Gist or Pastebin
31+
* Saves token for login
32+
2733
### Version 0.2.0
2834
* Extension in german translated
2935

package.json

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sharecode",
3-
"version": "0.2.1",
3+
"version": "0.3.0",
44
"publisher": "RolandGreim",
55
"engines": {
66
"vscode": "^0.10.10"
@@ -14,6 +14,7 @@
1414
"keywords": [
1515
"GitHub",
1616
"Pastebin",
17+
"Gist",
1718
"Upload",
1819
"Share"
1920
],
@@ -23,10 +24,28 @@
2324
},
2425
"main": "./out/src/extension",
2526
"contributes": {
27+
"menus": {
28+
"editor/title": [
29+
{
30+
"command": "extension.shareCode.share",
31+
"title": "Share Code"
32+
}
33+
],
34+
"editor/context": [
35+
{
36+
"command": "extension.shareCode.share",
37+
"title": "Share Code"
38+
}
39+
]
40+
},
2641
"commands": [
2742
{
28-
"command": "extension.shareCode",
29-
"title": "Share Code"
43+
"command": "extension.shareCode.share",
44+
"title": "Share Code: share"
45+
},
46+
{
47+
"command": "extension.shareCode.open",
48+
"title": "Share Code: open"
3049
}
3150
],
3251
"configuration": {
@@ -42,17 +61,28 @@
4261
"type": "string",
4362
"default": "",
4463
"description": "Cached gist username."
64+
},
65+
"shareCode.gist.authtoken": {
66+
"type": "string",
67+
"default": null,
68+
"description": "GitHub Authentication Token."
4569
}
4670
}
4771
}
4872
},
4973
"activationEvents": [
50-
"onCommand:extension.shareCode"
74+
"onCommand:extension.shareCode.open",
75+
"onCommand:extension.shareCode.share"
5176
],
5277
"dependencies": {
78+
"github": "^0.2.4",
5379
"i18next": "^2.5.1",
80+
"moment": "^2.15.1",
5481
"opn": "^4.0.1",
55-
"request": "^2.69.0"
82+
"request": "^2.69.0",
83+
"underscore": "^1.8.3",
84+
"vscode": "^0.11.18",
85+
"xml2js": "^0.4.16"
5686
},
5787
"devDependencies": {
5888
"typescript": "^1.8.5",

src/extension.ts

Lines changed: 101 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// The module 'vscode' contains the VS Code extensibility API
33
// Import the module and reference it with the alias vscode in your code below
44
import * as vscode from 'vscode';
5-
import {sharecode} from './sharecode';
5+
import {ShareCode, ShareCodeClasses} from './sharecode';
66
let i18next = require('i18next');
77

88
// this method is called when your extension is activated
@@ -13,99 +13,122 @@ export function activate(context: vscode.ExtensionContext)
1313
// Use the console to output diagnostic information (console.log) and errors (console.error)
1414
// This line of code will only be executed once when your extension is activated
1515
//console.log('Congratulations, your extension "Share Code" is now active!');
16+
i18next.init({
17+
"debug": false,
18+
"lng": vscode.env.language,
19+
"resources": {
20+
"en-US": {
21+
"translation": {
22+
"pastebin": {
23+
"service": "Pastebin",
24+
"serviceAnym": "Pastebin (anonymous)",
25+
"choosePrivacy": "Choose privacy",
26+
"chooseExpireDate": "Choose expire date",
27+
"username": "Pastebin Username",
28+
"password": "Pastebin Password"
29+
},
30+
"github": {
31+
"service": "GitHub Gist",
32+
"serviceAnym": "GitHub Gist (anonymous)",
33+
"username": "GitHub Username",
34+
"password": "GitHub Password",
35+
"description": "Description of your file",
36+
"errors": {
37+
"tokenExist": "Authtoken already exist. Please delete it on Github"
38+
}
39+
},
40+
"errors": {
41+
"blankUsernameOrPassword": "Username or password can not be blank.",
42+
"unexpectedErrorCode": "An unexpected error occurred. Please contact the developer. Code: {{code}}",
43+
"noDescription": "No description"
44+
},
45+
"publishedMessage": "Your File is published here: ",
46+
"fileNotFound": "No file for sharing found. Please open one in edit mode.",
47+
"public": "public",
48+
"unlisted": "unlisted",
49+
"private": "private",
50+
"never": "never",
51+
"minute": "{{count}} minute",
52+
"minute_plural": "{{count}} minutes",
53+
"hour": "{{count}} hour",
54+
"day": "{{count}} day",
55+
"week": "{{count}} week",
56+
"week_plural": "{{count}} weeks",
57+
"month": "{{count}} month"
58+
}
59+
},
60+
"de": {
61+
"translation": {
62+
"pastebin": {
63+
"service": "Pastebin",
64+
"serviceAnym": "Pastebin (anonym)",
65+
"choosePrivacy": "Sichtbarkeit auswählen",
66+
"chooseExpireDate": "Ablaufdatum auswählen",
67+
"username": "Pastebin Benutzername",
68+
"password": "Pastebin Passwort"
69+
},
70+
"github": {
71+
"service": "GitHub Gist",
72+
"serviceAnym": "GitHub Gist (anonym)",
73+
"username": "GitHub Benutzername",
74+
"password": "GitHub Passwort",
75+
"description": "Beschreibung der Datei",
76+
"errors": {
77+
"tokenExist": "Anmelde-Token wurde bereits erstellt. Bitte diesen auf Github löschen."
78+
}
79+
},
80+
"errors": {
81+
"blankUsernameOrPassword": "Benutzername oder Passwort dürfen nicht leer sein.",
82+
"unexpectedErrorCode": "Ein unerwarteter Fehler ist aufgetreten. Bitte kontaktieren sie den Entwickler. Code: {{code}}",
83+
"noDescription": "Keine Beschreibung"
84+
},
85+
"publishedMessage": "Deine Datei wurde hier veröffentlicht: ",
86+
"fileNotFound": "Keine Detei zum teilen gefunden. Bitte öffnen Sie eine im Bearbeitungsmodus.",
87+
"public": "öffentlich",
88+
"unlisted": "nicht gelistet",
89+
"private": "privat",
90+
"never": "niemals",
91+
"minute": "{{count}} Minute",
92+
"minute_plural": "{{count}} Minuten",
93+
"hour": "{{count}} Stunde",
94+
"day": "{{count}} Tag",
95+
"week": "{{count}} Woche",
96+
"week_plural": "{{count}} Wochen",
97+
"month": "{{count}} Monat"
98+
}
99+
}
100+
},
101+
"fallbackLng": "en-US"
102+
});
16103

17104
// The command has been defined in the package.json file
18105
// Now provide the implementation of the command with registerCommand
19106
// The commandId parameter must match the command field in package.json
20-
let disposable = vscode.commands.registerCommand('extension.shareCode', () =>
107+
let share = vscode.commands.registerCommand("extension.shareCode.share", () =>
21108
{
22-
i18next.init({
23-
"debug": false,
24-
"lng": vscode.env.language,
25-
"resources": {
26-
"en-US": {
27-
"translation": {
28-
"pastebin": {
29-
"service": "Pastebin",
30-
"serviceAnym": "Pastebin (anonymous)",
31-
"choosePrivacy": "Choose privacy",
32-
"chooseExpireDate": "Choose expire date",
33-
"username": "Pastebin Username",
34-
"password": "Pastebin Password"
35-
},
36-
"github": {
37-
"service": "GitHub Gist",
38-
"serviceAnym": "GitHub Gist (anonymous)",
39-
"username": "GitHub Username",
40-
"password": "GitHub Password",
41-
"description":"Description of your file"
42-
},
43-
"publishedMessage": "Your File is published here: ",
44-
"fileNotFound": "No file for sharing found. Please open one in edit mode.",
45-
"public": "public",
46-
"unlisted": "unlisted",
47-
"private": "private",
48-
"never": "never",
49-
"minute": "{{count}} minute",
50-
"minute_plural": "{{count}} minutes",
51-
"hour": "{{count}} hour",
52-
"day": "{{count}} day",
53-
"week": "{{count}} week",
54-
"week_plural": "{{count}} weeks",
55-
"month": "{{count}} month"
56-
}
57-
},
58-
"de": {
59-
"translation": {
60-
"pastebin": {
61-
"service": "Pastebin",
62-
"serviceAnym": "Pastebin (anonym)",
63-
"choosePrivacy": "Sichtbarkeit auswählen",
64-
"chooseExpireDate": "Ablaufdatum auswählen",
65-
"username": "Pastebin Benutzername",
66-
"password": "Pastebin Passwort"
67-
},
68-
"github": {
69-
"service": "GitHub Gist",
70-
"serviceAnym": "GitHub Gist (anonym)",
71-
"username": "GitHub Benutzername",
72-
"password": "GitHub Passwort",
73-
"description":"Beschreibung der Datei"
74-
},
75-
"publishedMessage": "Deine Datei wurde hier veröffentlicht: ",
76-
"fileNotFound": "Keine Detei zum teilen gefunden. Bitte öffnen Sie eine im Bearbeitungsmodus.",
77-
"public": "öffentlich",
78-
"unlisted": "nicht gelistet",
79-
"private": "privat",
80-
"never": "niemals",
81-
"minute": "{{count}} Minute",
82-
"minute_plural": "{{count}} Minuten",
83-
"hour": "{{count}} Stunde",
84-
"day": "{{count}} Tag",
85-
"week": "{{count}} Woche",
86-
"week_plural": "{{count}} Wochen",
87-
"month": "{{count}} Monat"
88-
}
89-
}
90-
},
91-
"fallbackLng": "en-US"
92-
});
93109
// The code you place here will be executed every time your command is executed
94110
// Convert fullpath to filename
95111
if (vscode.window.activeTextEditor != null)
96112
{
97-
let sc = new sharecode.sharecode()
98-
sc.start()
113+
let sc = new ShareCode.ShareCode()
114+
sc.share()
99115
} else
100116
{
101117
vscode.window.showErrorMessage(i18next.t("fileNotFound"))
102118
}
103119
});
104120

105-
context.subscriptions.push(disposable);
121+
let open = vscode.commands.registerCommand("extension.shareCode.open", () =>
122+
{
123+
// The code you place here will be executed every time your command is executed
124+
// Convert fullpath to filename
125+
let sc = new ShareCode.ShareCode()
126+
sc.open()
127+
});
128+
129+
context.subscriptions.push(share, open)
106130
}
107131

108132
// this method is called when your extension is deactivated
109133
export function deactivate()
110-
{
111-
}
134+
{}

0 commit comments

Comments
 (0)