From 3bca1c8fa6256ef625603ce663d8543eee6f7b73 Mon Sep 17 00:00:00 2001 From: iCrawl Date: Thu, 23 Nov 2017 20:43:10 +0100 Subject: [PATCH] feat: add support for workspace names and more icons --- .vscodeignore | 1 - package.json | 1 + src/extension.ts | 8 +++----- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.vscodeignore b/.vscodeignore index ae2e23b..9ca82e6 100644 --- a/.vscodeignore +++ b/.vscodeignore @@ -3,7 +3,6 @@ test/** .gitattributes .gitignore -*.md tsconfig.json tslint.json yarn.lock diff --git a/package.json b/package.json index 9211c4e..451f445 100644 --- a/package.json +++ b/package.json @@ -56,6 +56,7 @@ "homepage": "https://github.com/iCrawl/discord-vscode#readme", "icon": "assets/icon.png", "galleryBanner": { + "color": "#6477C1", "theme": "dark" }, "dependencies": { diff --git a/src/extension.ts b/src/extension.ts index dec4982..a90ff4e 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -21,15 +21,13 @@ function setActivity(rpc: Client): void { if (!rpc) return; const activity = { details: window.activeTextEditor ? `Editing ${basename(window.activeTextEditor.document.fileName)}` : 'Idle.', - state: typeof workspace.workspaceFolders !== 'undefined' ? `Workspaces: ${workspace.workspaceFolders.map(folder => folder.name).join(' | ')}` : 'Idling.', + state: window.activeTextEditor ? `Workspace: ${workspace.getWorkspaceFolder(window.activeTextEditor.document.uri).name}` : 'Idling.', startTimestamp: new Date().getTime() / 1000, - largeImageKey: window.activeTextEditor ? extname(basename(window.activeTextEditor.document.fileName)).substring(1) : 'vscode-big', + largeImageKey: window.activeTextEditor ? extname(basename(window.activeTextEditor.document.fileName)).substring(1) || basename(window.activeTextEditor.document.fileName).substring(1) || 'vscode-big' : 'vscode-big', largeImageText: window.activeTextEditor ? window.activeTextEditor.document.languageId : 'Idling.', smallImageKey: 'vscode', smallImageText: 'Visual Studio Code', instance: false }; - rpc.setActivity(activity).catch(error => - window.showErrorMessage(`DiscordRPC: ${error.message}`) - ); + rpc.setActivity(activity); }