Skip to content

Commit

Permalink
First release
Browse files Browse the repository at this point in the history
  • Loading branch information
maxerbox committed Nov 24, 2017
1 parent 7188933 commit 826f016
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 12 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,12 @@ Rewritten Discord Register

* Removed Discord Registers for other Os than Windows.
* Added python support
* Added a VSCode disposable client, to let the Rich Presence reset when the process quit.
* Added a VSCode disposable client, to let the Rich Presence reset when the process quit.

## 1.0.0

* First realease

* Removed Registry

* Added a new option: show debug
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,16 @@

* Strings entirely modifiable

* Removed registery writing

## Requirements

* Discord client

## Can I get banned

Well, [someone already asked for it](https://github.com/maxerbox/vscode-discord/issues/3). I emailed the Discord Team, and that's totally fine, until your respect the discord conditions.

## Install

* Install the extension. The extension needs discord to be launched
Expand All @@ -30,6 +36,8 @@
This extension contributes the following settings:

* `discord.enable`: enable/disable this extension
* `discord.showDebug`: Show the debugging icon in the rich presence when debugging
* `discord.debugIconText`: The small image debug text when debugging
* `discord.clientID`: the client ID used by discord-rpc
* `discord.state`: The dicord rich presence state. Default to `Working on {projectName}`. `{projectName}`:workspace name
* `discord.details`: The discord rpc details. Default to `Editing {filename}`. {filename}: filename, {language} : language id.
Expand Down Expand Up @@ -65,4 +73,12 @@ Rewritten Discord Register
* Added python support
* Added a VSCode disposable client, to let the Rich Presence reset when the process quit.

## 1.0.0

* First realease

* Removed Registry

* Added a new option: show debug

-----------------------------------------------------------------------------------------------------------
18 changes: 8 additions & 10 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ const vscode = require('vscode')
const {basename, extname} = require('path')
const DisposableClient = require('./lib/DisposableClient')
const format = require('string-template')
const DiscordRegisterWin = require('./lib/DiscordRegisterWindows')
// const DiscordRegisterWin = require('./lib/DiscordRegisterWindows')
var configuration
var client
var isReady = false
var lastFileEditing = ''
var startTimestamp
var contextSave
const VSCODE_PATH = process.execPath
// const VSCODE_PATH = process.execPath
// this method is called when your extension is activated
// your extension is activated the very first time the command is executed
function activate (context) {
Expand All @@ -20,12 +20,13 @@ function activate (context) {
console.log(process.version)
context.subscriptions.push(vscode.commands.registerCommand('discord.updatePresence', updatePresence), vscode.commands.registerCommand('discord.enable', enable), vscode.commands.registerCommand('discord.disable', disable))
if (!configuration.enable) return
if (process.platform === 'win32') {
/* if (process.platform === 'win32') {
var discordRegister = new DiscordRegisterWin(configuration.clientID, VSCODE_PATH)
discordRegister.register().then(function () {
startClient()
}).catch(err => vscode.window.showErrorMessage('vscode discord registering error: ' + err.message))
} else startClient()
} else */
startClient()
}
function startClient () {
client = new DisposableClient({ transport: 'ipc' })
Expand All @@ -34,10 +35,6 @@ function startClient () {
// This line of code will only be executed once when your extension is activated
client.on('ready', () => {
isReady = true
vscode.workspace.onDidChangeTextDocument = updatePresence
vscode.workspace.onDidCloseTextDocument = function () {
console.log('closed')
}
console.log('Discord-rpc ready')
updatePresence()
setInterval(updatePresence, configuration.interval)
Expand Down Expand Up @@ -69,9 +66,10 @@ exports.deactivate = deactivate
function updatePresence () {
if (!isReady) return
if (!vscode.workspace.getConfiguration('discord').get('enable', true)) return
var debugShow = vscode.debug.activeDebugSession && configuration.showDebug
var activityObject = {
smallImageKey: 'vscode',
smallImageText: configuration.vscodeIconText
smallImageKey: debugShow ? 'debug' : 'vscode',
smallImageText: debugShow ? configuration.debugIconText : configuration.vscodeIconText
}
if (vscode.workspace.name) activityObject.state = format(configuration.state, {projectName: vscode.workspace.name})
if (vscode.window.activeTextEditor) {
Expand Down
12 changes: 11 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vscode-discord",
"displayName": "vscode-discord",
"description": "Display your current project on vscode in discord with Rich Presence",
"version": "0.0.3",
"version": "1.0.0",
"publisher": "maxerbox",
"engines": {
"vscode": "^1.18.0"
Expand Down Expand Up @@ -52,6 +52,16 @@
"default": true,
"description": "Enable vscode-discord"
},
"discord.showDebug": {
"type": "boolean",
"default": true,
"description": "Show the debugging icon in the rich presence when debugging"
},
"discord.debugIconText": {
"type": "string",
"default": "Debugging",
"description": "The small image debug text when debugging"
},
"discord.details": {
"type": "string",
"default": "Editing {filename}",
Expand Down

0 comments on commit 826f016

Please sign in to comment.