@@ -28,7 +28,7 @@ export class Storage {
28
28
* If the URL is falsey, then remove it as the last used URL and do not touch
29
29
* the history.
30
30
*/
31
- public async setURL ( url ?: string ) : Promise < void > {
31
+ public async setUrl ( url ?: string ) : Promise < void > {
32
32
await this . memento . update ( "url" , url )
33
33
if ( url ) {
34
34
const history = this . withUrlHistory ( url )
@@ -85,9 +85,11 @@ export class Storage {
85
85
}
86
86
}
87
87
88
- // getRemoteSSHLogPath returns the log path for the "Remote - SSH" output panel.
89
- // There is no VS Code API to get the contents of an output panel. We use this
90
- // to get the active port so we can display network information.
88
+ /**
89
+ * Returns the log path for the "Remote - SSH" output panel. There is no VS
90
+ * Code API to get the contents of an output panel. We use this to get the
91
+ * active port so we can display network information.
92
+ */
91
93
public async getRemoteSSHLogPath ( ) : Promise < string | undefined > {
92
94
const upperDir = path . dirname ( this . logUri . fsPath )
93
95
// Node returns these directories sorted already!
@@ -368,18 +370,30 @@ export class Storage {
368
370
: path . join ( this . globalStorageUri . fsPath , "bin" )
369
371
}
370
372
371
- // getNetworkInfoPath returns the path where network information
372
- // for SSH hosts is stored.
373
+ /**
374
+ * Return the path where network information for SSH hosts are stored.
375
+ *
376
+ * The CLI will write files here named after the process PID.
377
+ */
373
378
public getNetworkInfoPath ( ) : string {
374
379
return path . join ( this . globalStorageUri . fsPath , "net" )
375
380
}
376
381
377
- // getLogPath returns the path where log data from the Coder
378
- // agent is stored.
382
+ /**
383
+ *
384
+ * Return the path where log data from the connection is stored.
385
+ *
386
+ * The CLI will write files here named after the process PID.
387
+ */
379
388
public getLogPath ( ) : string {
380
389
return path . join ( this . globalStorageUri . fsPath , "log" )
381
390
}
382
391
392
+ /**
393
+ * Get the path to the user's settings.json file.
394
+ *
395
+ * Going through VSCode's API should be preferred when modifying settings.
396
+ */
383
397
public getUserSettingsPath ( ) : string {
384
398
return path . join ( this . globalStorageUri . fsPath , ".." , ".." , ".." , "User" , "settings.json" )
385
399
}
@@ -406,7 +420,7 @@ export class Storage {
406
420
*
407
421
* The caller must ensure this directory exists before use.
408
422
*/
409
- public getURLPath ( label : string ) : string {
423
+ public getUrlPath ( label : string ) : string {
410
424
return label
411
425
? path . join ( this . globalStorageUri . fsPath , label , "url" )
412
426
: path . join ( this . globalStorageUri . fsPath , "url" )
@@ -434,7 +448,7 @@ export class Storage {
434
448
* If the label is empty, read the old deployment-unaware config instead.
435
449
*/
436
450
private async updateUrlForCli ( label : string , url : string | undefined ) : Promise < void > {
437
- const urlPath = this . getURLPath ( label )
451
+ const urlPath = this . getUrlPath ( label )
438
452
if ( url ) {
439
453
await fs . mkdir ( path . dirname ( urlPath ) , { recursive : true } )
440
454
await fs . writeFile ( urlPath , url )
@@ -467,7 +481,7 @@ export class Storage {
467
481
* If the label is empty, read the old deployment-unaware config.
468
482
*/
469
483
public async readCliConfig ( label : string ) : Promise < { url : string ; token : string } > {
470
- const urlPath = this . getURLPath ( label )
484
+ const urlPath = this . getUrlPath ( label )
471
485
const tokenPath = this . getSessionTokenPath ( label )
472
486
const [ url , token ] = await Promise . allSettled ( [ fs . readFile ( urlPath , "utf8" ) , fs . readFile ( tokenPath , "utf8" ) ] )
473
487
return {
0 commit comments