AngelscriptDebuggerVsCode/src/extension.ts

55 lines
1.7 KiB
TypeScript

/*---------------------------------------------------------
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
'use strict';
import * as vscode from 'vscode';
/*
* The compile time flag 'runMode' controls how the debug adapter is run.
* Please note: the test suite only supports 'external' mode.
*/
export function activate(context: vscode.ExtensionContext) {
context.subscriptions.push(
vscode.debug.registerDebugConfigurationProvider(
'angelscript',
new AngelscriptDebugConfigurationProvider()
)
)
let factory = new AngelscriptAdapterClientDescriptorFactory();
context.subscriptions.push(
vscode.debug.registerDebugAdapterDescriptorFactory('angelscript', factory)
)
if ('dispose' in factory) {
context.subscriptions.push(factory)
}
}
export function deactivate() {
// nothing to do
}
class AngelscriptAdapterClientDescriptorFactory implements vscode.DebugAdapterDescriptorFactory {
createDebugAdapterDescriptor(session: vscode.DebugSession, executable: vscode.DebugAdapterExecutable | undefined): vscode.ProviderResult<vscode.DebugAdapterDescriptor> {
return new vscode.DebugAdapterServer(8684);
}
dispose() {
}
}
class AngelscriptDebugConfigurationProvider
implements vscode.DebugConfigurationProvider {
/**
* Try to add all missing attributes to the debug configuration being launched.
*/
resolveDebugConfiguration(
folder: vscode.WorkspaceFolder | undefined,
config: vscode.DebugConfiguration
): vscode.ProviderResult<vscode.DebugConfiguration> {
return config
}
}