Skip to content

Commit 8301405

Browse files
committed
Add initial CodeTour
Ensure the CodeTour extension is installed. Add a tour that walks the user through the basic steps of running a query: show the DB, show the parts of the query, and automatically run the query. Automatic DB selection doesn't work yet, because we need to find a way to pass the DB file URI to the command.
1 parent 6ff60b4 commit 8301405

2 files changed

Lines changed: 61 additions & 1 deletion

File tree

.devcontainer/devcontainer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"extensions": [
3-
"github.vscode-codeql"
3+
"github.vscode-codeql",
4+
"vsls-contrib.codetour"
45
],
56
"postCreateCommand": "bash .devcontainer/postCreateCommand.sh"
67
}

.tours/codeql-tutorial.tour

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"$schema": "https://aka.ms/codetour-schema",
3+
"title": "CodeQL tutorial",
4+
"isPrimary": true,
5+
"steps": [
6+
{
7+
"directory": "codeql-tutorial-database",
8+
"description": "To run a CodeQL query, we first need a CodeQL database to run against.\n\nHere is a sample database we have prepared for you.\n\nTo select it, right-click on the `codeql-tutorial-database` folder in the Explorer view, and click `CodeQL: Set Current Database`."
9+
},
10+
{
11+
"directory": "codeql-tutorial-database",
12+
"description": "This step should automatically select the database, but it doesn't work yet! Keep going.",
13+
"commands": [
14+
"codeQL.setCurrentDatabase?[file:///Users/aditya/github/codeql-codespaces-template/codeql-tutorial-database]"
15+
]
16+
},
17+
{
18+
"file": "tutorial-queries/tutorial.ql",
19+
"description": "This is a CodeQL query file.",
20+
"line": 1
21+
},
22+
{
23+
"file": "tutorial-queries/tutorial.ql",
24+
"description": "This line imports the tutorial library.",
25+
"pattern": "import tutorial.*"
26+
},
27+
{
28+
"file": "tutorial-queries/tutorial.ql",
29+
"description": "This is the query clause, which determines the output of the query.",
30+
"selection": {
31+
"start": {
32+
"line": 7,
33+
"character": 1
34+
},
35+
"end": {
36+
"line": 9,
37+
"character": 1
38+
}
39+
}
40+
},
41+
{
42+
"file": "tutorial-queries/tutorial.ql",
43+
"description": "Time to run your first query!\nThis query will be run automatically, and the results will open in a new tab.\n\nTo run other queries in future:\n1. Right-click within a `.ql` query file OR open the Command Palette with `Cmd/Ctrl+Shift+P`\n1. Select the command `CodeQL: Run Query`",
44+
"selection": {
45+
"start": {
46+
"line": 7,
47+
"character": 1
48+
},
49+
"end": {
50+
"line": 9,
51+
"character": 1
52+
}
53+
},
54+
"commands": [
55+
"codeQL.runQuery"
56+
]
57+
}
58+
]
59+
}

0 commit comments

Comments
 (0)