Without this `configFile` option, ts-loader apparently does not
guarantee a deterministic choice of which of the three `tsconfig.json`
files below `extensions/ql-vscode` actually gets used during webpack.
This leads to very strange behavior as even removing dead code can
change which `tsconfig.json` 'wins the race'. I observed that removing
a dependence on `semmle-bqrs` from `src/view` *tended* to make
`ts-loader` choose `src/compare/view/tsconfig.json` instead.
* Fix command-linting tests.
* Fix failing windows test and Use Uri.parse(_, true)
* Use Uri.parse(_, true). That is the preferred API.
* Reformat comments.
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.