From a7183eaecef7056adb717600e40745508d7e2f11 Mon Sep 17 00:00:00 2001 From: Mopsgamer <79159094+Mopsgamer@users.noreply.github.com> Date: Tue, 6 Jan 2026 20:33:10 +0100 Subject: [PATCH 1/4] fix: debug --- esbuild.js | 2 +- package.json | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/esbuild.js b/esbuild.js index 36a12597..210a1e86 100644 --- a/esbuild.js +++ b/esbuild.js @@ -32,7 +32,7 @@ async function main() { sourcemap: !production, sourcesContent: false, platform: "node", - outfile: "dist/extension.js", + outfile: "dist/extension.cjs", external: ["vscode"], logLevel: "silent", plugins: [ diff --git a/package.json b/package.json index d0f5d07c..d450c6af 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,8 @@ "activationEvents": [ "onStartupFinished" ], - "main": "dist/extension.js", + "main": "dist/extension.cjs", + "type": "module", "private": true, "icon": "assets/icon.png", "scripts": { From ff0dd9e702869181e1c51e11876b34873df91189 Mon Sep 17 00:00:00 2001 From: Mopsgamer <79159094+Mopsgamer@users.noreply.github.com> Date: Tue, 6 Jan 2026 21:08:14 +0100 Subject: [PATCH 2/4] fix: activity switching chore: gitRemoteUrl messages --- src/controller.ts | 38 +++++++++++++++++++++----------------- src/data.ts | 15 +++++++++++---- 2 files changed, 32 insertions(+), 21 deletions(-) diff --git a/src/controller.ts b/src/controller.ts index ef1d2e6f..e645418a 100644 --- a/src/controller.ts +++ b/src/controller.ts @@ -72,33 +72,38 @@ export class RPCController { private listen() { const config = getConfig(); - const sendActivity = (isViewing = false, isIdling = false) => { - this.activityThrottle.reset(); - void this.sendActivity(isViewing, isIdling); - }; - - const fileSwitch = window.onDidChangeActiveTextEditor(() => { + const fileSwitch = window.onDidChangeActiveTextEditor((e) => { logInfo("onDidChangeActiveTextEditor()"); - sendActivity(true); + if (e) this.activityThrottle.reset(); + if (!e) { + setTimeout(() => { + this.checkIdle(window.state); + }, 500); + } else { + void this.activityThrottle.callable(); + } }); const fileEdit = workspace.onDidChangeTextDocument((e) => { if (e.document !== dataClass.editor?.document) return; logInfo("onDidChangeTextDocument()"); - dataClass.updateGitInfo(); + this.activityThrottle.reset(); void this.activityThrottle.callable(); }); const fileSelectionChanged = window.onDidChangeTextEditorSelection((e) => { if (e.textEditor !== dataClass.editor) return; logInfo("onDidChangeTextEditorSelection()"); - dataClass.updateGitInfo(); + this.activityThrottle.reset(); + void this.activityThrottle.callable(); + }); + const debugStart = debug.onDidStartDebugSession(() => { + void this.activityThrottle.callable(); + }); + const debugEnd = debug.onDidTerminateDebugSession(() => { void this.activityThrottle.callable(); }); - const debugStart = debug.onDidStartDebugSession(() => sendActivity()); - const debugEnd = debug.onDidTerminateDebugSession(() => sendActivity()); const diagnosticsChange = languages.onDidChangeDiagnostics(() => onDiagnosticsChange()); const changeWindowState = window.onDidChangeWindowState((e: WindowState) => { logInfo("onDidChangeWindowState()"); - dataClass.updateGitInfo(); this.checkIdle(e); }); @@ -127,7 +132,7 @@ export class RPCController { return (this.canSendActivity = true); } - private async checkIdle(windowState: WindowState) { + private checkIdle(windowState: WindowState) { if (!this.enabled) return; const config = getConfig(); @@ -135,7 +140,7 @@ export class RPCController { if (config.get(CONFIG_KEYS.Status.Idle.Timeout) !== 0) { if (windowState.focused && this.idleTimeout) { clearTimeout(this.idleTimeout); - await this.sendActivity(); + void this.activityThrottle.callable(); } else if (config.get(CONFIG_KEYS.Status.Idle.Check)) { this.idleTimeout = setTimeout( async () => { @@ -150,8 +155,7 @@ export class RPCController { if (!this.enabled) return; - this.activityThrottle.reset(); - await this.sendActivity(false, true); + void this.activityThrottle.callable(false, true); }, config.get(CONFIG_KEYS.Status.Idle.Timeout)! * 1000 ); @@ -220,7 +224,7 @@ export class RPCController { editor.setStatusBarItem(StatusBarMode.Succeeded); logInfo("[004] Debug:", "Enabled - isConnected", this.client.isConnected, "isReady", this.client.clientId); - await this.sendActivity(); + await this.activityThrottle.callable(); this.cleanUp(); this.listen(); diff --git a/src/data.ts b/src/data.ts index 10ac0f88..10952ee2 100644 --- a/src/data.ts +++ b/src/data.ts @@ -159,15 +159,22 @@ export class Data implements Disposable { return v; } + #lastValidGitRemoteUrl = ""; + public get gitRemoteUrl(): gitUrlParse.GitUrl | undefined { - this.debug(`gitRemoteUrl(): Remote: ${this._remote}`); const v = stripCredential(this._remote?.fetchUrl ?? this._remote?.pushUrl ?? ""); - this.debug(`gitRemoteUrl(): Url: ${v ?? ""}`); if (!v) return; - logInfo(`gitRemoteUrl(): Parsed: ${JSON.stringify(gitUrlParse(v), null, 2)}`); + const parsed = gitUrlParse(v); + + if (this.#lastValidGitRemoteUrl !== v) { + this.#lastValidGitRemoteUrl = v; + this.debug(`gitRemoteUrl(): Remote: ${this._remote}`); + this.debug(`gitRemoteUrl(): Url: ${v ?? ""}`); + logInfo(`gitRemoteUrl(): Parsed: ${JSON.stringify(parsed, null, 2)}`); + } - return gitUrlParse(v); + return parsed; } public get gitBranchName(): string | undefined { From 60c588454188b25d541e7ea346e4af65e3e75daf Mon Sep 17 00:00:00 2001 From: Mopsgamer <79159094+Mopsgamer@users.noreply.github.com> Date: Tue, 6 Jan 2026 21:53:14 +0100 Subject: [PATCH 3/4] chore: now using esm --- esbuild.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esbuild.js b/esbuild.js index 210a1e86..c650c6c9 100644 --- a/esbuild.js +++ b/esbuild.js @@ -1,4 +1,4 @@ -const esbuild = require("esbuild"); +import esbuild from "esbuild"; const production = process.argv.includes("--production"); const watch = process.argv.includes("--watch"); From 91a589a7e3332aee17ac5f6ad325607d7ad09416 Mon Sep 17 00:00:00 2001 From: Mopsgamer <79159094+Mopsgamer@users.noreply.github.com> Date: Tue, 6 Jan 2026 21:55:40 +0100 Subject: [PATCH 4/4] style: if --- src/controller.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/controller.ts b/src/controller.ts index e645418a..475b1152 100644 --- a/src/controller.ts +++ b/src/controller.ts @@ -74,14 +74,14 @@ export class RPCController { const fileSwitch = window.onDidChangeActiveTextEditor((e) => { logInfo("onDidChangeActiveTextEditor()"); - if (e) this.activityThrottle.reset(); - if (!e) { - setTimeout(() => { - this.checkIdle(window.state); - }, 500); - } else { + if (e) { + this.activityThrottle.reset(); void this.activityThrottle.callable(); + return; } + setTimeout(() => { + this.checkIdle(window.state); + }, 500); }); const fileEdit = workspace.onDidChangeTextDocument((e) => { if (e.document !== dataClass.editor?.document) return;