當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript tasks.executeTask方法代碼示例

本文整理匯總了TypeScript中vscode.tasks.executeTask方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript tasks.executeTask方法的具體用法?TypeScript tasks.executeTask怎麽用?TypeScript tasks.executeTask使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在vscode.tasks的用法示例。


在下文中一共展示了tasks.executeTask方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: runTest

function runTest(sourceUri: string, className: string, methodName: string): Thenable<TaskExecution> {
    let file = Uri.parse(sourceUri).fsPath;
    file = Path.relative(workspace.rootPath, file);
	let kind: JavaTestTask = {
		type: 'java.task.test',
        className: className,
        methodName: methodName,
    }
    var shell;
    let config = workspace.getConfiguration('java')
    // Run method or class
    if (methodName != null) {
        let command = config.get('testMethod') as string[]
        if (command.length == 0) {
            window.showErrorMessage('Set "java.testMethod" in .vscode/settings.json')
            shell = new ShellExecution('echo', ['Set "java.testMethod" in .vscode/settings.json, for example ["mvn", "test", "-Dtest=${class}#${method}"]'])
        } else {
            shell = templateCommand(command, file, className, methodName)
        }
    } else {
        let command = config.get('testClass') as string[]
        if (command.length == 0) {
            window.showErrorMessage('Set "java.testClass" in .vscode/settings.json')
            shell = new ShellExecution('echo', ['Set "java.testClass" in .vscode/settings.json, for example ["mvn", "test", "-Dtest=${class}"]'])
        } else {
            shell = templateCommand(command, file, className, methodName)
        }
    }
	let workspaceFolder = workspace.getWorkspaceFolder(Uri.parse(sourceUri))
	let task = new Task(kind, workspaceFolder, 'Java Test', 'Java Language Server', shell)
	return tasks.executeTask(task)
}
開發者ID:georgewfraser,項目名稱:vscode-javac,代碼行數:32,代碼來源:extension.ts

示例2: runScript

export function runScript(script: string, document: TextDocument) {
	let uri = document.uri;
	let folder = workspace.getWorkspaceFolder(uri);
	if (folder) {
		let task = createTask(script, `run ${script}`, folder, uri);
		tasks.executeTask(task);
	}
}
開發者ID:DonJayamanne,項目名稱:vscode,代碼行數:8,代碼來源:tasks.ts

示例3: runScriptFromHover

	public runScriptFromHover(args: any) {
		let script = args.script;
		let documentUri = args.documentUri;
		let folder = workspace.getWorkspaceFolder(documentUri);
		if (folder) {
			let task = createTask(script, `run ${script}`, folder, documentUri);
			tasks.executeTask(task);
		}
	}
開發者ID:developers23,項目名稱:vscode,代碼行數:9,代碼來源:scriptHover.ts

示例4: runCommand

export function runCommand(folder: WorkspaceFolder, cmd: Cmd): Thenable<TaskExecution> {
    const config: TaskConfigItem = {
        definition: {
            label: 'run Cargo command',
            type: 'cargo',
            command: cmd.binary,
            args: cmd.args,
            env: cmd.env,
        },
        problemMatcher: ['$rustc'],
        group: TaskGroup.Build,
        presentationOptions: {
            reveal: TaskRevealKind.Always,
            panel: TaskPanelKind.Dedicated,
        },
    };
    const task = createTask(config, folder);
    return tasks.executeTask(task);
}
開發者ID:digitaltoad,項目名稱:dotfiles,代碼行數:19,代碼來源:tasks.ts


注:本文中的vscode.tasks.executeTask方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。