Skip to content

Commit 0d8ecb1

Browse files
authored
Put link to editor in class comment when creating new BPL/DTL (#1231)
1 parent 5da4237 commit 0d8ecb1

File tree

2 files changed

+25
-25
lines changed

2 files changed

+25
-25
lines changed

src/commands/newFile.ts

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -535,20 +535,20 @@ Method OnProcessInput(pInput As %RegisteredObject, pOutput As %RegisteredObject)
535535
${typeof desc == "string" ? "/// " + desc.replace(/\n/g, "\n/// ") : ""}
536536
Class ${cls} Extends Ens.BusinessProcessBPL [ ClassType = persistent, ProcedureBlock ]
537537
{
538-
539-
/// BPL Definition
540-
XData BPL [ XMLNamespace = "http://www.intersystems.com/bpl" ]
541-
{${
542-
api
543-
? `
544-
<!--
538+
${
539+
api
540+
? `
541+
/*
545542
You can edit this class in the Business Process Editor by pasting the following URL into your web browser.
546543
You can also edit this XML block directly.
547544
${api.config.https ? "https" : "http"}://${api.config.host}:${api.config.port}${
548-
api.config.pathPrefix
549-
}/csp/${api.config.ns.toLowerCase()}/EnsPortal.BPLEditor.zen?BP=${cls}.BPL\n-->`
550-
: ""
551-
}
545+
api.config.pathPrefix
546+
}/csp/${api.config.ns.toLowerCase()}/EnsPortal.BPLEditor.zen?BP=${cls}.BPL\n*/\n`
547+
: ""
548+
}
549+
/// BPL Definition
550+
XData BPL [ XMLNamespace = "http://www.intersystems.com/bpl" ]
551+
{
552552
<process language='objectscript' request='Ens.Request' response='Ens.Response' height='2000' width='2000' >
553553
<sequence xend='300' yend='450' >
554554
</sequence>
@@ -632,25 +632,25 @@ Class ${cls} Extends Ens.DataTransformDTL [ DependsOn = ${
632632
sourceCls == targetCls ? sourceCls : `(${sourceCls}, ${targetCls})`
633633
} ]
634634
{
635-
635+
${
636+
api
637+
? `
638+
/*
639+
You can edit this class in the Data Transformation Editor by pasting the following URL into your web browser.
640+
You can also edit this XML block directly.
641+
${api.config.https ? "https" : "http"}://${api.config.host}:${api.config.port}${
642+
api.config.pathPrefix
643+
}/csp/${api.config.ns.toLowerCase()}/EnsPortal.DTLEditor.zen?DT=${cls}.DTL\n*/\n`
644+
: ""
645+
}
636646
Parameter IGNOREMISSINGSOURCE = 1;
637647
638648
Parameter REPORTERRORS = 1;
639649
640650
Parameter TREATEMPTYREPEATINGFIELDASNULL = 0;
641651
642652
XData DTL [ XMLNamespace = "http://www.intersystems.com/dtl" ]
643-
{${
644-
api
645-
? `
646-
<!--
647-
You can edit this class in the Data Transformation Editor by pasting the following URL into your web browser.
648-
You can also edit this XML block directly.
649-
${api.config.https ? "https" : "http"}://${api.config.host}:${api.config.port}${
650-
api.config.pathPrefix
651-
}/csp/${api.config.ns.toLowerCase()}/EnsPortal.DTLEditor.zen?DT=${cls}.DTL\n-->`
652-
: ""
653-
}
653+
{
654654
<transform sourceClass='${sourceCls}' targetClass='${targetCls}' create='new' language='objectscript' >
655655
</transform>
656656
}

src/providers/FileSystemProvider/FileSystemProvider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export function generateFileContent(
2727
fileName: string,
2828
sourceContent: Buffer
2929
): { content: string[]; enc: boolean } {
30-
const sourceLines = sourceContent.toString().split("\n");
30+
const sourceLines = new TextDecoder().decode(sourceContent).split("\n");
3131
const fileExt = fileName.split(".").pop().toLowerCase();
3232
const csp = fileName.startsWith("/");
3333
if (fileExt === "cls" && !csp) {
@@ -349,7 +349,7 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
349349
}
350350
// Check if the class name and file name match
351351
let clsname = "";
352-
const match = content.toString().match(classNameRegex);
352+
const match = new TextDecoder().decode(content).match(classNameRegex);
353353
if (match) {
354354
[, clsname] = match;
355355
}

0 commit comments

Comments
 (0)