From a5514f2929a0a2c33e1c5b03984118c4b3bbf538 Mon Sep 17 00:00:00 2001 From: Christopher Dignam Date: Sat, 7 Mar 2026 16:56:48 -0500 Subject: [PATCH 1/5] add activation events --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index d25742a..502a795 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "categories": [ "Other" ], + "activationEvents": [], "main": "./out/extension.js", "contributes": { "commands": [ From 2afb7588a295bedfa264d29330a39713d6f53516 Mon Sep 17 00:00:00 2001 From: Christopher Dignam Date: Wed, 11 Mar 2026 19:55:10 -0400 Subject: [PATCH 2/5] first line selection --- CHANGELOG.md | 4 ++++ src/providers.ts | 4 ++++ src/test/suite/providers.test.ts | 41 ++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6bfff59..5e7f214 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed + +- When first line is focused, without a selection, show the whole file on GitHub (#74) + ## 3.4.0 - 2026-03-07 ### Changed diff --git a/src/providers.ts b/src/providers.ts index 8321b21..4bfeaa5 100644 --- a/src/providers.ts +++ b/src/providers.ts @@ -113,6 +113,10 @@ export class Github extends BaseProvider { PROVIDER_NAME = "github" buildLines({ start, end }: ISelection): string { + if (start.line === end.line && start.character === end.character) { + return "" + } + let line = `L${start.line + 1}` if (start.character !== 0) { line += `C${start.character + 1}` diff --git a/src/test/suite/providers.test.ts b/src/test/suite/providers.test.ts index 8531687..f2a3c71 100644 --- a/src/test/suite/providers.test.ts +++ b/src/test/suite/providers.test.ts @@ -150,6 +150,47 @@ suite("Github", async () => { assert.deepEqual(result, expected) } }) + test("if we have no selection on the first line, don't select anything", async () => { + for (let url of [ + "git@github.mycompany.com:recipeyak/recipeyak.git", + "git@github.mycompany.com:recipeyak/recipeyak", + "org-XYZ123@github.mycompany.com:recipeyak/recipeyak", + "ssh://git@github.mycompany.com/recipeyak/recipeyak.git", + ]) { + async function findRemote(hostname: string) { + return url + } + const gh = new Github( + { + github: { hostnames: ["github.mycompany.com"] }, + }, + "origin", + findRemote, + ) + const result = await gh.getUrls({ + selection: { + start: { line: 0, character: 0 }, + end: { line: 0, character: 0 }, + }, + head: createBranch("master"), + relativeFilePath: "frontend/src/components/App.tsx", + }) + const expected = { + blobUrl: + "https://github.mycompany.com/recipeyak/recipeyak/blob/master/frontend/src/components/App.tsx", + blameUrl: + "https://github.mycompany.com/recipeyak/recipeyak/blame/master/frontend/src/components/App.tsx", + compareUrl: + "https://github.mycompany.com/recipeyak/recipeyak/compare/master", + historyUrl: + "https://github.mycompany.com/recipeyak/recipeyak/commits/master/frontend/src/components/App.tsx", + prUrl: + "https://github.mycompany.com/recipeyak/recipeyak/pull/new/master", + repoUrl: "https://github.mycompany.com/recipeyak/recipeyak", + } + assert.deepEqual(result, expected) + } + }) }) suite("Gitlab", async () => { From d6becf88eaa70ef1b3babde98a3b992146be3460 Mon Sep 17 00:00:00 2001 From: Christopher Dignam Date: Mon, 16 Mar 2026 22:05:08 -0400 Subject: [PATCH 3/5] refactor --- src/test/suite/providers.test.ts | 59 +++++++++++--------------------- 1 file changed, 20 insertions(+), 39 deletions(-) diff --git a/src/test/suite/providers.test.ts b/src/test/suite/providers.test.ts index 20ae819..ef7a1c3 100644 --- a/src/test/suite/providers.test.ts +++ b/src/test/suite/providers.test.ts @@ -151,45 +151,26 @@ suite("Github", async () => { } }) test("if we have no selection on the first line, don't select anything", async () => { - for (let url of [ - "git@github.mycompany.com:recipeyak/recipeyak.git", - "git@github.mycompany.com:recipeyak/recipeyak", - "org-XYZ123@github.mycompany.com:recipeyak/recipeyak", - "ssh://git@github.mycompany.com/recipeyak/recipeyak.git", - ]) { - async function findRemote(hostname: string) { - return url - } - const gh = new Github( - { - github: { hostnames: ["github.mycompany.com"] }, - }, - "origin", - findRemote, - ) - const result = await gh.getUrls({ - selection: { - start: { line: 0, character: 0 }, - end: { line: 0, character: 0 }, - }, - head: createBranch("master"), - relativeFilePath: "frontend/src/components/App.tsx", - }) - const expected = { - blobUrl: - "https://github.mycompany.com/recipeyak/recipeyak/blob/master/frontend/src/components/App.tsx", - blameUrl: - "https://github.mycompany.com/recipeyak/recipeyak/blame/master/frontend/src/components/App.tsx", - compareUrl: - "https://github.mycompany.com/recipeyak/recipeyak/compare/master", - historyUrl: - "https://github.mycompany.com/recipeyak/recipeyak/commits/master/frontend/src/components/App.tsx", - prUrl: - "https://github.mycompany.com/recipeyak/recipeyak/pull/new/master", - repoUrl: "https://github.mycompany.com/recipeyak/recipeyak", - } - assert.deepEqual(result, expected) - } + const gh = new Github( + { + github: { hostnames: ["github.mycompany.com"] }, + }, + "origin", + async () => "git@github.mycompany.com:recipeyak/recipeyak.git", + ) + const result = await gh.getUrls({ + selection: { + start: { line: 0, character: 0 }, + end: { line: 0, character: 0 }, + }, + head: createBranch("master"), + relativeFilePath: "frontend/src/components/App.tsx", + }) + + assert.deepEqual( + result?.blameUrl, + "https://github.mycompany.com/recipeyak/recipeyak/blob/master/frontend/src/components/App.tsx", + ) }) }) From 3ac0cea93c8f8c5b27a6de9939942b54deb87422 Mon Sep 17 00:00:00 2001 From: Christopher Dignam Date: Mon, 16 Mar 2026 22:06:45 -0400 Subject: [PATCH 4/5] . --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d5a895..f1eaa39 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Extension now calls `git` instead of manually reading `.git/` files. (#75) -- When first line is focused, without a selection, show the whole file on GitHub (#74) +- When there is no selection, link to the whole file on GitHub (#74) ## 3.4.0 - 2026-03-07 From a66fca8c17509191c10465a1a7df63e62f023057 Mon Sep 17 00:00:00 2001 From: Christopher Dignam Date: Mon, 16 Mar 2026 22:08:12 -0400 Subject: [PATCH 5/5] fix test --- src/test/suite/providers.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/suite/providers.test.ts b/src/test/suite/providers.test.ts index ef7a1c3..17cd952 100644 --- a/src/test/suite/providers.test.ts +++ b/src/test/suite/providers.test.ts @@ -168,7 +168,7 @@ suite("Github", async () => { }) assert.deepEqual( - result?.blameUrl, + result?.blobUrl, "https://github.mycompany.com/recipeyak/recipeyak/blob/master/frontend/src/components/App.tsx", ) })