Skip to content

Commit

Permalink
Put link to editor in class comment when creating new BPL/DTL
Browse files Browse the repository at this point in the history
  • Loading branch information
isc-bsaviano committed Sep 8, 2023
1 parent 5da4237 commit d14eca3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
46 changes: 23 additions & 23 deletions src/commands/newFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -535,20 +535,20 @@ Method OnProcessInput(pInput As %RegisteredObject, pOutput As %RegisteredObject)
${typeof desc == "string" ? "/// " + desc.replace(/\n/g, "\n/// ") : ""}
Class ${cls} Extends Ens.BusinessProcessBPL [ ClassType = persistent, ProcedureBlock ]
{
/// BPL Definition
XData BPL [ XMLNamespace = "http://www.intersystems.com/bpl" ]
{${
api
? `
<!--
${
api
? `
/*
You can edit this class in the Business Process Editor by pasting the following URL into your web browser.
You can also edit this XML block directly.
${api.config.https ? "https" : "http"}://${api.config.host}:${api.config.port}${
api.config.pathPrefix
}/csp/${api.config.ns.toLowerCase()}/EnsPortal.BPLEditor.zen?BP=${cls}.BPL\n-->`
: ""
}
api.config.pathPrefix
}/csp/${api.config.ns.toLowerCase()}/EnsPortal.BPLEditor.zen?BP=${cls}.BPL\n*/\n`
: ""
}
/// BPL Definition
XData BPL [ XMLNamespace = "http://www.intersystems.com/bpl" ]
{
<process language='objectscript' request='Ens.Request' response='Ens.Response' height='2000' width='2000' >
<sequence xend='300' yend='450' >
</sequence>
Expand Down Expand Up @@ -632,25 +632,25 @@ Class ${cls} Extends Ens.DataTransformDTL [ DependsOn = ${
sourceCls == targetCls ? sourceCls : `(${sourceCls}, ${targetCls})`
} ]
{
${
api
? `
/*
You can edit this class in the Data Transformation Editor by pasting the following URL into your web browser.
You can also edit this XML block directly.
${api.config.https ? "https" : "http"}://${api.config.host}:${api.config.port}${
api.config.pathPrefix
}/csp/${api.config.ns.toLowerCase()}/EnsPortal.DTLEditor.zen?DT=${cls}.DTL\n*/\n`
: ""
}
Parameter IGNOREMISSINGSOURCE = 1;
Parameter REPORTERRORS = 1;
Parameter TREATEMPTYREPEATINGFIELDASNULL = 0;
XData DTL [ XMLNamespace = "http://www.intersystems.com/dtl" ]
{${
api
? `
<!--
You can edit this class in the Data Transformation Editor by pasting the following URL into your web browser.
You can also edit this XML block directly.
${api.config.https ? "https" : "http"}://${api.config.host}:${api.config.port}${
api.config.pathPrefix
}/csp/${api.config.ns.toLowerCase()}/EnsPortal.DTLEditor.zen?DT=${cls}.DTL\n-->`
: ""
}
{
<transform sourceClass='${sourceCls}' targetClass='${targetCls}' create='new' language='objectscript' >
</transform>
}
Expand Down
4 changes: 2 additions & 2 deletions src/providers/FileSystemProvider/FileSystemProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function generateFileContent(
fileName: string,
sourceContent: Buffer
): { content: string[]; enc: boolean } {
const sourceLines = sourceContent.toString().split("\n");
const sourceLines = new TextDecoder().decode(sourceContent).split("\n");
const fileExt = fileName.split(".").pop().toLowerCase();
const csp = fileName.startsWith("/");
if (fileExt === "cls" && !csp) {
Expand Down Expand Up @@ -349,7 +349,7 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
}
// Check if the class name and file name match
let clsname = "";
const match = content.toString().match(classNameRegex);
const match = new TextDecoder().decode(content).match(classNameRegex);
if (match) {
[, clsname] = match;
}
Expand Down

0 comments on commit d14eca3

Please sign in to comment.