feat: open project without logging
This commit is contained in:
		@@ -34,11 +34,6 @@
 | 
			
		||||
        "command": "devstar.connectRemoteContainer",
 | 
			
		||||
        "title": "Connect to a Remote Container",
 | 
			
		||||
        "category": "DevStar"
 | 
			
		||||
      },
 | 
			
		||||
      {
 | 
			
		||||
        "command": "devstar.openProject",
 | 
			
		||||
        "title": "Open Project",
 | 
			
		||||
        "category": "DevStar"
 | 
			
		||||
      }
 | 
			
		||||
    ],
 | 
			
		||||
    "uriHandlers": [{
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										18
									
								
								src/main.ts
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								src/main.ts
									
									
									
									
									
								
							@@ -1,7 +1,7 @@
 | 
			
		||||
import * as vscode from 'vscode';
 | 
			
		||||
import QuickAccessTreeProvider from './views/quick-access-tree';
 | 
			
		||||
import DSHome from './home';
 | 
			
		||||
import RemoteContainer from './remote-container';
 | 
			
		||||
import {openProjectWithoutLogging} from './remote-container';
 | 
			
		||||
 | 
			
		||||
export class DevStarExtension {
 | 
			
		||||
  dsHome: DSHome;
 | 
			
		||||
@@ -20,13 +20,9 @@ export class DevStarExtension {
 | 
			
		||||
          const username = params.get('username');
 | 
			
		||||
          const path = params.get('path');
 | 
			
		||||
 | 
			
		||||
          if (host && port && username  && path) {
 | 
			
		||||
            await vscode.commands.executeCommand('devstar.openProject', {
 | 
			
		||||
              host: host,
 | 
			
		||||
              port: parseInt(port, 10),
 | 
			
		||||
              username: username,
 | 
			
		||||
              path: decodeURIComponent(path) // 解码路径
 | 
			
		||||
            });
 | 
			
		||||
          if (host && port && username && path) {
 | 
			
		||||
            await openProjectWithoutLogging(host, parseInt(port, 10), username, decodeURIComponent(path))
 | 
			
		||||
 | 
			
		||||
          } else {
 | 
			
		||||
            vscode.window.showErrorMessage('Missing required parameters.');
 | 
			
		||||
          }
 | 
			
		||||
@@ -55,11 +51,7 @@ export class DevStarExtension {
 | 
			
		||||
    context.subscriptions.push(
 | 
			
		||||
      vscode.commands.registerCommand('devstar.showHome', (url: string) =>
 | 
			
		||||
        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