ryanluker / vscode-coverage-gutters

Display test coverage generated by lcov and xml - works with many languages
https://marketplace.visualstudio.com/items?itemName=ryanluker.vscode-coverage-gutters
MIT License
460 stars 88 forks source link

osx: Display not automatically updated when watch is activated and coverage file is a symlink #186

Closed SimonKagstrom closed 5 years ago

SimonKagstrom commented 5 years ago

I'm running on OSX, with a symlink to the coverage file in my workspace (Cobertura format).

Watching is turned on, but when I update the coverage file through re-running my unit tests, the update coverage is not shown in the gutter. If I select Coverage gutters: Display coverage it's updated correctly again.

OS: macos Extension version: 2.2.1 VSCode version: 1.28

I also run the same project in the same way in Linux, where it seems to work. update: It might be because of the symlink, which I suppose is reasonable.

ryanluker commented 5 years ago

@SimonKagstrom thanks for submitting an issue, I use the vscode extension api file watchers [0] so we would have to investigate if those detect sim link file changes or not :thinking: .

[0] https://code.visualstudio.com/docs/extensionAPI/vscode-api#FileSystemWatcher

SimonKagstrom commented 5 years ago

If there is an API to dereference symlinks to find the real path, I think the watch should be set there instead.

The reason I use this is because of #184, where I simply symlink cobertura.xml -> cov.xml.

ryanluker commented 5 years ago

@SimonKagstrom I am not sure you need to symlink anymore if you add your cobertura.xml file name to the new extension setting I added recently https://github.com/ryanluker/vscode-coverage-gutters/blob/master/package.json#L127-L135 . Let me know if that ends up working for you.

SimonKagstrom commented 5 years ago

Yes, that works. Am I supposed to edit the package.json file directly or is there some better way of configuring this?

ryanluker commented 5 years ago

@SimonKagstrom I have included a gif below of how to do this but essentially what you do is go into your settings.json for vscode and modify the filenames attribute (make sure to open and close vscode to get these settings to be picked up).

screencast-from-2018-11-25-09_22_54-am

SimonKagstrom commented 5 years ago

Thanks a lot for explaining via an example!

Anyway, the symlink is also useful when the coverage output is placed outside of the repo (which I guess is pretty common). I typically place the output in /tmp/kcov, and then a symlink would also be needed.

I'll consider writing cov.xml from kcov as well, since it's nice to have it work out-of-the-box without having to configure anything.

ryanluker commented 5 years ago

@SimonKagstrom with the new upcoming option to pick file paths (to individual coverage files) I am going to close this ticket. Thanks for bringing it up though!