You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Optionally, to see databases containing a specific language, as well as queries written for that language, you can apply a language filter using the language selector.
51
+
52
+
#. To see available language filters, in the sidebar, click the **Language** title bar.
53
+
#. Hover over the language filter you would like to apply, then click **Select**.
:alt:Screenshot of the queries panel. The "Create query" icon is outlined in dark orange.
69
+
70
+
#. In the Command Palette, select the target language for your query. Selecting a language will autogenerate a folder labeled "codeql-custom-queries-LANGUAGE", which will contain a query template labeled "example.ql".
71
+
#. In the template file, write your custom query, then save the file. Once your query is finished, you can run it from the queries panel.
72
+
45
73
Running a query
46
74
------------------------
47
75
48
76
The `CodeQL repository <https://github.com/github/codeql>`__ on GitHub contains lots of example queries.
49
-
If you have that folder (or a different CodeQL pack) available in your workspace, you can access existing queries under ``<language>/ql/src/<category>``, for example ``java/ql/src/Likely Bugs``.
77
+
You can access any existing queries in your workspace through the queries panel.
78
+
79
+
#. In the sidebar, to expand the queries panel, click the **Queries** title bar.
80
+
#. Hover over the desired query, then click the **Run local query** icon.
50
81
51
-
#. Open a query (``.ql``) file. It is displayed in the editor, with IntelliSense features such as syntax highlighting and autocomplete suggestions.
52
-
#. Right-click in the query window and select **CodeQL: Run Query on Selected Database**. (Alternatively, run the command from the Command Palette.)
:alt:Screenshot of the mouse pointer hovering over a directory of queries in the queries panel. The "Run local queries" icon is outlined in dark orange.
109
+
110
+
Running a selection of queries
111
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
112
+
64
113
You can run multiple queries with a single command.
65
114
66
115
#. Go to the File Explorer.
@@ -114,7 +163,7 @@ This is helpful if you want to test your query on multiple codebases, or find a
114
163
Viewing previous queries
115
164
--------------------------
116
165
117
-
To see the queries that you have run in the current session, open the Query History view.
166
+
To see the queries that you have run in the current session, open the Query History view. You can filter the Query History view by language. For more information, see ":ref:`Filtering databases and queries by language <filtering-databases-and-queries-by-language>`."
0 commit comments