You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
XDebug wants all file paths as file:// URI. I looked at the source code and saw that there is code implemented for this, but the property debuggerPathsAreUris is private, by default set to false and has no constructor property - in opposite to debuggerLinesAndColumnsStartAt1.
What's up with the Jan 2016 milestone? If you are looking for an implementation, you might want to look at my code, I just overwrote the convert functions ;)
Felix Becker (@felixfbecker) Before closing this feature, I'll have to write tests... But you can try this unverified and untested feature already (and it would actually help me finishing this ;-). On your debug session call setDebuggerPathFormat('uri'). After that the convert... methods should start converting between native paths and URIs.
Please note:
VS Code uses native paths for now, and there are no plans to change this (that's the reason why the debugAdapter's initialize request returns an error for any value other than 'path').
paths used in the launch or attach requests are not spec'ed so their format is left open to the debug adapter developer. So you cannot use the convertClientPathToDebugger and convertDebuggerPathToClient because they assume a configured client format which might be different from what you are using in your launch config.
I will probably keep my overwritten methods because I also resolve localSourceRoot with serverSourceRoot in there, but I'm pretty sure your implementation of uri2path is not enough.
You must call decodeURI on it to handle paths with spaces or special characters
Windows paths will have a trailing slash in the URI (at least when they come from XDebug) url.parse('file:///c:/users/felix').pathname === '/c:/users/felix', but it should be c:/users/felix
I didn't implement this, but some replace the colon with a |, so that may need to be checked too
You should call path.normalize() on the result to replace slashes with backslashes on Windows
So it must be at least
letfilePath=decodeURI(url.parse(fileUri).pathname);// strip the trailing slash from Windows paths (indicated by a drive letter with a colon)// just checking process.platform will not work here because in a remote debugging scenario the OS of the client and debugger can differif(/^\/[a-zA-Z]:\//.test(filePath)){// network drives?filePath=filePath.substr(1);}// convert slashes to backslashes on Windowsreturnpath.normalize(filePath);
For the other way I simply use the file-url package with {resolve: false}
Activity
felixfbecker commentedon Mar 9, 2016
What's up with the Jan 2016 milestone? If you are looking for an implementation, you might want to look at my code, I just overwrote the convert functions ;)
weinand commentedon Mar 9, 2016
Felix Becker (@felixfbecker) Before closing this feature, I'll have to write tests... But you can try this unverified and untested feature already (and it would actually help me finishing this ;-). On your debug session call setDebuggerPathFormat('uri'). After that the convert... methods should start converting between native paths and URIs.
Please note:
felixfbecker commentedon Mar 9, 2016
I will probably keep my overwritten methods because I also resolve
localSourceRootwithserverSourceRootin there, but I'm pretty sure your implementation ofuri2pathis not enough.decodeURIon it to handle paths with spaces or special charactersurl.parse('file:///c:/users/felix').pathname === '/c:/users/felix', but it should bec:/users/felix|, so that may need to be checked toopath.normalize()on the result to replace slashes with backslashes on WindowsSo it must be at least
For the other way I simply use the file-url package with
{resolve: false}Hope this helps :)