Skip to content

Commit 36d612e

Browse files
committed
Add feature flag for ast viewer
Set `codeQL.experimentalAstViewer` to true in settings in order for component to be enabled.
1 parent 8459edb commit 36d612e

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

extensions/ql-vscode/package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@
387387
},
388388
{
389389
"command": "codeQLAstViewer.clear",
390-
"when": "view == codeQLAstViewer",
390+
"when": "view == codeQLAstViewer && config.codeQL.experimentalAstViewer == true",
391391
"group": "navigation"
392392
}
393393
],
@@ -472,7 +472,7 @@
472472
{
473473
"command": "codeQL.viewAst",
474474
"group": "9_qlCommands",
475-
"when": "resourceScheme == codeql-zip-archive"
475+
"when": "resourceScheme == codeql-zip-archive && config.codeQL.experimentalAstViewer == true"
476476
},
477477
{
478478
"command": "codeQL.runQueries",
@@ -617,14 +617,16 @@
617617
},
618618
{
619619
"id": "codeQLAstViewer",
620-
"name": "AST Viewer"
620+
"name": "AST Viewer",
621+
"when": "config.codeQL.experimentalAstViewer == true"
621622
}
622623
]
623624
},
624625
"viewsWelcome": [
625626
{
626627
"view": "codeQLAstViewer",
627-
"contents": "Run the 'CodeQL: View AST' command on an open source file from a Code QL database.\n[View AST](command:codeQL.viewAst)"
628+
"contents": "Run the 'CodeQL: View AST' command on an open source file from a Code QL database.\n[View AST](command:codeQL.viewAst)",
629+
"when": "config.codeQL.experimentalAstViewer == true"
628630
},
629631
{
630632
"view": "codeQLQueryHistory",

extensions/ql-vscode/src/config.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,3 +209,15 @@ export class QueryHistoryConfigListener extends ConfigListener implements QueryH
209209
return QUERY_HISTORY_FORMAT_SETTING.getValue<string>();
210210
}
211211
}
212+
213+
// Enable experimental features
214+
215+
/**
216+
* Any settings below are deliberately not in package.json so that
217+
* they do not appear in the settings ui in vscode itself. If users
218+
* want to enable experimental features, they can add them directly in
219+
* their vscode settings json file.
220+
*/
221+
222+
/* Advanced setting: used to enable the AST Viewer. */
223+
export const EXPERIMENTAL_AST_VIEWER = new Setting('experimentalAstViewer', ROOT_SETTING);

0 commit comments

Comments
 (0)