Ensure that upgrades can be resolved even when the upgrades pack is not
in the workspace. This is the situation when the core libraries are
resolved from the package cache.
This change works because `qlProgram.libraryPath` is the resolved
search path for compiling the query. We are guaranteed that the
appropriate core libraries are included in this query.
Note that this change avoids using extra source folders from the
workspace. Previously without using packages, we assume that all
relevant query paths are already inside the workspace. With
packaging, this is no longer the case.
It is theoretically possible that there will be extra upgrade scripts
that are not on the resolved search path, but are included in the
workspace. This situation would have worked in the past.This is not a
situation that we expect to happen in practice. And if this does happen,
I believe this is an error and all upgrades should be added explicitly
to the search path.
An open question is if this will work with downgrade scripts. If it does
not, then I don't think this change makes things any worse than before.
The Actions VM image containing v2.7.6 of the CodeQL CLI has now fully
rolled out, so we no longer need to download the latest CodeQL bundle to
use this CLI and include this repo in the ML-powered queries beta.
This was our first temporary attempt at configuration of a remote
query run. I don't think that we're using it anymore, so it simplifies
the code to remove it.
Successfully completed queries will be stored on disk and available
across restarts.
- The query results are contained in global storage.
- Metadata and a summary about a query are stored in workspace storage.
- There is a job that runs every 2 hours to determine if any queries are
old enough to be deleted.
The goal with this change is to simplify the query history to make it
possible to serialize and de serialize.
This change adds serialization support. Since query history objects are
complex, the de-serialization requires manipulation of the
de serialized object prototypes.
Two small bugs:
1. The AST view command was viewing the wrong ast when the command was
selected from the context menu. It was always selecting the active
editor instead of the item selected in the file menu.
2. The `codeql.showLogs` command was not being registered properly.
With this change, there is uniform error handling, telemetry,
and disposal.
Fixes a bug where quick eval was showing empty query text.
Previously, `getQueryText` was looking up the query text when it was
called if the specified text was empty. This was removed with the
recent changes to query history. It was also a bug since the query file
could have changed after the query was run.
This change ensures that if the quick eval position is empty, the
entire line is returned as the quick eval location.
This commit fixes two related issues with the
history view.
1. Sort order was changing after a query item completed. The fix is a
change in how we fire off the `onDidChangeTreeData` event. When the
event is fired with a single item, that item is pushed to the top of
the list. I'm not exactly sure why this wasn't happening before, but
I suspect it was because we were refreshing the list at the same time
as we were inserting the new item.
The solution here is to always refresh the entire list, instead of
single items. This is fine since re building the list is a trivial
operation. See the `refreshTreeView()` method.
With this change, the sort order is now stable.
2. Originally reported here: #1093
The problem is that the internal treeView selection was not being
updated when a new item was being added. Due to some oddities with
the way selection works in the tree view (ie- the visible selection
does not always match the internal selection).
The solution is to use the current item from the `treeDataProvider`
in `determineSelection`.
Also, this change makes the sorting more precise and fixes some typos.
This is a large commit and includes all the changes to add query
history items immediately. This also includes some smaller related
changes that were hit while cleaning this area up.
The major part of this change is a refactoring of what we store in
the query history list. Previously, the `CompletedQuery` was stored.
Previously, objects of this type include all information about a query that was run
including:
- Its source file and text range (if a quick eval)
- Its database
- Its label
- The query results itself
- Metrics about the query run
- Metadata about the query itself
Now, the item stored is called a `FullQueryInfo`, which has two
properties:
- InitialQueryInfo: all the data about the query that we know _before_
the query completes, eg- its source file and text range, database, and
label
- CompletedQueryInfo: all the data about the query that we can only
learn _after_ the query completes. This is an optional property.
There is also a `failureReason` property, which is an optional string
describing why the query failed.
There is also a `FullCompletedQueryInfo` type, which only exists to
help with stronger typing. It is a `FullQueryInfo` with a non-optional
`CompletedQueryInfo`.
Most of the changes are around changing how the query history accesses
its history list.
There are some other smaller changes included here:
- New icon for completed query (previously, completed queries had no
icons).
- New spinning icon for in progress queries.
- Better error handling in the logger to handle log messages when the
extension is shutting down. This mostly helps clean up the output
during tests.
- Add more disposables to subscriptions to be disposed of when the
extension shuts down.