coc-discord-rpc
Advanced tools
Comparing version 3.0.2 to 3.0.3
@@ -9,3 +9,3 @@ import { Disposable, ExtensionContext, WorkspaceConfiguration } from 'coc.nvim'; | ||
ready(ctx?: ExtensionContext, _log?: boolean): void; | ||
setActivity(): Promise<void>; | ||
setActivity(workspaceElapsedTime?: boolean): Promise<void>; | ||
dispose(): Promise<void>; | ||
@@ -12,0 +12,0 @@ disconnect(): Promise<void>; |
@@ -60,17 +60,17 @@ "use strict"; | ||
} | ||
void this.setActivity(); | ||
void this.setActivity(this.config.get('workspaceElapsedTime')); | ||
activityTimer = setInterval(() => { | ||
this.config = coc_nvim_1.workspace.getConfiguration('rpc'); | ||
void this.setActivity(); | ||
void this.setActivity(this.config.get('workspaceElapsedTime')); | ||
}, 1000); | ||
} | ||
async setActivity() { | ||
async setActivity(workspaceElapsedTime = false) { | ||
if (!this.rpc) { | ||
return; | ||
} | ||
const activity = await this.activity.generate(); | ||
const activity = await this.activity.generate(workspaceElapsedTime); | ||
if (!activity) { | ||
return; | ||
} | ||
void this.rpc.setActivity(activity); | ||
this.rpc.setActivity(activity); | ||
} | ||
@@ -77,0 +77,0 @@ async dispose() { |
@@ -1,4 +0,12 @@ | ||
import type { Presence } from 'discord-rpc'; | ||
import type RPClient from '../client/Client'; | ||
import { Disposable } from 'coc.nvim'; | ||
interface State { | ||
details?: string; | ||
state?: string; | ||
startTimestamp?: number | null; | ||
largeImageKey?: string; | ||
largeImageText?: string; | ||
smallImageKey?: string; | ||
smallImageText?: string; | ||
} | ||
export default class Activity implements Disposable { | ||
@@ -8,3 +16,3 @@ private readonly client; | ||
constructor(client: RPClient); | ||
generate(): Promise<Presence>; | ||
generate(workspaceElapsedTime?: boolean): Promise<State>; | ||
dispose(): void; | ||
@@ -14,2 +22,3 @@ private _generateDetails; | ||
} | ||
export {}; | ||
//# sourceMappingURL=Activity.d.ts.map |
@@ -23,6 +23,6 @@ "use strict"; | ||
writable: true, | ||
value: void 0 | ||
value: null | ||
}); | ||
} | ||
async generate() { | ||
async generate(workspaceElapsedTime = false) { | ||
var _a, _b, _c; | ||
@@ -66,7 +66,9 @@ let largeImageKey = 'neovim-logo'; | ||
...this._state, | ||
startTimestamp: workspaceName && fileName && previousTimestamp | ||
? previousTimestamp | ||
: workspaceName && fileName | ||
? new Date().getTime() | ||
: undefined, | ||
startTimestamp: workspaceElapsedTime | ||
? workspaceName && fileName && previousTimestamp | ||
? previousTimestamp | ||
: workspaceName && fileName | ||
? new Date().getTime() | ||
: null | ||
: null, | ||
details: await this._generateDetails('detailsEditing', 'detailsIdle', largeImageKey), | ||
@@ -92,3 +94,3 @@ state: await this._generateDetails('lowerDetailsEditing', 'lowerDetailsIdle', largeImageKey), | ||
dispose() { | ||
this._state = undefined; | ||
this._state = null; | ||
} | ||
@@ -95,0 +97,0 @@ async _generateDetails(editing, idling, largeImageKey) { |
@@ -1,2 +0,2 @@ | ||
export declare const version = "3.0.2"; | ||
export declare const version = "3.0.3"; | ||
//# sourceMappingURL=version.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.version = void 0; | ||
exports.version = '3.0.2'; | ||
exports.version = '3.0.3'; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "coc-discord-rpc", | ||
"version": "3.0.2", | ||
"version": "3.0.3", | ||
"description": "An awesome coc-extension to get Discord Rich Presence integration with NeoVim.", | ||
@@ -174,2 +174,7 @@ "main": "lib/index.js", | ||
}, | ||
"rpc.workspaceElapsedTime": { | ||
"type": "boolean", | ||
"default": false, | ||
"description": "Controls if the RPC should display elapsed time for a workspace or a single file." | ||
}, | ||
"rpc.ignoreWorkspaces": { | ||
@@ -176,0 +181,0 @@ "type": "array", |
@@ -89,2 +89,7 @@ <p align="center"> | ||
#### **rpc.workspaceElapsedTime** | ||
Controls if the RPC should display elapsed time for a workspace or a single file. | ||
Default: `false` | ||
#### **rpc.detailsEditing** | ||
@@ -91,0 +96,0 @@ Custom string for the details section of the rich presence. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
67336
874
258