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


TypeScript window.createTerminal方法代码示例

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


在下文中一共展示了window.createTerminal方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: execCommand

function execCommand(tool: string, compileMode: boolean, fileState: {filePath: string, redsystem: boolean}, guiMode?: boolean, toolChain?: boolean) {
	let redConfigs = RedConfiguration.getInstance();
	let text: string;

	terminal = terminal ? terminal : vscode.window.createTerminal(`Red`);

	if (compileMode || fileState.redsystem) {
		let buildDir: string;
		let outputFilename: string;
		buildDir = redConfigs.redWorkSpace || vscode.workspace.rootPath || path.dirname(fileState.filePath);
		outputFilename = path.join(buildDir, path.parse(fileState.filePath).name);
		if (guiMode && (process.platform == 'win32' || process.platform == 'darwin')) {
			let target: string;
			if (process.platform == 'win32') {
				target = "Windows";
			} else {
				target = "macOS";
			}
			text = `${tool} -t ${target} -o "${outputFilename}" -c "${fileState.filePath}"`;
		} else {
			text = `${tool} -o "${outputFilename}" -c "${fileState.filePath}"`;
		}
	} else {
			if (toolChain) {
				text = `${tool} --cli "${fileState.filePath}"`;
			} else {
				text = `${tool} "${fileState.filePath}"`
			}
	}
	terminal.sendText(text);
	terminal.show();
}
开发者ID:red,项目名称:VScode-extension,代码行数:32,代码来源:commandsProvider.ts

示例3: getPythonInterpreterDirectory

    return getPythonInterpreterDirectory().then(pyPath => {
        let commands = [];
        if (IS_WINDOWS) {
            commands.push(`set ${PATH_VARIABLE_NAME}=%${PATH_VARIABLE_NAME}%;${pyPath}`);
        }
        else {
            commands.push(`export ${PATH_VARIABLE_NAME}=$${PATH_VARIABLE_NAME}:${pyPath}`);
        }
        if (cwd !== workspace.rootPath && typeof cwd === 'string') {
            commands.push(`cd ${cwd}`);
        }
        commands.push(`${file} ${args.join(' ')}`);
        terminal = window.createTerminal(`Python Test Log`);

        return new Promise<any>((resolve) => {
            setTimeout(function () {
                terminal.show();
                terminal.sendText(commands.join(' && '));

                // Bug, we cannot resolve this
                // Resolving here means that tests have completed
                // We need a way to determine that the tests have completed succefully.. hmm
                resolve();
            }, 1000);
        });
    });
开发者ID:walkoncross,项目名称:pythonVSCode,代码行数:26,代码来源:runner.ts

示例4: execSelectionInTerminal

function execSelectionInTerminal() {
    const currentPythonPath = settings.PythonSettings.getInstance().pythonPath;
    const activeEditor = vscode.window.activeTextEditor;
    if (!activeEditor) {
        return;
    }

    const selection = vscode.window.activeTextEditor.selection;
    if (selection.isEmpty) {
        return;
    }
    const code = vscode.window.activeTextEditor.document.getText(new vscode.Range(selection.start, selection.end));
    terminal = terminal ? terminal : vscode.window.createTerminal(`Python`);
    const launchArgs = settings.PythonSettings.getInstance().terminal.launchArgs;
    const launchArgsString = launchArgs.length > 0 ? " ".concat(launchArgs.join(" ")) : "";
    if (IS_WINDOWS) {
        // Multi line commands don't work the same way on windows terminals as it does on other OS
        // So just start the Python REPL, then send the commands
        terminal.sendText(`"${currentPythonPath}"${launchArgsString}`);
        terminal.sendText(code);
    }
    else {
        terminal.sendText(`${currentPythonPath}${launchArgsString} -c "${code}"`);
    }
    terminal.show();
}
开发者ID:walkoncross,项目名称:pythonVSCode,代码行数:26,代码来源:execInTerminalProvider.ts

示例5: test

		test('processId immediately after createTerminal should fetch the pid', (done) => {
			const terminal = window.createTerminal();
			terminal.processId.then(id => {
				assert.ok(id > 0);
				terminal.dispose();
				done();
			});
		});
开发者ID:joelday,项目名称:vscode,代码行数:8,代码来源:window.test.ts

示例6: test

	test('createTerminal, Terminal.name', () => {
		var terminal = window.createTerminal('foo');
		assert.equal(terminal.name, 'foo');

		assert.throws(() => {
			terminal.name = 'bar';
		}, 'Terminal.name should be readonly');
	});
开发者ID:sandy081,项目名称:vscode,代码行数:8,代码来源:window.test.ts

示例7: async

 vscode.commands.registerCommand('ocaml.utop', async () => {
     if (utopTerm) {
         utopTerm.dispose();
     }
     utopTerm = vscode.window.createTerminal('OCaml UTop');
     utopTerm.sendText('utop', true);
     utopTerm.show();
 })
开发者ID:db4,项目名称:vscode-ocaml,代码行数:8,代码来源:extension.ts

示例8:

 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

示例9: test

		test('runInBackground terminal: should be available to terminals API', done => {
			const terminal = window.createTerminal({ name: 'bg', runInBackground: true });
			window.onDidOpenTerminal(t => {
				assert.equal(t, terminal);
				assert.equal(t.name, 'bg');
				assert.ok(window.terminals.indexOf(terminal) !== -1);
				done();
			});
		});
开发者ID:PKRoma,项目名称:vscode,代码行数:9,代码来源:window.test.ts


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