ryanluker/vscode-coverage-gutters

Cannot seem to watch files outside of VS Code workspace directory

fquinner opened this issue · 4 comments

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):

  • OS: [Ubuntu 20.04 Docker Container (from windows)]
  • Extension Version [2.11.0]
  • VSCode Version [1.80.1]

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.

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.

@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 😅 .