Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Put link to editor in class comment when creating new BPL/DTL #1231

Merged
merged 1 commit into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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