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
454 stars 88 forks source link

Cannot seem to watch files outside of VS Code workspace directory #418

Open fquinner opened 1 year ago

fquinner commented 1 year ago

Describe the bug Watch does not seem to work with files outside of vscode directory. In C / C++, it's common to build projects outside of the workspace to keep the workspace clean and avoid bleeding over the codebase. However when you generate a build there, the watcher does not seem to pick up changes.

Note the initial parsing actually works fine, but it does not refresh.

To Reproduce Steps to reproduce the behaviour:

  1. Run VS Code Dev Container
  2. Fire up coverage with coverage-gutters.manualCoverageFilePaths: [ "/path/to/filesystem/lcov.info" ]
  3. Click on watch
  4. Modify the filesystem file

Expected behaviour Updated file should be refreshed.

Desktop (please complete the following information):

Additional context There generally seems to be some funnies in this area. I'm not a JS guy, but I also noticed that if I run with

    "coverage-gutters.coverageFileNames": [
        "lcov.info"
    ],
    "coverage-gutters.coverageBaseDir": "",

Then watch doesn't work either. Again, initial search might work but watch doesn't, it finds {/workspaces/project-dir}//{lcov.info}

Now I don't know about the GlobPattern in use here from the vscode libs, but if that was a bash glob, that would expand out to literal curly braces unless there was more than one element listed.

mattseddon commented 1 year ago

In order to watch files outside of the workspace we need to use a RelativePattern, see https://github.com/microsoft/vscode/blob/main/src/vscode-dts/vscode.d.ts#L12375 for some more details. I think this change was introduced around Jan 2022.

@ryanluker we do this in vscode-dvc using the pattern shown in this file: https://github.com/iterative/vscode-dvc/blob/main/extension/src/fileSystem/relativePattern.ts

Hope that helps.

ryanluker commented 1 year ago

@fquinner Thanks for the ticket! We will have to triage this work against the other in the next milestone.

@mattseddon Thanks for responding and providing that input, I bet there wasn't a feature like this when the extension was first built heh 😅 .