intersystems-community / vscode-objectscript

InterSystems ObjectScript extension for Visual Studio Code
https://docs.intersystems.com/components/csp/docbook/DocBook.UI.Page.cls?KEY=GVSCO
Other
106 stars 48 forks source link

Add "View Web Page" functionality #1377

Open isc-solon opened 2 months ago

isc-solon commented 2 months ago

Consider the two custom "links" below.

"objectscript.conn": {
        "active": true,
        "links": {
            "Launch Zen page": "${serverUrl}/csp/${namespace}/${classname}.cls",
            "Launch CSP page": "${serverUrl}/csp/${namespace}/hello.csp"
        }
    }

These links are a way to replicate the "View Web Page" button in InterSystems Studio. They both appear when clicking the connection info in the status bar, and they both work. But notice that the CSP link is specific to the "hello.csp" page. There's no way to make it generic like the Zen link. That's because:

  1. You can't use ${filename} because that substitution is not supported.
  2. You can't use ${classname} because hello.csp is not a class file, so classname is empty. Trying this prevents the link from appearing at all.

You can't use View Other to view the corresponding class and then use the Zen link to launch that because the class uses CSPURL to prevent using the .cls extension.

I searched Issues to see if this ability has been requested and I couldn't find anything. So maybe it's not worth doing. But if serverActions.ts had code something like the code below, a generic link like this would work "${serverUrl}/csp/${namespace}/${filename}.csp".

  const filename = file && file.name.toLowerCase().endsWith(".csp") ? file.name.slice(0, -4) : "";
  const filenameEncoded = encodeURIComponent(filename);

and:

    // Skip link if it requires a filename and we don't currently have one
    if (filename == "" && (rawLink.includes("${filename}") || rawLink.includes("${filenameEncoded}"))) {
      continue;
    }

and:

      .replace("${filename}", filename)
      .replace("${filenameEncoded}", filenameEncoded);
isc-bsaviano commented 2 months ago

@isc-solon I'm treating this as a request for "View Web Page" functionality. I'll discuss this with Raj.

isc-rsingh commented 2 months ago

@isc-solon consider promoting this idea here: https://community.intersystems.com/post/3rd-intersystems-ideas-contest