feat: firstOpenProject, in remote environment, create new local window, then call extension and open project by command
This commit is contained in:
@@ -18,6 +18,8 @@ export default class RemoteContainer {
|
||||
|
||||
/**
|
||||
* 第一次打开远程项目
|
||||
*
|
||||
* 远程环境,先创建local窗口,在通过命令行调用url打开(目前,仅支持vscode协议)
|
||||
* @param host 项目名称
|
||||
* @param hostname ip
|
||||
* @param port
|
||||
@@ -26,13 +28,24 @@ export default class RemoteContainer {
|
||||
* @param context 用于支持远程项目环境
|
||||
*/
|
||||
async firstOpenProject(host: string, hostname: string, port: number, username: string, path: string, context: vscode.ExtensionContext) {
|
||||
await this.firstConnect(host, hostname, username, port, context)
|
||||
.then((res) => {
|
||||
if (res === 'success') {
|
||||
// only success then open folder
|
||||
this.openRemoteFolder(host, port, username, path, context);
|
||||
if (vscode.env.remoteName) {
|
||||
vscode.commands.executeCommand('workbench.action.terminal.newLocal').then(() => {
|
||||
const terminal = vscode.window.terminals[vscode.window.terminals.length - 1];
|
||||
if (terminal) {
|
||||
// vscode协议
|
||||
terminal.sendText(`code --new-window && code --open-url "vscode://mengning.devstar/openProjectSkippingLoginCheck?host=${host}&hostname=${hostname}&port=${port}&username=${username}&path=${path}"`)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
await this.firstConnect(host, hostname, username, port, context)
|
||||
.then((res) => {
|
||||
if (res === 'success') {
|
||||
// only success then open folder
|
||||
this.openRemoteFolder(host, port, username, path, context);
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user