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


TypeScript debug.startDebugging方法代码示例

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


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

示例1: catch

        vscode.window.showQuickPick(items, {placeHolder: (items.length === 0 ? "No compiler found" : "Select a compiler" )}).then(async selection => {
            if (!selection) {
                return; // User canceled it.
            }
            if (selection.label.startsWith("cl.exe")) {
                if (!process.env.DevEnvDir || process.env.DevEnvDir.length === 0) {
                    vscode.window.showErrorMessage('cl.exe build and debug is only usable when VS Code is run from the Developer Command Prompt for VS.');
                    return;
                }
            }
            if (selection.configuration.preLaunchTask) {
                if (folder) {
                    try {
                        await util.ensureBuildTaskExists(selection.configuration.preLaunchTask);
                        Telemetry.logDebuggerEvent("buildAndDebug", { "success": "false" });
                    } catch (e) {
                        if (e && e.message === util.failedToParseTasksJson) {
                            vscode.window.showErrorMessage(util.failedToParseTasksJson);
                        }
                        return Promise.resolve();
                    }
                } else {
                    return Promise.resolve();
                    // TODO uncomment this when single file mode works correctly.
                    // const buildTasks: vscode.Task[] = await getBuildTasks(true);
                    // const task: vscode.Task = buildTasks.find(task => task.name === selection.configuration.preLaunchTask);
                    // await vscode.tasks.executeTask(task);
                    // delete selection.configuration.preLaunchTask;
                }
            }

            // Attempt to use the user's (possibly) modified configuration before using the generated one.
            try {
                await vscode.debug.startDebugging(folder, selection.configuration.name);
                Telemetry.logDebuggerEvent("buildAndDebug", { "success": "true" });
            } catch (e) {
                try {
                    vscode.debug.startDebugging(folder, selection.configuration);
                } catch (e) {
                    Telemetry.logDebuggerEvent("buildAndDebug", { "success": "false" });
                }
            }
        });
开发者ID:Microsoft,项目名称:vscppsamples,代码行数:43,代码来源:extension.ts

示例2: test

    test("Starting .NET Core Launch (console) from the workspace root should create an Active Debug Session", async () => {
        await vscode.debug.startDebugging(vscode.workspace.workspaceFolders[0], ".NET Core Launch (console)");

        let debugSessionTerminated = new Promise(resolve => {
            vscode.debug.onDidTerminateDebugSession((e) => resolve());
        });

        vscode.debug.activeDebugSession.type.should.equal("coreclr");

        await debugSessionTerminated;
    });
开发者ID:eamodio,项目名称:omnisharp-vscode,代码行数:11,代码来源:launchConfiguration.integration.test.ts

示例3: test

    test("Starting .NET Core Launch (console) from the workspace root should create an Active Debug Session", async () => {
        let result = await vscode.debug.startDebugging(vscode.workspace.workspaceFolders[0], ".NET Core Launch (console)");
        expect(result, "Debugger could not be started.");
        
        let debugSessionTerminated = new Promise(resolve => {
            vscode.debug.onDidTerminateDebugSession((e) => resolve());
        });

        expect(vscode.debug.activeDebugSession).not.to.be.undefined;
        expect(vscode.debug.activeDebugSession.type).to.equal("coreclr");

        await debugSessionTerminated;
    });
开发者ID:gregg-miskelly,项目名称:omnisharp-vscode,代码行数:13,代码来源:launchConfiguration.integration.test.ts

示例4: test

    test("Starting (gdb) Launch from the workspace root should create an Active Debug Session", async () => { 
        // If it is failing on startDebugging. Investigate the SimpleCppProject's tasks.json or launch.json.
        await vscode.debug.startDebugging(vscode.workspace.workspaceFolders[0], "(gdb) Launch");

        let debugSessionTerminated: Promise<void> = new Promise(resolve => {
            vscode.debug.onDidTerminateDebugSession((e) => resolve());
        });

        try {
            assert.equal(vscode.debug.activeDebugSession.type, "cppdbg");
        } catch (e) {
            assert.fail("Debugger failed to launch. Did the extension activate correctly?");
        }

        await debugSessionTerminated;
    });
开发者ID:swyphcosmo,项目名称:vscode-cpptools,代码行数:16,代码来源:integration.test.ts

示例5: Error

 launchDef.promise.then(() => {
     if (!Array.isArray(workspace.workspaceFolders) || workspace.workspaceFolders.length === 0) {
         throw new Error('Please open a workspace');
     }
     let workspaceFolder = workspace.getWorkspaceFolder(Uri.file(rootDirectory));
     if (!workspaceFolder) {
         workspaceFolder = workspace.workspaceFolders[0];
     }
     return debug.startDebugging(workspaceFolder, {
         "name": "Debug Unit Test",
         "type": "python",
         "request": "attach",
         "localRoot": rootDirectory,
         "remoteRoot": rootDirectory,
         "port": pythonSettings.unitTest.debugPort,
         "secret": "my_secret",
         "host": "localhost"
     });
 }).catch(reason => {
开发者ID:,项目名称:,代码行数:19,代码来源:

示例6: startDebugging

export function startDebugging(scriptName: string, protocol: string, port: number, folder: WorkspaceFolder) {
	let p = 'inspector';
	if (protocol === 'debug') {
		p = 'legacy';
	}

	let packageManager = getPackageManager(folder);
	const config: DebugConfiguration = {
		type: 'node',
		request: 'launch',
		name: `Debug ${scriptName}`,
		runtimeExecutable: packageManager,
		runtimeArgs: [
			'run',
			scriptName,
		],
		port: port,
		protocol: p
	};

	if (folder) {
		debug.startDebugging(folder, config);
	}
}
开发者ID:DonJayamanne,项目名称:vscode,代码行数:24,代码来源:tasks.ts


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