This commit adds the AST Viewer for viewing the QL AST of a file in a
database.
The different components are as follows:
1. There is a new view `codeQLAstViewer`, which displays the AST
2. This view is backed by the `AstViewerDataProvider` and `AstViewer` classes in astView.ts
3. To generate an AST, we use contextual queries, similar to how Find references/declarations are implemented. In particular, in `definitions.ts` there is `TemplatePrintAstProvider` which provides an AST for a given source buffer.
- Similar to the other queries, we first determine which database the buffer belongs to.
- Based on that, we generate a synthetic qlpack and run the templatized `printAst.ql` query
- We plug in the archive-relative path name of the source file.
- After the query is run, we wrap the results in an `AstBuilder` instance.
- When requested, the `AstBuilder` will generate the full AST of the file from the BQRS results.
- The AST roots (all top-level elements, functions, variable declarations, etc, are roots) are passed to the `AstViewer` instance, which handles the display lifecycle and other VS Code-specific functions.
There are a few unrelated pieces here, which can be pulled out to another PR if required:
- The `codeQLQueryHistory` view now has a _welcome_ message to make it more obvious to users how to start.
- `definitions.ts` is moved to the `contextual` subfolder.
- `fileRangeFromURI` is extracted from `definitions.ts` to its own file so it can be reused.
Also, note that this relies on https://github.com/github/codeql/pull/3931 for the C/C++ query to be available in the QL sources. Other languages will need similar queries.
1. Add commands for importing an archive, folder, or from internet
2. Add new icons for all of them
3. Ensure that each command can only retrieve databases through a
single mechanism
This follows the vscode styles where all icons for dark mode are in
the `dark` folder and all for light mode in the `light` folder. They
always have the same name.
This assumes that we will be adding other sorting mechanisms in the
future, like sort by data added.
Not happy with the icon I chose, but I didn't want to spend too much
time creating a new one.