Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0e9fb55

Browse files
authored
Ensure an agent is always set when opening a workspace (#552)
This guarantees we open the same session each time, even if you click on the workspace rather than a specific agent.
1 parent2d7dac8 commit0e9fb55

File tree

3 files changed

+35
-15
lines changed

3 files changed

+35
-15
lines changed

‎CHANGELOG.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
update notifications.
99
- Coder output panel enhancements: All log entries now include timestamps, and you
1010
can filter messages by log level in the panel.
11+
- Consistently use the same session for each agent. Previously,
12+
depending on how you connected, it could be possible to get two
13+
different sessions for an agent. Existing connections may still
14+
have this problem, only new connections are fixed.
1115

1216
##[v1.9.2](https://github.com/coder/vscode-coder/releases/tag/v1.9.2) 2025-06-25
1317

‎src/commands.ts‎

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -437,12 +437,15 @@ export class Commands {
437437
if(!baseUrl){
438438
thrownewError("You are not logged in");
439439
}
440+
if(treeItem.primaryAgentName===undefined){
441+
return;
442+
}
440443
awaitopenWorkspace(
441444
baseUrl,
442445
treeItem.workspaceOwner,
443446
treeItem.workspaceName,
444-
treeItem.workspaceAgent,
445-
treeItem.workspaceFolderPath,
447+
treeItem.primaryAgentName,
448+
treeItem.primaryAgentFolderPath,
446449
true,
447450
);
448451
}else{
@@ -525,6 +528,8 @@ export class Commands {
525528
letfolderPath:string|undefined;
526529
letopenRecent:boolean|undefined;
527530

531+
letworkspace:Workspace|undefined;
532+
528533
constbaseUrl=this.restClient.getAxiosInstance().defaults.baseURL;
529534
if(!baseUrl){
530535
thrownewError("You are not logged in");
@@ -571,7 +576,7 @@ export class Commands {
571576
});
572577
});
573578
quickPick.show();
574-
constworkspace=awaitnewPromise<Workspace|undefined>((resolve)=>{
579+
workspace=awaitnewPromise<Workspace|undefined>((resolve)=>{
575580
quickPick.onDidHide(()=>{
576581
resolve(undefined);
577582
});
@@ -590,20 +595,31 @@ export class Commands {
590595
}
591596
workspaceOwner=workspace.owner_name;
592597
workspaceName=workspace.name;
598+
}else{
599+
workspaceOwner=args[0]asstring;
600+
workspaceName=args[1]asstring;
601+
workspaceAgent=args[2]asstring|undefined;
602+
folderPath=args[3]asstring|undefined;
603+
openRecent=args[4]asboolean|undefined;
604+
}
605+
606+
if(!workspaceAgent){
607+
if(workspace===undefined){
608+
workspace=awaitthis.restClient.getWorkspaceByOwnerAndName(
609+
workspaceOwner,
610+
workspaceName,
611+
);
612+
}
593613

594614
constagent=awaitthis.maybeAskAgent(workspace);
595615
if(!agent){
596616
// User declined to pick an agent.
597617
return;
598618
}
599-
folderPath=agent.expanded_directory;
619+
if(!folderPath){
620+
folderPath=agent.expanded_directory;
621+
}
600622
workspaceAgent=agent.name;
601-
}else{
602-
workspaceOwner=args[0]asstring;
603-
workspaceName=args[1]asstring;
604-
workspaceAgent=args[2]asstring|undefined;
605-
folderPath=args[3]asstring|undefined;
606-
openRecent=args[4]asboolean|undefined;
607623
}
608624

609625
awaitopenWorkspace(
@@ -679,7 +695,7 @@ async function openWorkspace(
679695
baseUrl:string,
680696
workspaceOwner:string,
681697
workspaceName:string,
682-
workspaceAgent:string|undefined,
698+
workspaceAgent:string,
683699
folderPath:string|undefined,
684700
openRecent:boolean|undefined,
685701
){

‎src/workspacesProvider.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -436,8 +436,8 @@ export class OpenableTreeItem extends vscode.TreeItem {
436436

437437
publicreadonlyworkspaceOwner:string,
438438
publicreadonlyworkspaceName:string,
439-
publicreadonlyworkspaceAgent:string|undefined,
440-
publicreadonlyworkspaceFolderPath:string|undefined,
439+
publicreadonlyprimaryAgentName:string|undefined,
440+
publicreadonlyprimaryAgentFolderPath:string|undefined,
441441

442442
contextValue:CoderOpenableTreeItemType,
443443
){
@@ -476,7 +476,7 @@ class AgentTreeItem extends OpenableTreeItem {
476476
}
477477
}
478478

479-
exportclassWorkspaceTreeItemextendsOpenableTreeItem{
479+
classWorkspaceTreeItemextendsOpenableTreeItem{
480480
publicappStatus:{
481481
name:string;
482482
url?:string;
@@ -509,7 +509,7 @@ export class WorkspaceTreeItem extends OpenableTreeItem {
509509
:vscode.TreeItemCollapsibleState.Expanded,
510510
workspace.owner_name,
511511
workspace.name,
512-
undefined,
512+
agents[0]?.name,
513513
agents[0]?.expanded_directory,
514514
agents.length>1
515515
?"coderWorkspaceMultipleAgents"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp