Skip to content

Commit 3be04a4

Browse files
committed
Only add column offsets when they are non-zero for GitHub.
1 parent a41fef1 commit 3be04a4

3 files changed

Lines changed: 20 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## 3.3.0 - 2025-11-05
11+
12+
### Changed
13+
14+
- Only add column offsets when they are non-zero for GitHub.
15+
1016
## 3.2.2 - 2025-07-02
1117

1218
### Fixed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "githubinator",
33
"displayName": "Githubinator",
44
"description": "Quickly open files on Github and other providers. View blame information, copy permalinks and more. See the \"commands\" section of the README for more details.",
5-
"version": "3.2.2",
5+
"version": "3.3.0",
66
"publisher": "chdsbd",
77
"license": "SEE LICENSE IN LICENSE",
88
"icon": "images/logo256.png",

src/providers.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,18 @@ export function pathJoin(...args: string[]): string {
111111
export class Github extends BaseProvider {
112112
DEFAULT_HOSTNAMES = ["github.com"]
113113
PROVIDER_NAME = "github"
114+
115+
buildLines({ start, end }: ISelection): string {
116+
let line = `L${start.line + 1}`
117+
if (start.character !== 0) {
118+
line += `C${start.character + 1}`
119+
}
120+
line += `-L${end.line + 1}`
121+
if (end.character !== 0) {
122+
line += `C${end.character + 1}`
123+
}
124+
return line
125+
}
114126
async getUrls({
115127
selection,
116128
head,
@@ -121,11 +133,7 @@ export class Github extends BaseProvider {
121133
return null
122134
}
123135
const rootUrl = `https://${repoInfo.hostname}/`
124-
const { start, end } = selection
125-
// Github uses 1-based indexing
126-
const lines = `L${start.line + 1}C${start.character + 1}-L${
127-
end.line + 1
128-
}C${end.character + 1}`
136+
const lines = this.buildLines(selection)
129137
const repoUrl = new url.URL(
130138
path.join(repoInfo.org, repoInfo.repo),
131139
rootUrl,

0 commit comments

Comments
 (0)