feat: 避免打开同一个项目(home、open with vscode)

This commit is contained in:
Levi Yan
2025-05-31 22:51:28 +08:00
parent a8d5f4acb8
commit 91ac39ac0b
5 changed files with 46 additions and 9 deletions

View File

@@ -68,11 +68,29 @@ export default class DSHome {
panel.webview.postMessage({ command: 'getUsername', data: { username: username } })
break;
}
case 'getCurrentHost':
let currentHost = null
if (vscode.env.remoteName) {
// 远程环境需要确认当前host名称项目名称
const currentHostRecorded = this.context.globalState.get('currentHost')
currentHost = currentHostRecorded != undefined ? currentHostRecorded : ""
} else {
// 如果当前是本地环境,则没有限制
}
if (null == currentHost || "" == currentHost) {
panel.webview.postMessage({ command: 'getCurrentHost', data: {currentHost: ''}})
break;
} else {
panel.webview.postMessage({ command: 'getCurrentHost', data: {currentHost: currentHost}})
break;
}
case 'firstOpenRemoteFolder':
// data.host - project name
await this.remoteContainer.firstOpenProject(data.host, data.hostname, data.port, data.username, data.path, this.context)
break;
case 'openRemoteFolder':
this.remoteContainer.openRemoteFolder(data.host, data.port, data.username, data.path);
this.remoteContainer.openRemoteFolder(data.host, data.port, data.username, data.path, this.context);
break;
case 'getDevstarDomain':
panel.webview.postMessage({ command: 'getDevstarDomain', data: { devstarDomain: this.devstarDomain } })
@@ -241,4 +259,4 @@ export default class DSHome {
</html>`
}
}
}