This fixes a bug where if there are special characters in a database
path, it is not possible to navigate to that file from the results view.
Note that the results from our BQRS returned properly encoded URIs, but
our paths coming from sarif were unencoded. Our path parsing handled
the latter correctly (even though these are not correct URIs) and the
former incorrectly.
The fix here is to first ensure all uris are properly encoded. We do
this by running `encodeURI` in sarif-utils (can't run encodeURIComponent
or else the path separators `/` will also be encoded).
Then, we ensure that when we resolve locations, we decode all file
paths.
This works in all cases I have tried. I still have an issue with running
View AST on some of these databases, but that I believe is a separate
issue.
This query ensures that all of our files marked as "pure" remain that
way. In this case "pure" means that it does not depend on vscode and
can therefore be run in tests outside of a runtime environment.
This commit also explicitly moves all of our "pure" files to the
`src/pure` directory.
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