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
44import * as vscode from 'vscode' ;
5- import { sharecode } from './sharecode' ;
5+ import { ShareCode , ShareCodeClasses } from './sharecode' ;
66let 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
109133export function deactivate ( )
110- {
111- }
134+ { }
0 commit comments