当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Terminal.sendText方法代码示例

本文整理汇总了TypeScript中vscode.Terminal.sendText方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Terminal.sendText方法的具体用法?TypeScript Terminal.sendText怎么用?TypeScript Terminal.sendText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在vscode.Terminal的用法示例。


在下文中一共展示了Terminal.sendText方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: startTask

 public async startTask(
     executable: string,
     preCommandArgs: string[],
     command: string,
     args: string[],
     cwd: string
 ): Promise<void> {
     args = preCommandArgs.concat(command, ...args);
     const terminal = window.createTerminal('Cargo Task');
     this._runningTerminal = terminal;
     const shell = await this._shellProvider.getValue();
     if (shell === undefined) {
         return;
     }
     const setEnvironmentVariables = () => {
         const cargoEnv = this._configuration.getCargoEnv();
         // Set environment variables
         for (const name in cargoEnv) {
             if (name in cargoEnv) {
                 const value = cargoEnv[name];
                 terminal.sendText(getCommandToSetEnvVar(shell, name, value));
             }
         }
     };
     setEnvironmentVariables();
     // Change the current directory to a specified directory
     this._runningTerminal.sendText(getCommandToChangeWorkingDirectory(shell, cwd));
     // Start a requested command
     this._runningTerminal.sendText(getCommandForArgs(shell, [executable, ...args]));
     this._runningTerminal.show(true);
 }
开发者ID:KalitaAlexey,项目名称:RustyCode,代码行数:31,代码来源:terminal_task_manager.ts

示例2:

 const runCommandInIntegratedTerminal = (args: string[], cwd: string) => {
   if (terminal === null) {
     terminal = window.createTerminal('sbt');
     // start sbt
     terminal.sendText('sbt', true);
   }
   terminal.show();
   terminal.sendText(args.join(' '));
 };
开发者ID:dragos,项目名称:dragos-vscode-scala,代码行数:9,代码来源:sbt.ts

示例3: runCommandInIntegratedTerminal

function runCommandInIntegratedTerminal(args: string[], cwd: string): void {
	const cmd_args = Array.from(args);
	if (!terminal) {
		terminal = window.createTerminal('npm');
	}
	terminal.show();
	if (cwd) {
		terminal.sendText(['cd', cwd].join(' '));
	}
	cmd_args.splice(0, 0, getNpmBin());
	terminal.sendText(cmd_args.join(' '));
}
开发者ID:scytalezero,项目名称:vscode-npm-scripts,代码行数:12,代码来源:main.ts

示例4: ensureTerminal

    private ensureTerminal(cwd: string): Terminal {
        if (this._terminal === undefined) {
            this._terminal = window.createTerminal(extensionTerminalName);
            this._disposable = window.onDidCloseTerminal((e: Terminal) => {
                if (e.name === extensionTerminalName) {
                    this._terminal = undefined;
                    this._disposable!.dispose();
                    this._disposable = undefined;
                }
            }, this);

            Container.context.subscriptions.push(this._disposable);
            this._terminalCwd = undefined;
        }

        if (this._terminalCwd !== cwd) {
            this._terminal.sendText(`cd "${cwd}"`, true);
            this._terminalCwd = cwd;
        }

        return this._terminal;
    }
开发者ID:eamodio,项目名称:vscode-git-codelens,代码行数:22,代码来源:viewCommands.ts


注:本文中的vscode.Terminal.sendText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。