This commit fixes a bug uncovered by
c66fe07b06.
The findSourceArchive function in databases.ts creates a
codeql-zip-archive uri with an empty authority component. This will
fail to decode. Until recently, this situation never happened. But in
the commit linked above, we start decoding some of these incorrectly
encoded uris.
This commit fixes that issue.
Also, refactor resolveSourceFile to make it easier to read.
And add unit tests for resolveSourceFile.
This commit fixes a bug in resolveSourceFile where the
`pathWithinSourceArchive` was being removed and appended to the
`sourceArchiveZipPath`. In normal situations, we don't hit this bug
because most database source archive uris have an empty path for the
`pathWithinSourceArchive`.
Split commandRunner into two functions: commandRunner and
commandRunnerWithProgress.
Also, take advantage of default arguments for ProgressOptions.
And updates changelog.
When a user runs multiple queries on a non-upgraded database, ensure
that only one dialog appears for upgrade.
This commit also migrates the upgrades.ts file to using the passed-in
cancellation token and progress monitor. This ensures that cancelling
a database upgrade command will also cancel out of any wrapper
operations.
Fixes#534
The commandRunner wraps all vscode command registrations. It provides
uniform error handling and an optional progress monitor.
In general, progress monitors should only be created by the
commandRunner and passed through to the locations that use it.
This commit adds DatabaseChangedEvent and ensures that all events
fired by the DatabaseManager includes one of these kinds.
Currently, the only kind that we care about is `Remove`. We ensure that
the problems view is only cleared on Remove events.
This commit fixes the problem whereby a database is removed and the
problems associated with queries run from that database stick around
in the problems view.
Also, once problems are cleared, we need to make sure that we uncheck
the checkbox in the results view.
This commit has several limitations:
1. There is duplicated code for message handling in both results.tsx and
result-tables.tsx.
2. Problems are cleared whenever there is *any* change to any database.
Ideally we should only clear problems when a database is removed and
only problems associated with that database. I'll fix part of this in
a future commit.
Resolves#525
When a user clicks in an editor that whose source tree is currently being displayed in
the ast viewer, the viewer selection will stay in sync with the editor selection.
Problem was that we were not globally replaceing `\\` with `\`.
Also, this PR adds some new tests to sarif-utils.ts. In doing so, we
have fixed a small bug in getPathRelativeToSourceLocationPrefix.
Previously, we were uri decoding the sarifRelativeUri. However, this is
no longer correct because the result is another URI and it should
remain encoded if it originally was.
Resolves#585
When retrieving paginated results, need to make sure we are getting
page offsets from the correct results file.
Previously, we were incorrectly extracting page offsets from the default
(unsorted) file. With this change, we ensure that we get offsets from
the proper results file when there is a request for a page of results.
* It is now more general and the logic is simplified
* Also, add more comments
* Rename `adaptBqrs` to `transformBqrsResultSet`
* Remove a react error for missing a key attribute in a list
This refactoring combines the types in `bqrs-types.ts` and
`bqrs-cli-types.ts`. Historically, the former was used for BQRS files
parsed by the extension and the latter for BQRS files parsed by the cli.
They describe the same file types, but using different property and type
names.
We have moved to parsing all BQRS files by the cli. This refactoring
removes the `bqrs-types.ts` file and replaces all BQRS references to
use types in `bqrs-cli-types.ts`.
Additionally, the `adapt.ts` file has been deleted since its purpose
was to convert between extension and cli BQRS types. Some one type and
one function from `adapt.ts` has been moved from `adapt.ts` to
`bqrs-types.ts`. It's possible that we want to do a further refactoring
to simply remove them both.