Skip to content

Commit 3c76b3c

Browse files
committed
changed to clipboard
1 parent 3c620b4 commit 3c76b3c

File tree

3 files changed

+13
-19
lines changed

3 files changed

+13
-19
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1247,12 +1247,12 @@
12471247
"objectscript.debug.debugThisMethod": {
12481248
"type": "boolean",
12491249
"default": true,
1250-
"markdownDescription": "Show inline `Debug this method` CodeLens action for ClassMethods."
1250+
"markdownDescription": "Show inline `Debug this method` CodeLens action for ClassMethods and Routine Labels."
12511251
},
1252-
"objectscript.debug.runThisMethod": {
1252+
"objectscript.debug.copyToClipboard": {
12531253
"type": "boolean",
12541254
"default": true,
1255-
"markdownDescription": "Show inline `Run this method in terminal` CodeLens action for ClassMethods."
1255+
"markdownDescription": "Show inline `Copy Invocation to Clipboard` CodeLens action for ClassMethods and Routine Labels."
12561256
},
12571257
"objectscript.studioActionDebugOutput": {
12581258
"type": "boolean",

src/extension.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -705,11 +705,8 @@ export async function activate(context: vscode.ExtensionContext): Promise<any> {
705705
Promise.all(files.map((file) => importFileOrFolder(file, true)))
706706
),
707707
vscode.commands.registerCommand("vscode-objectscript.export", exportAll),
708-
vscode.commands.registerCommand("vscode-objectscript.runInTerminal", (command: string) => {
709-
if (vscode.window.activeTerminal) {
710-
vscode.window.activeTerminal.sendText(command, false);
711-
vscode.window.activeTerminal.show();
712-
}
708+
vscode.commands.registerCommand("vscode-objectscript.copyToClipboard", (command: string) => {
709+
vscode.env.clipboard.writeText(command);
713710
}),
714711
vscode.commands.registerCommand("vscode-objectscript.debug", (program: string, askArgs: boolean) => {
715712
const startDebugging = (args) => {
@@ -1019,9 +1016,6 @@ export async function activate(context: vscode.ExtensionContext): Promise<any> {
10191016
}
10201017
}
10211018
}),
1022-
vscode.window.onDidOpenTerminal((t) => {
1023-
console.log("openTerminal", t);
1024-
}),
10251019
vscode.window.onDidCloseTerminal((t) => {
10261020
const terminalIndex = terminals.findIndex((terminal) => terminal.name == t.name);
10271021
if (terminalIndex > -1) {

src/providers/ObjectScriptCodeLensProvider.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class ObjectScriptCodeLensProvider implements vscode.CodeLensProvider {
2727
}
2828
const className = file.name.split(".").slice(0, -1).join(".");
2929

30-
const { debugThisMethod, runThisMethod } = config("debug");
30+
const { debugThisMethod, copyToClipboard } = config("debug");
3131
let inComment = false;
3232
for (let i = 0; i < document.lineCount; i++) {
3333
const line = document.lineAt(i);
@@ -49,7 +49,7 @@ export class ObjectScriptCodeLensProvider implements vscode.CodeLensProvider {
4949
const [, name, parens] = methodMatch;
5050

5151
debugThisMethod && result.push(this.addDebugThisMethod(i, [`##class(${className}).${name}`, parens !== "()"]));
52-
runThisMethod && result.push(this.addRunThisMethod(i, [`Do ##class(${className}).${name}()`]));
52+
copyToClipboard && result.push(this.addCopyToClipboard(i, [`##class(${className}).${name}()`]));
5353
}
5454
}
5555
return result;
@@ -64,10 +64,10 @@ export class ObjectScriptCodeLensProvider implements vscode.CodeLensProvider {
6464
}
6565
const routineName = file.name.split(".").slice(0, -1).join(".");
6666

67-
const { debugThisMethod, runThisMethod } = config("debug");
67+
const { debugThisMethod, copyToClipboard } = config("debug");
6868

6969
debugThisMethod && result.push(this.addDebugThisMethod(0, [`^${routineName}`, false]));
70-
runThisMethod && result.push(this.addRunThisMethod(0, [`Do ^${routineName}`]));
70+
copyToClipboard && result.push(this.addCopyToClipboard(0, [`^${routineName}`]));
7171

7272
let inComment = false;
7373
for (let i = 1; i < document.lineCount; i++) {
@@ -90,7 +90,7 @@ export class ObjectScriptCodeLensProvider implements vscode.CodeLensProvider {
9090
const [, name, parens] = labelMatch;
9191

9292
debugThisMethod && result.push(this.addDebugThisMethod(i, [`${name}^${routineName}`, parens !== "()"]));
93-
runThisMethod && result.push(this.addRunThisMethod(i, [`Do ${name}^${routineName}`]));
93+
copyToClipboard && result.push(this.addCopyToClipboard(i, [`${name}^${routineName}`]));
9494
}
9595
}
9696

@@ -105,10 +105,10 @@ export class ObjectScriptCodeLensProvider implements vscode.CodeLensProvider {
105105
});
106106
}
107107

108-
private addRunThisMethod(line: number, args: any[]) {
108+
private addCopyToClipboard(line: number, args: any[]) {
109109
return new vscode.CodeLens(new vscode.Range(line, 0, line, 80), {
110-
title: `Run this method in terminal`,
111-
command: "vscode-objectscript.runInTerminal",
110+
title: `Copy Invocation to Clipboard`,
111+
command: "vscode-objectscript.copyToClipboard",
112112
arguments: args,
113113
});
114114
}

0 commit comments

Comments
 (0)