當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。