revert: 取消功能【避免打开同一个项目】

This commit is contained in:
Levi Yan
2025-06-12 00:12:27 +08:00
parent b58e667edd
commit 29f6ece39c
3 changed files with 13 additions and 50 deletions

View File

@@ -27,7 +27,7 @@ export default class RemoteContainer {
* @param path
* @param context 用于支持远程项目环境
*/
async firstOpenProject(host: string, hostname: string, port: number, username: string, path: string, context: vscode.ExtensionContext) {
async firstOpenProject(host: string, hostname: string, port: number, username: string, path: string) {
if (vscode.env.remoteName) {
vscode.commands.executeCommand('workbench.action.terminal.newLocal').then(() => {
const terminal = vscode.window.terminals[vscode.window.terminals.length - 1];
@@ -41,7 +41,7 @@ export default class RemoteContainer {
.then((res) => {
if (res === 'success') {
// only success then open folder
this.openRemoteFolder(host, port, username, path, context);
this.openRemoteFolder(host, port, username, path);
}
})
@@ -167,16 +167,11 @@ export default class RemoteContainer {
*
* @host 表示project name
*/
openRemoteFolder(host: string, port: number, username: string, path: string, context: vscode.ExtensionContext): void {
// local env
if (vscode.env.remoteName === undefined) {
// 在打开之前需要先将host的信息记录到global state中让home能够确认打开的host是哪个project的
context.globalState.update('currentHost', host)
let terminal = vscode.window.activeTerminal || vscode.window.createTerminal(`Ext Terminal`);
terminal.show(true);
// 在原窗口打开
terminal.sendText(`code --remote ssh-remote+${username}@${host}:${port} ${path} --reuse-window`);
}
openRemoteFolder(host: string, port: number, username: string, path: string): void {
let terminal = vscode.window.activeTerminal || vscode.window.createTerminal(`Ext Terminal`);
terminal.show(true);
// 在原窗口打开
terminal.sendText(`code --remote ssh-remote+${username}@${host}:${port} ${path} --reuse-window`);
}
}