File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 516516 "title" : " Add new list" ,
517517 "icon" : " $(new-folder)"
518518 },
519+ {
520+ "command" : " codeQLVariantAnalysisRepositories.importCodeSearch" ,
521+ "title" : " Import Repos from GitHub Code Search"
522+ },
519523 {
520524 "command" : " codeQLVariantAnalysisRepositories.setSelectedItem" ,
521525 "title" : " Select"
961965 "when" : " view == codeQLVariantAnalysisRepositories && viewItem =~ /canBeOpenedOnGitHub/" ,
962966 "group" : " 2_qlContextMenu@1"
963967 },
968+ {
969+ "command" : " codeQLVariantAnalysisRepositories.importCodeSearch" ,
970+ "when" : " view == codeQLVariantAnalysisRepositories && viewItem =~ /canImportCodeSearch/" ,
971+ "group" : " 2_qlContextMenu@1"
972+ },
964973 {
965974 "command" : " codeQLDatabases.setCurrentDatabase" ,
966975 "group" : " inline" ,
12971306 "command" : " codeQLVariantAnalysisRepositories.removeItemContextMenu" ,
12981307 "when" : " false"
12991308 },
1309+ {
1310+ "command" : " codeQLVariantAnalysisRepositories.importCodeSearch" ,
1311+ "when" : " false"
1312+ },
13001313 {
13011314 "command" : " codeQLDatabases.setCurrentDatabase" ,
13021315 "when" : " false"
Original file line number Diff line number Diff line change @@ -275,6 +275,7 @@ export type DatabasePanelCommands = {
275275 "codeQLVariantAnalysisRepositories.openOnGitHubContextMenu" : TreeViewContextSingleSelectionCommandFunction < DbTreeViewItem > ;
276276 "codeQLVariantAnalysisRepositories.renameItemContextMenu" : TreeViewContextSingleSelectionCommandFunction < DbTreeViewItem > ;
277277 "codeQLVariantAnalysisRepositories.removeItemContextMenu" : TreeViewContextSingleSelectionCommandFunction < DbTreeViewItem > ;
278+ "codeQLVariantAnalysisRepositories.importCodeSearch" : TreeViewContextSingleSelectionCommandFunction < DbTreeViewItem > ;
278279} ;
279280
280281export type AstCfgCommands = {
Original file line number Diff line number Diff line change @@ -93,6 +93,8 @@ export class DbPanel extends DisposableObject {
9393 this . renameItem . bind ( this ) ,
9494 "codeQLVariantAnalysisRepositories.removeItemContextMenu" :
9595 this . removeItem . bind ( this ) ,
96+ "codeQLVariantAnalysisRepositories.importCodeSearch" :
97+ this . importCodeSearch . bind ( this ) ,
9698 } ;
9799 }
98100
@@ -323,6 +325,12 @@ export class DbPanel extends DisposableObject {
323325 await this . dbManager . removeDbItem ( treeViewItem . dbItem ) ;
324326 }
325327
328+ private async importCodeSearch ( treeViewItem : DbTreeViewItem ) : Promise < void > {
329+ if ( treeViewItem . dbItem === undefined ) {
330+ throw new Error ( "Please select a valid list to add code search results." ) ;
331+ }
332+ }
333+
326334 private async onDidCollapseElement (
327335 event : TreeViewExpansionEvent < DbTreeViewItem > ,
328336 ) : Promise < void > {
Original file line number Diff line number Diff line change @@ -4,7 +4,8 @@ export type DbTreeViewItemAction =
44 | "canBeSelected"
55 | "canBeRemoved"
66 | "canBeRenamed"
7- | "canBeOpenedOnGitHub" ;
7+ | "canBeOpenedOnGitHub"
8+ | "canImportCodeSearch" ;
89
910export function getDbItemActions ( dbItem : DbItem ) : DbTreeViewItemAction [ ] {
1011 const actions : DbTreeViewItemAction [ ] = [ ] ;
@@ -21,7 +22,9 @@ export function getDbItemActions(dbItem: DbItem): DbTreeViewItemAction[] {
2122 if ( canBeOpenedOnGitHub ( dbItem ) ) {
2223 actions . push ( "canBeOpenedOnGitHub" ) ;
2324 }
24-
25+ if ( canImportCodeSearch ( dbItem ) ) {
26+ actions . push ( "canImportCodeSearch" ) ;
27+ }
2528 return actions ;
2629}
2730
@@ -60,6 +63,10 @@ function canBeOpenedOnGitHub(dbItem: DbItem): boolean {
6063 return dbItemKindsThatCanBeOpenedOnGitHub . includes ( dbItem . kind ) ;
6164}
6265
66+ function canImportCodeSearch ( dbItem : DbItem ) : boolean {
67+ return DbItemKind . RemoteUserDefinedList === dbItem . kind ;
68+ }
69+
6370export function getGitHubUrl ( dbItem : DbItem ) : string | undefined {
6471 switch ( dbItem . kind ) {
6572 case DbItemKind . RemoteOwner :
You can’t perform that action at this time.
0 commit comments