Skip to content

Commit 4e13652

Browse files
committed
option to disable debug this method action fix #92
1 parent bca077f commit 4e13652

File tree

3 files changed

+35
-18
lines changed

3 files changed

+35
-18
lines changed

package-lock.json

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,10 +597,23 @@
597597
"type": "boolean",
598598
"description": "Suppress popup messages about successful compile"
599599
},
600+
"objectscript.suppressCompileErrorMessages": {
601+
"default": false,
602+
"type": "boolean",
603+
"description": "Suppress popup messages about errors during compile, but keep focus on Output view"
604+
},
600605
"objectscript.serverSideEditing": {
601606
"default": false,
602607
"type": "boolean",
603608
"description": "Allow to edit code directly on server"
609+
},
610+
"objectscript.debug": {
611+
"type": "object"
612+
},
613+
"objectscript.debug.debugThisMethod": {
614+
"type": "boolean",
615+
"default": true,
616+
"description": "Show `Debug this method` action for ClassMethods"
604617
}
605618
}
606619
},

src/providers/ObjectScriptClassCodeLensProvider.ts

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as vscode from "vscode";
2+
import { config } from "../extension";
23

34
export class ObjectScriptClassCodeLensProvider implements vscode.CodeLensProvider {
45
public provideCodeLenses(
@@ -40,24 +41,27 @@ export class ObjectScriptClassCodeLensProvider implements vscode.CodeLensProvide
4041
[className] = classNameMatch;
4142
}
4243
}
44+
const { debugThisMethod } = config("debug");
4345
const methodMatch = text.match(/(?<=^ClassMethod\s)([^(]+)(\(.)/i);
4446
if (methodMatch) {
4547
const [, name, parens] = methodMatch;
4648
const program = `##class(${className}).${name}`;
4749
const askArgs = parens !== "()";
48-
result.push(
49-
new vscode.CodeLens(
50-
new vscode.Range(
51-
new vscode.Position(i, methodMatch.index),
52-
new vscode.Position(i, methodMatch.index + name.length)
53-
),
54-
{
55-
title: `Debug this method`,
56-
command: "vscode-objectscript.debug",
57-
arguments: [program, askArgs],
58-
}
59-
)
60-
);
50+
if (debugThisMethod) {
51+
result.push(
52+
new vscode.CodeLens(
53+
new vscode.Range(
54+
new vscode.Position(i, methodMatch.index),
55+
new vscode.Position(i, methodMatch.index + name.length)
56+
),
57+
{
58+
title: `Debug this method`,
59+
command: "vscode-objectscript.debug",
60+
arguments: [program, askArgs],
61+
}
62+
)
63+
);
64+
}
6165
}
6266
}
6367
return result;

0 commit comments

Comments
 (0)