Closed anubisthejackle closed 3 years ago
Thanks for the ticket @anubisthejackle. You should be able to already do this with the functionality here https://github.com/ryanluker/vscode-coverage-gutters/blob/master/example/example.code-workspace#L11 .
remotePathResolve
allows you to swap sections of the coverage for something else to aid with build system generated coverage files, etc. Here is a link to the example project where it uses this to show off the "remote" coverage of a nodejs app.
https://github.com/ryanluker/vscode-coverage-gutters/tree/master/example/remote-node
@ryanluker I've tried every configuration I can think of, and it doesn't seem to work for me.
"coverage-gutters.remotePathResolve": ["/home/anubis/Code/open-source/wordpress-develop/build/", "./src/"]
This is how I have the line setup currently.
<file name="/home/anubis/Code/open-source/wordpress-develop/build/wp-admin/admin-footer.php">
This is how it comes through in the clover XML file.
When I go into the ./src/wp-includes/class-wp-query.php
file, and I tell it to display coverage, I can see it parsing the XML, but it doesn't actually display the coverage in that file.
@anubisthejackle It has been awhile but if I remember correctly you will need to use absolute paths if you leverage the remotePathResolve 🤔 so your ./src/
might need to be from the root. See the code below that powers this feature.
if (remoteLocalPaths) {
const remoteFragment = remoteLocalPaths[0];
const localFragment = remoteLocalPaths[1];
const paths = fileName.split(remoteFragment);
// If we have a length of two we have a match and can swap the paths
// Note: this is because split will give us an array of two with the first element
// being an empty string and the second being the project path.
if (paths.length === 2) {
potentialFileName = localFragment + paths[1];
}
}
I've updated the config to:
"coverage-gutters.remotePathResolve": [
"/home/anubis/Code/open-source/wordpress-develop/build/",
"/home/anubis/Code/open-source/wordpress-develop/src/"
]
It doesn't appear to do any rewrite. I still see the coverage in the Build directory, not the src.
This is the full text of my .code-workspace: NOTE: I've tried "config" and "settings" as the second option.
{
"folders": [
{
"path": "./src"
}
],
"config": {
"coverage-gutters.showLineCoverage": true,
"coverage-gutters.coverageReportFileName": "index.html",
"search.useRipgrep": false,
"coverage-gutters.remotePathResolve": [
"/home/anubis/Code/open-source/wordpress-develop/build/",
"/home/anubis/Code/open-source/wordpress-develop/src/"
]
}
}
The thing that gets me is the coverage still works for the build directory, which tells me it's not doing the rewrite at all--not even a broken re-write. Otherwise it shouldn't pick up the old URL, it should be a broken URL.
Holy crap I figured it out. My VS Code is, apparently, not properly loading the .code-workspace. Moved the setting to my settings.json file and it worked like a charm.
I guess I'll need to figure out how to fix the .code-workspace thing, but that's on me.
Thank you!
@anubisthejackle Sounds like quite the adventure lol...
If you need an example .code-workspace
checkout the one in the root of the example folder.
https://github.com/ryanluker/vscode-coverage-gutters/blob/master/example/example.code-workspace
Happy coding!
Is your feature request related to a problem? Please describe. I've been spending a lot of time in the WordPress development repository. The problem is, code coverage there is based on the
build
directory, while development happens in thesrc
directory.Describe the solution you'd like I'd like the ability to filter the clover XML automatically to replace strings so
/var/www/wordpress-develop/build/wp-activate.php
can become/var/www/wordpress-develop/src/wp-activate.php
Describe alternatives you've considered One method that I can currently do this is by running a SED on the file to manually do the replace. This works, but slows down my development process.