softwareCobbler / luceedebug

line debugger for lucee
GNU Lesser General Public License v2.1
44 stars 15 forks source link

be agnostic with respect to path separators in path transforms #62

Open softwareCobbler opened 3 weeks ago

softwareCobbler commented 3 weeks ago

Ideally, a transforms like

{
    "idePrefix": "${workspaceFolder}/web",
    "serverPrefix": "/var/www"
}

and

{
    "idePrefix": "${workspaceFolder}\web",
    "serverPrefix": "/var\www"
}

would be, from the point of view of the user, functionally identical.

softwareCobbler commented 2 weeks ago

For comparing files, we now (as of 2.0.13.2) do canonicalize \ and / to just /. But when spitting out file names back to the client, I think we have to respect what the transform says verbatim, because we don't know what the "right" separator to use is. Now, we could offer an option, that says, "use this separator", but that's not too different from requiring the path separator to be correct in the first place. Alternatively, we could ask the DAP client's runtime what it is, using whatever platform primitives they offer. But then we're getting into spooky action at a distance, and would probably end up needing to offer an option to not do that, and on it goes.

With the canonicalized comparisons, it's more likely that a file gets a match on the server and we send something to the client, where if the path sep in the transform is wrong, the client will try to open that file, and report an error like "cannot open file foo\bar/baz.cfm", which a user would be able to notice: "huh? That's a file on my system! Oh, I see, the path sep is wrong, let me patch that transform up". Which is an improvement over the current behavior of just not matching anything.