feat: open project without logging
This commit is contained in:
@@ -34,11 +34,6 @@
|
|||||||
"command": "devstar.connectRemoteContainer",
|
"command": "devstar.connectRemoteContainer",
|
||||||
"title": "Connect to a Remote Container",
|
"title": "Connect to a Remote Container",
|
||||||
"category": "DevStar"
|
"category": "DevStar"
|
||||||
},
|
|
||||||
{
|
|
||||||
"command": "devstar.openProject",
|
|
||||||
"title": "Open Project",
|
|
||||||
"category": "DevStar"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"uriHandlers": [{
|
"uriHandlers": [{
|
||||||
|
18
src/main.ts
18
src/main.ts
@@ -1,7 +1,7 @@
|
|||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
import QuickAccessTreeProvider from './views/quick-access-tree';
|
import QuickAccessTreeProvider from './views/quick-access-tree';
|
||||||
import DSHome from './home';
|
import DSHome from './home';
|
||||||
import RemoteContainer from './remote-container';
|
import {openProjectWithoutLogging} from './remote-container';
|
||||||
|
|
||||||
export class DevStarExtension {
|
export class DevStarExtension {
|
||||||
dsHome: DSHome;
|
dsHome: DSHome;
|
||||||
@@ -20,13 +20,9 @@ export class DevStarExtension {
|
|||||||
const username = params.get('username');
|
const username = params.get('username');
|
||||||
const path = params.get('path');
|
const path = params.get('path');
|
||||||
|
|
||||||
if (host && port && username && path) {
|
if (host && port && username && path) {
|
||||||
await vscode.commands.executeCommand('devstar.openProject', {
|
await openProjectWithoutLogging(host, parseInt(port, 10), username, decodeURIComponent(path))
|
||||||
host: host,
|
|
||||||
port: parseInt(port, 10),
|
|
||||||
username: username,
|
|
||||||
path: decodeURIComponent(path) // 解码路径
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
vscode.window.showErrorMessage('Missing required parameters.');
|
vscode.window.showErrorMessage('Missing required parameters.');
|
||||||
}
|
}
|
||||||
@@ -55,11 +51,7 @@ export class DevStarExtension {
|
|||||||
context.subscriptions.push(
|
context.subscriptions.push(
|
||||||
vscode.commands.registerCommand('devstar.showHome', (url: string) =>
|
vscode.commands.registerCommand('devstar.showHome', (url: string) =>
|
||||||
this.dsHome.toggle(url)
|
this.dsHome.toggle(url)
|
||||||
),
|
)
|
||||||
vscode.commands.registerCommand('devstar.openProject', (args) => {
|
|
||||||
const { host, port, username, path } = args;
|
|
||||||
RemoteContainer.openRemoteFolder(host, port, username, path)
|
|
||||||
})
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -146,3 +146,11 @@ export default class RemoteContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export async function openProjectWithoutLogging(host: string, port: number, username: string, path: string): Promise<void> {
|
||||||
|
const command = `code --remote ssh-remote+${username}@${host}:${port} ${path} --reuse-window`
|
||||||
|
let terminal = vscode.window.activeTerminal || vscode.window.createTerminal(`Ext Terminal`);
|
||||||
|
terminal.show(true);
|
||||||
|
terminal.sendText(command);
|
||||||
|
}
|
Reference in New Issue
Block a user