本文整理匯總了TypeScript中vscode.debug類的典型用法代碼示例。如果您正苦於以下問題:TypeScript debug類的具體用法?TypeScript debug怎麽用?TypeScript debug使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了debug類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: initialize
export function initialize(): void {
// Activate Process Picker Commands
let attachItemsProvider: AttachItemsProvider = NativeAttachItemsProviderFactory.Get();
let attacher: AttachPicker = new AttachPicker(attachItemsProvider);
disposables.push(vscode.commands.registerCommand('extension.pickNativeProcess', () => attacher.ShowAttachEntries()));
let remoteAttacher: RemoteAttachPicker = new RemoteAttachPicker();
disposables.push(vscode.commands.registerCommand('extension.pickRemoteNativeProcess', (any) => remoteAttacher.ShowAttachEntries(any)));
// Activate ConfigurationProvider
let configurationProvider: IConfigurationAssetProvider = ConfigurationAssetProviderFactory.getConfigurationProvider();
// On non-windows platforms, the cppvsdbg debugger will not be registered for initial configurations.
// This will cause it to not show up on the dropdown list.
if (os.platform() === 'win32') {
disposables.push(vscode.debug.registerDebugConfigurationProvider('cppvsdbg', new CppVsDbgConfigurationProvider(configurationProvider)));
}
disposables.push(vscode.debug.registerDebugConfigurationProvider('cppdbg', new CppDbgConfigurationProvider(configurationProvider)));
configurationProvider.getConfigurationSnippets();
const launchJsonDocumentSelector: vscode.DocumentSelector = [{
language: 'jsonc',
pattern: '**/launch.json'
}];
// ConfigurationSnippetProvider needs to be initiallized after configurationProvider calls getConfigurationSnippets.
disposables.push(vscode.languages.registerCompletionItemProvider(launchJsonDocumentSelector, new ConfigurationSnippetProvider(configurationProvider)));
// Activate Adapter Commands
registerAdapterExecutableCommands();
vscode.Disposable.from(...disposables);
}
示例2: activate
export function activate(context: vscode.ExtensionContext) {
const loadedScriptsProvider = new LoadedScriptsProvider();
const popupAutohideManager = new PopupAutohideManager(sendCustomRequest);
const debugConfigurationProvider = new DebugConfigurationProvider();
context.subscriptions.push(vscode.window.registerTreeDataProvider(
'extension.firefox.loadedScripts', loadedScriptsProvider
));
context.subscriptions.push(vscode.debug.registerDebugConfigurationProvider(
'firefox', debugConfigurationProvider
));
context.subscriptions.push(vscode.commands.registerCommand(
'extension.firefox.reloadAddon', () => sendCustomRequest('reloadAddon')
));
context.subscriptions.push(vscode.commands.registerCommand(
'extension.firefox.rebuildAndReloadAddon', () => sendCustomRequest('rebuildAndReloadAddon')
));
context.subscriptions.push(vscode.commands.registerCommand(
'extension.firefox.toggleSkippingFile', (url) => sendCustomRequest('toggleSkippingFile', url)
));
context.subscriptions.push(vscode.commands.registerCommand(
'extension.firefox.openScript', openScript
));
context.subscriptions.push(vscode.commands.registerCommand(
'extension.firefox.addPathMapping', addPathMapping
));
context.subscriptions.push(vscode.commands.registerCommand(
'extension.firefox.enablePopupAutohide', () => popupAutohideManager.setPopupAutohide(true)
));
context.subscriptions.push(vscode.commands.registerCommand(
'extension.firefox.disablePopupAutohide', () => popupAutohideManager.setPopupAutohide(false)
));
context.subscriptions.push(vscode.commands.registerCommand(
'extension.firefox.togglePopupAutohide', () => popupAutohideManager.togglePopupAutohide()
));
context.subscriptions.push(vscode.debug.onDidReceiveDebugSessionCustomEvent(
(event) => onCustomEvent(event, loadedScriptsProvider, popupAutohideManager)
));
context.subscriptions.push(vscode.debug.onDidStartDebugSession(
(session) => onDidStartSession(session, loadedScriptsProvider)
));
context.subscriptions.push(vscode.debug.onDidTerminateDebugSession(
(session) => onDidTerminateSession(session, loadedScriptsProvider, popupAutohideManager)
));
}
示例3: 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" });
}
}
});
示例4: 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;
});
示例5: activate
export function activate(context: vscode.ExtensionContext) {
context.subscriptions.push(vscode.commands.registerCommand('extension.charlie-debug.getProgramName', config => {
return vscode.window.showInputBox(
{placeHolder: 'Please enter the name of a markdown file in the workspace folder', value: 'readme.md'});
}));
// register a configuration provider for 'charlie' debug type
const provider = new CharlieConfigurationProvider();
context.subscriptions.push(vscode.debug.registerDebugConfigurationProvider('charlie', provider));
context.subscriptions.push(provider);
}
示例6: 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;
});
示例7: 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;
});
示例8: 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 => {
示例9: 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);
}
}
示例10: registerConfigurationProvider
export function registerConfigurationProvider(): void {
vscode.debug.registerDebugConfigurationProvider('Ruby', new RubyConfigurationProvider());
}