Fix bug with reimporting test cases
When re-importing a test database, if the source archive for that database is not in the workspace, then old source code will be seen when inspected.
To reproduce:
- Run a ql test file with a failure (I'm using a javascript DB).
- Right click and import on the db that sticks around.
- Change the JS source file for the test.
- Re-run and still have a failure.
- Re-import the database
- Run the query under test
- Click on a result item
- BUG: The source code is old
The problem is that the source archive cache is not being flushed in this case. I added a case to flush the source archive when the archive was imported into the workspace as a folder, but not when the archive is external.
The fix is to listen for database remove events in the archive filesystem provider and flush the associated database source archive.
There is a complication:
The database remove event didn't emit the removed database. This is because the only place that consumed the event didn't need it.
To get around this, I changed the structure of the events. I added a new fullRefresh boolean. If true, then the original database change handler will ensure the entire tree is refreshed. If false, only the selected database.
Replace this with a description of the changes your pull request makes.
Checklist
- [ ] CHANGELOG.md has been updated to incorporate all user visible changes made by this pull request.
- [x] Issues have been created for any UI or other user-facing changes made by this pull request.
- [x] [Maintainers only] If this pull request makes user-facing changes that require documentation changes, open a corresponding docs pull request in the github/codeql repo and add the
ready-for-doc-reviewlabel there.