From 07ab8b419e2e660216de3c85c6c2ce3b1f442353 Mon Sep 17 00:00:00 2001 From: Nicolas Berthier Date: Fri, 26 Jul 2024 12:21:46 +0200 Subject: [PATCH 1/2] Make the `preLaunchTask` optional in launch configuration --- src/extension.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/extension.ts b/src/extension.ts index 586158a..f9d8796 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -38,9 +38,12 @@ class GdbConfigurationProvider implements vscode.DebugConfigurationProvider { if (config.request === undefined) { config.request = "launch"; } - if (config.preLaunchTask === undefined) { - config.preLaunchTask = "SuperBOL: build (debug)"; - } + if (config.preLaunchTask === undefined) { + config.preLaunchTask = "SuperBOL: build (debug)"; + } else if (config.preLaunchTask === "none" || + config.preLaunchTask === "") { + delete config.preLaunchTask; + } if (config.target === undefined) { config.target = "${file}"; } From d203ea1be727e9c32fea0861d9f3a89d94cb09a5 Mon Sep 17 00:00:00 2001 From: Nicolas Berthier Date: Fri, 26 Jul 2024 12:22:40 +0200 Subject: [PATCH 2/2] Proper disposal of the debug adapter factory --- src/extension.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/extension.ts b/src/extension.ts index f9d8796..b5a2b5f 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -10,15 +10,18 @@ const MAX_COLUMN_INDEX = 300; const COBOL_RESERVED_WORDS = ["perform", "move", "to", "set", "add", "subtract", "call", "inquire", "modify", "invoke", "if", "not", "end-if", "until", "varying", "evaluate", "true", "when", "false", "go", "thru", "zeros", "spaces", "zero", "space", "inspect", "tallying", "exit", "paragraph", "method", "cycle", "from", "by", "and", "or", "of", "length", "function", "program", "synchronized", "end-synchronized", "string", "end-string", "on", "reference", "value", "returning", "giving", "replacing", "goback", "all", "open", "i-o", "input", "output", "close", "compute", "unstring", "using", "delete", "start", "read", "write", "rewrite", "with", "lock", "else", "upper-case", "lower-case", "display", "accept", "at", "clear-screen", "initialize", "line", "col", "key", "is", "self", "null", "stop", "run", "upon", "environment-name", "environment-value"] export function activate(context: vscode.ExtensionContext) { + const provider = new GdbConfigurationProvider(); + const factory = new GdbAdapterDescriptorFactory(new CoverageStatus(), new GDBDebugSession()); context.subscriptions.push( - vscode.debug.registerDebugConfigurationProvider('gdb', new GdbConfigurationProvider()), - vscode.debug.registerDebugAdapterDescriptorFactory('gdb', new GdbAdapterDescriptorFactory(new CoverageStatus(), new GDBDebugSession())), + vscode.debug.registerDebugConfigurationProvider('gdb', provider), + vscode.debug.registerDebugAdapterDescriptorFactory('gdb', factory, vscode.DebugConfigurationProviderTriggerKind.Dynamic), vscode.languages.registerEvaluatableExpressionProvider('GnuCOBOL', new GnuCOBOLEvalExpressionFactory()), vscode.languages.registerEvaluatableExpressionProvider('GnuCOBOL31', new GnuCOBOLEvalExpressionFactory()), vscode.languages.registerEvaluatableExpressionProvider('GnuCOBOL3.1', new GnuCOBOLEvalExpressionFactory()), vscode.languages.registerEvaluatableExpressionProvider('GnuCOBOL32', new GnuCOBOLEvalExpressionFactory()), vscode.languages.registerEvaluatableExpressionProvider('GnuCOBOL3.2', new GnuCOBOLEvalExpressionFactory()), vscode.languages.registerEvaluatableExpressionProvider('COBOL', new GnuCOBOLEvalExpressionFactory()), + factory, ); }