CodeQL extension for Visual Studio CodeThis project is an extension for Visual Studio Code that adds rich language support for CodeQL and allows you to easily find problems in codebases. In particular, the extension:
To see what has changed in the last few versions of the extension, see the Changelog. You can also read full documentation for the extension on the GitHub documentation website. Quick start overviewThe information in this Quick start: Installing and configuring the extensionQuick start: Using CodeQLQuick start: Installing and configuring the extensionInstalling the extensionThe CodeQL extension requires a minimum of Visual Studio Code 1.39. Older versions are not supported.
Checking access to the CodeQL CLIThe extension uses the CodeQL CLI to compile and run queries. The extension automatically manages access to the CLI for you by default (recommended). To check for updates to the CodeQL CLI, you can use the CodeQL: Check for CLI Updates command. If you want to override the default behavior and use a CodeQL CLI that's already on your machine, see "Configuring access to the CodeQL CLI" in the GitHub documentation. If you have any difficulty with CodeQL CLI access, see the CodeQL Extension Log in the Output view for any error messages. Cloning the CodeQL starter workspaceWhen you're working with CodeQL, you need access to the standard CodeQL libraries and queries.
Initially, we recommend that you clone and use the ready-to-use starter workspace.
This includes libraries and queries for the main supported languages, with folders set up ready for your custom queries. After cloning the workspace (use For information about configuring an existing workspace for CodeQL, see "Setting up a CodeQL workspace" in the GitHub documentation. Upgrading CodeQL standard librariesYou can easily keep up-to-date with the latest changes to the CodeQL standard libraries. If you're using the CodeQL starter workspace, you can pull in the latest standard libraries by running:
in the starter workspace directory. If you're using your own clone of the CodeQL standard libraries, you can do a Quick start: Using CodeQLYou can find all the commands contributed by the extension in the Command Palette (Ctrl+Shift+P or Cmd+Shift+P) by typing Importing a database from GitHubWhile you can use the CodeQL CLI to create your own databases, the simplest way to start is by downloading a database from GitHub.com.
For more information, see "Managing CodeQL databases" in the GitHub documentation. Running a queryThe instructions below assume that you're using the CodeQL starter workspace, or that you've added the CodeQL libraries and queries repository to your workspace.
The CodeQL extension runs the query on the current database using the CLI and reports progress in the bottom right corner of the application. When the results are ready, they're displayed in the CodeQL Query Results view. Use the dropdown menu to choose between different forms of result output. If there are any problems running a query, a notification is displayed in the bottom right corner of the application. In addition to the error message, the notification includes details of how to fix the problem. Keyboard navigationIf you wish to navigate the query results from your keyboard, you can bind shortcuts to the CodeQL: Navigate Up/Down/Left/Right in Result Viewer commands. What next?We recommend reading the full documentation for the extension on the GitHub documentation website. You may also find the following resources useful:
LicenseThe CodeQL extension for Visual Studio Code is licensed under the MIT License. The version of CodeQL used by the CodeQL extension is subject to the GitHub CodeQL Terms & Conditions. Data and TelemetryIf you specifically opt-in to permit GitHub to do so, GitHub will collect usage data and metrics for the purposes of helping the core developers to improve the CodeQL extension for VS Code. This data will not be shared with any parties outside of GitHub. IP addresses and installation IDs will be retained for a maximum of 30 days. Anonymous data will be retained for a maximum of 180 days. For more information, see "Telemetry in CodeQL for Visual Studio Code" in the GitHub documentation. |