File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212### Changed
1313
1414- Extension now calls ` git ` instead of manually reading ` .git/ ` files. (#75 )
15+ - When there is no selection, link to the whole file on GitHub (#74 )
1516
1617## 3.4.0 - 2026-03-07
1718
Original file line number Diff line number Diff line change @@ -113,6 +113,10 @@ export class Github extends BaseProvider {
113113 PROVIDER_NAME = "github"
114114
115115 buildLines ( { start, end } : ISelection ) : string {
116+ if ( start . line === end . line && start . character === end . character ) {
117+ return ""
118+ }
119+
116120 let line = `L${ start . line + 1 } `
117121 if ( start . character !== 0 ) {
118122 line += `C${ start . character + 1 } `
Original file line number Diff line number Diff line change @@ -150,6 +150,28 @@ suite("Github", async () => {
150150 assert . deepEqual ( result , expected )
151151 }
152152 } )
153+ test ( "if we have no selection on the first line, don't select anything" , async ( ) => {
154+ const gh = new Github (
155+ {
156+ github : { hostnames : [ "github.mycompany.com" ] } ,
157+ } ,
158+ "origin" ,
159+ async ( ) => "git@github.mycompany.com:recipeyak/recipeyak.git" ,
160+ )
161+ const result = await gh . getUrls ( {
162+ selection : {
163+ start : { line : 0 , character : 0 } ,
164+ end : { line : 0 , character : 0 } ,
165+ } ,
166+ head : createBranch ( "master" ) ,
167+ relativeFilePath : "frontend/src/components/App.tsx" ,
168+ } )
169+
170+ assert . deepEqual (
171+ result ?. blobUrl ,
172+ "https://github.mycompany.com/recipeyak/recipeyak/blob/master/frontend/src/components/App.tsx" ,
173+ )
174+ } )
153175} )
154176
155177suite ( "Gitlab" , async ( ) => {
You can’t perform that action at this time.
0 commit comments