Skip to content
New issue

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

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

Already on GitHub? # to your account

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

Open
softwareCobbler opened this issue Aug 22, 2024 · 1 comment
Open

Comments

@softwareCobbler
Copy link
Owner

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
Copy link
Owner Author

softwareCobbler commented Aug 26, 2024

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.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant