Skip to content

Commit 3586231

Browse files
authored
Merge pull request github#14668 from github/shati-patel/docs-databases
VS Code extension docs: Changes to database downloads
2 parents 6d4e000 + 68da5e2 commit 3586231

File tree

4 files changed

+24
-5
lines changed

4 files changed

+24
-5
lines changed

docs/codeql/codeql-for-visual-studio-code/customizing-settings.rst

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Changing the labels of query history items
3939

4040
The query history **Format** setting controls how the extension lists queries in the query history. By default, each item has a label with the following format::
4141
42-
%q on %d - %s, %r result count [%t]
42+
%q on %d - %s %r [%t]
4343

4444
- ``%q`` is the query name
4545
- ``%d`` is the database name
@@ -107,6 +107,19 @@ You can also edit the items shown in the Variant Analysis Repositories panel by
107107
108108
You can change the items shown in the panel or add new items by directly editing this file.
109109

110+
Configuring settings for adding databases
111+
------------------------------------------------
112+
113+
To automatically add database source folders to your workspace, you can enable the **Adding Databases > Add Database Source to Workspace** setting.
114+
115+
This setting is disabled by default. You may want to enable the setting if you regularly browse the source code of databases, for example to view the abstract syntax tree of the code. For more information, see ":ref:`Exploring the structure of your source code <exploring-the-structure-of-your-source-code>`."
116+
117+
.. pull-quote:: Note
118+
119+
If you are in a single-folder workspace, adding database source folders will cause the workspace to reload as a multi-root workspace. This may cause query history and database lists to be reset.
120+
121+
Before enabling this setting, we recommend that you save your workspace as a multi-root workspace. For more information, see "`Multi-root Workspaces <https://code.visualstudio.com/docs/editor/multi-root-workspaces>`__" in the Visual Studio Code help.
122+
110123
Configuring settings for testing queries locally
111124
------------------------------------------------
112125

docs/codeql/codeql-for-visual-studio-code/exploring-the-structure-of-your-source-code.rst

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,26 @@ CodeQL for Visual Studio Code contains an AST viewer. The viewer consists of a g
1818
Viewing the abstract syntax tree of a source file
1919
--------------------------------------------------
2020

21-
1. Open a source file from a CodeQL database. For example, you can navigate to a source file in the File Explorer.
21+
1. Open the CodeQL Databases view and right-click the database that you want to explore. Click **Add Database Source to Workspace**.
22+
23+
.. image:: ../images/codeql-for-visual-studio-code/add-database-source-to-workspace.png
24+
:width: 350
25+
:alt: Add database source to workspace
26+
27+
2. Navigate to a CodeQL database's source file in the File Explorer.
2228

2329
.. image:: ../images/codeql-for-visual-studio-code/open-source-file.png
2430
:width: 350
2531
:alt: Open a source file
2632

27-
2. Run **CodeQL: View AST** from the Command Palette. This runs a CodeQL query (usually called ``printAST.ql``) over the active file, which may take a few seconds.
33+
3. Run **CodeQL: View AST** from the Command Palette. This runs a CodeQL query (usually called ``printAST.ql``) over the active file, which may take a few seconds.
2834

2935
.. pull-quote:: Note
3036

3137
If you don't have an appropriate ``printAST.ql`` query in your workspace, the **CodeQL: View AST** command won't work. To fix this, you can update your copy of the `CodeQL <https://github.com/github/codeql>`__ repository from ``main``. If you do this, you may need to upgrade your databases. Also, query caches may be discarded and your next query runs could be slower.
3238

33-
3. Once the query has run, the AST viewer displays the structure of the source file.
34-
4. To see the nested structure, click the arrows and expand the nodes.
39+
4. Once the query has run, the AST viewer displays the structure of the source file.
40+
5. To see the nested structure, click the arrows and expand the nodes.
3541

3642
.. image:: ../images/codeql-for-visual-studio-code/explore-ast.png
3743
:alt: Explore the AST
72.8 KB
Loading
-1.73 KB
Loading

0 commit comments

Comments
 (0)