4
votes

Is it possible to configure Visual Studio Code (installed on my Windows 10 client machine) to run and debug ColdFusion code, that is located server side in the path C:\inetpub\wwwroot\dir\dev?

I'm using ColdFusion 2016 (64 bit) together with IIS 6.2 on that Windows Server 2012 R2 Standard machine.

I opened the directory \\my-cold-fusion-server-as-FQDN\c$\inetpub\wwwroot\dir\dev in "Explorer" of Visual Studio Code to display and modify the cfm files.

I also configured the launch.json file in Visual Studio Code ("Run" > "Open Configurations") as follows:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "pwa-chrome",
            "request": "launch",
            "name": "Launch Chrome against localhost",
            "url": "http://my-cold-fusion-server-as-FQDN/dir/dev",
            "webRoot": "\\\\my-cold-fusion-server-as-FQDN\\c$\\inetpub\\wwwroot\\dir\\dev"
        }
    ]
}

I created a new file "test.cfm" (in the location \\my-cold-fusion-server-as-FQDN\c$\inetpub\wwwroot\dir\dev) and safed it with the following content:

<cfscript>
    var = "World";
    writeOutput("Hello #var#!");
</cfscript>

When I click on "Run" > "Start Debugging" in Visual Studio Code, a new Browser windows opens and displays exactly the same url (http://my-cold-fusion-server-as-FQDN/dir/dev) as specified in launch.json file.

But the file I wanted to be executed and being debugged, is not processed in the url (I expected: http://my-cold-fusion-server-as-FQDN/dir/dev/test.cfm). So additionally I am not able to debug that file using breakpoints in Visual Studio Code.

So I'm currently only able to view, modify, and safe cfm files in Visual Studio, and have to open the corresponding url to view that cfm file in my browser. But I'm not able to debug it using breakpoints in Visual Studio Code

1
What you can do is enable debugging in your Admin page. That will expose variables in the form and url scope. What you can also do is use the <cfdump> tag or writedump command to look at other variable values. Each has an abort attribute which comes in handy.Dan Bracuk

1 Answers

6
votes

Your step-debugger options right now are

There is no CFML step-debugger for VSCode at the moment, but the Adobe CF team announced that the Eclipse based CF Builder is being sunset for a VS Code based version which will include a step-debugger. This is due with the next major release of ColdFusion, mentioned in this slide deck:

"Public Beta walkthru of ColdFusion Next--Project Stratus", with Rakshith Naresh -- CFMeetup #268