Skip to content

Commit 529fbca

Browse files
committed
gitlab support added
1 parent 0a23d58 commit 529fbca

9 files changed

Lines changed: 3830 additions & 20 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### Version 0.4.0
2+
* GitLab support
3+
* Changelog moved to sperated file
4+
15
### Version 0.3.0
26
* Menu items added
37
* Share selected text

README.md

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
1-
[![](http://vsmarketplacebadge.apphb.com/version/RolandGreim.sharecode.svg)](https://marketplace.visualstudio.com/items?itemName=RolandGreim.sharecode)
2-
[![](http://vsmarketplacebadge.apphb.com/installs/RolandGreim.sharecode.svg)](https://marketplace.visualstudio.com/items?itemName=RolandGreim.sharecode)
3-
1+
[![](http://vsmarketplacebadge.apphb.com/version-short/RolandGreim.sharecode.svg)](https://marketplace.visualstudio.com/items?itemName=RolandGreim.sharecode)
2+
[![](http://vsmarketplacebadge.apphb.com/installs-short/RolandGreim.sharecode.svg)](https://marketplace.visualstudio.com/items?itemName=RolandGreim.sharecode)
3+
4+
## Features
5+
### Supports on Pastebin and Github Gist
6+
* share code
7+
* open shared files
8+
* login with oauth
9+
10+
### Supports on GitLab
11+
* share code
12+
* open shared files
13+
14+
Please create a [Personal Access Tokens](https://gitlab.com/profile/personal_access_tokens) by hand
15+
16+
### Usability
17+
* select text for sharing
18+
* context menus
19+
420
## Usage
521

622
Press `Ctrl+Shift+P` and type in `Share Code`. Then you can select between Pastebin and GitHub Gist. *(anonymous)* means you don't have to login to share a file, but you can't edit or remove it later, when you choose this option.
@@ -14,14 +30,17 @@ HowTo upload a file to Github Gist:
1430
![alt tag](https://raw.githubusercontent.com/tigerxy/VSCode-ShareCode/master/images/gistAym.gif)
1531

1632
## Settings
17-
You can configure your Username. Go to `File > Preferences > User Settings` and add these Lines:
18-
33+
These settings are set automatically when you start the extension. You can also manually configure your user name and token. Go to `File > Preferences > User Settings` and add these lines:
1934
```
2035
{
21-
"shareCode.pastebin.username":"YourUserName",
22-
"shareCode.gist.username":"YourUserName"
36+
"shareCode.pastebin.username": "...",
37+
"shareCode.pastebin.authtoken": "...",
38+
"shareCode.github.username": "...",
39+
"shareCode.github.authtoken": "..."
2340
}
2441
```
42+
## Reset Github token
43+
Sometimes it is necessary to delete a token. Go to this [page](https://github.com/settings/tokens) and delete the token named `VSCode Share Code`.
2544

2645
## License
27-
GPLv3
46+
GPLv3

images/sharecode.png

9.64 KB
Loading

package.json

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
{
22
"name": "sharecode",
3-
"version": "0.3.1",
3+
"version": "0.4.0",
44
"publisher": "RolandGreim",
55
"engines": {
66
"vscode": "^1.6.0"
77
},
88
"license": "GPL-3.0",
99
"displayName": "Share Code",
10-
"description": "Share your Code on Pastebin or GitHub Gist.",
10+
"description": "Share your Code on GitHub Gist, GitLab or Pastebin.",
1111
"categories": [
1212
"Other"
1313
],
1414
"keywords": [
1515
"GitHub",
16+
"GitLab",
1617
"Pastebin",
1718
"Gist",
1819
"Upload",
@@ -71,6 +72,16 @@
7172
"type": "string",
7273
"default": null,
7374
"description": "GitHub Authentication Token."
75+
},
76+
"shareCode.gitlab.baseurl": {
77+
"type": "string",
78+
"default": "https://gitlab.com/",
79+
"description": "Baseurl of GitLab server."
80+
},
81+
"shareCode.gitlab.authtoken": {
82+
"type": "string",
83+
"default": null,
84+
"description": "GitLab Authentication Token."
7485
}
7586
}
7687
}
@@ -87,15 +98,15 @@
8798
"request": "^2.69.0",
8899
"request-promise": "^4.1.1",
89100
"underscore": "^1.8.3",
90-
"vscode": "^1.0.0",
101+
"vscode": "^1.0.3",
91102
"xml2js": "^0.4.16"
92103
},
93104
"devDependencies": {
94-
"typescript": "^2.0.3",
95-
"vscode": "^1.0.0",
96-
"mocha": "^2.3.3",
105+
"@types/mocha": "^2.2.32",
97106
"@types/node": "^6.0.40",
98-
"@types/mocha": "^2.2.32"
107+
"mocha": "^2.3.3",
108+
"typescript": "^2.1.4",
109+
"vscode": "^1.0.3"
99110
},
100111
"scripts": {
101112
"vscode:prepublish": "tsc -p ./",

src/extension.ts

Lines changed: 35 additions & 3 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, ShareCodeClasses} from './sharecode';
5+
import { ShareCode, ShareCodeClasses } from './sharecode';
66
let i18next = require('i18next');
77

88
// this method is called when your extension is activated
@@ -37,15 +37,31 @@ export function activate(context: vscode.ExtensionContext)
3737
"tokenExist": "Authtoken already exist. Please delete it on Github: https://github.com/settings/tokens"
3838
}
3939
},
40+
"gitlab": {
41+
"service": "GitLab",
42+
"public": "The snippet can be accessed without any authentication",
43+
"internal": "The snippet is visible for any logged in user",
44+
"private": "The snippet is visible only the snippet creator",
45+
"select": {
46+
"project": "select project",
47+
"snippet": "select snippet"
48+
},
49+
"token": {
50+
"generate": "Go to this {{url}}profile/personal_access_tokens page and generate a access token and insert it.",
51+
"baseUrl": "Insert url of your gitlab server."
52+
}
53+
},
4054
"errors": {
55+
"tokenWrongOrExpired": "Token is wrong or expired. Please renew it.",
4156
"blankUsernameOrPassword": "Username or password can not be blank.",
4257
"unexpectedErrorCode": "An unexpected error occurred. Please contact the developer. Code: {{code}}",
43-
"noDescription": "No description"
58+
"noDescription": "No description"
4459
},
4560
"publishedMessage": "Your File is published here: ",
4661
"fileNotFound": "No file for sharing found. Please open one in edit mode.",
4762
"public": "public",
4863
"unlisted": "unlisted",
64+
"internal": "internal",
4965
"private": "private",
5066
"never": "never",
5167
"minute": "{{count}} minute",
@@ -77,7 +93,22 @@ export function activate(context: vscode.ExtensionContext)
7793
"tokenExist": "Anmelde-Token wurde bereits erstellt. Bitte diesen auf Github löschen: https://github.com/settings/tokens"
7894
}
7995
},
96+
"gitlab": {
97+
"service": "GitLab",
98+
"public": "The snippet can be accessed without any authentication",
99+
"internal": "The snippet is visible for any logged in user",
100+
"private": "The snippet is visible only the snippet creator",
101+
"select": {
102+
"project": "Projekt auswählen",
103+
"snippet": "Snippet auswählen"
104+
},
105+
"token": {
106+
"generate": "Go to this {{url}}profile/personal_access_tokens page and generate a access token and insert it.",
107+
"baseUrl": "Insert url of your gitlab server."
108+
}
109+
},
80110
"errors": {
111+
"tokenWrongOrExpired": "Token ist falsch oder abgelaufen. Bitte neuen einstellen.",
81112
"blankUsernameOrPassword": "Benutzername oder Passwort dürfen nicht leer sein.",
82113
"unexpectedErrorCode": "Ein unerwarteter Fehler ist aufgetreten. Bitte kontaktieren sie den Entwickler. Code: {{code}}",
83114
"noDescription": "Keine Beschreibung"
@@ -86,6 +117,7 @@ export function activate(context: vscode.ExtensionContext)
86117
"fileNotFound": "Keine Detei zum teilen gefunden. Bitte öffnen Sie eine im Bearbeitungsmodus.",
87118
"public": "öffentlich",
88119
"unlisted": "nicht gelistet",
120+
"internal": "intern",
89121
"private": "privat",
90122
"never": "niemals",
91123
"minute": "{{count}} Minute",
@@ -131,4 +163,4 @@ export function activate(context: vscode.ExtensionContext)
131163

132164
// this method is called when your extension is deactivated
133165
export function deactivate()
134-
{}
166+
{ }

0 commit comments

Comments
 (0)