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
Is your feature request related to a problem? Please describe.
When I'm working on a query I'm often in editing other files like .qll files, but still want to run the primary query after making a change. I'm in the habit of pressing the key binding for running a query, but this doesn't work from .qll files, so I need to switch tabs back to the original query and then run it. This gets annoying over time.
Describe the solution you'd like
If I know I only want to work on a single query, it would be useful to specify this query once, and then have a key binding for running the active query from any file.
Additional context
I've prototyped this feature in a separate extension and it's been working well for me:
functiongetQLFileFromTab(tab: vscode.Tab): string|null{if(tab.input===undefined){returnnull;}consttabInput=tab.inputasvscode.TabInputTextif(tabInput.uri===undefined){returnnull;}constpath: string=tabInput.uri.fsPathif(path.endsWith(".ql")){returnpath}returnnull;}context.subscriptions.push(vscode.commands.registerCommand('gsgx.runActiveCodeQLQuery',async()=>{constactiveTab=vscode.window.tabGroups.activeTabGroup.activeTabletactiveTabPath=null;if(activeTab!==undefined){activeTabPath=getQLFileFromTab(activeTab)if(activeTabPath!==null){vscode.commands.executeCommand("codeQL.runQuery",vscode.Uri.file(activeTabPath));return;}}constactiveQuery=<string>context.workspaceState.get("codeql.active-query");
if (activeQuery) {vscode.commands.executeCommand("codeQL.runQuery",vscode.Uri.file(activeQuery));} else {vscode.window.showInformationMessage('No active query');}}));classQLFileQuickPickItemimplementsvscode.QuickPickItem{label: string;path: string;detail: string;constructor(path: string){this.path=paththis.detail=paththis.label=basename(path)}}context.subscriptions.push(vscode.commands.registerCommand('gsgx.setActiveCodeQLQuery',async()=>{letopenFiles=[]constactiveTab=vscode.window.tabGroups.activeTabGroup.activeTabletactiveTabPath=null;letactiveTabFiles=[]if(activeTab!==undefined){activeTabPath=getQLFileFromTab(activeTab)if(activeTabPath!==null){activeTabFiles.push(newQLFileQuickPickItem(activeTabPath))}}console.log(activeTabPath)for(consttgofvscode.window.tabGroups.all){for(consttaboftg.tabs){constpath=getQLFileFromTab(tab)if(path===null){continue}constitem=newQLFileQuickPickItem(path)if(tab.isActive){if(activeTabPath!=path){activeTabFiles.push(item)}}else{openFiles.push(item)}}}// activeTabFiles come firstopenFiles.unshift(...activeTabFiles)if(openFiles.length!=0){constresult=awaitvscode.window.showQuickPick(openFiles,{title: "Query path",canPickMany: false,});awaitcontext.workspaceState.update("codeql.active-query",result?.path)}else{vscode.window.showInformationMessage("No CodeQL files are open")}}));
This is just a proof of concept to start a discussion about how this feature should work, if you think it makes sense to add it.
In this implementation, you can set any QL file that is in an open tab to the active query (in addition to this, it would probably be good to have an option in the right click context menu in the file explorer to set an active query).
Also, if another .ql file is in the active tab, it will always run that QL file instead of the active one. The reason for this is I occasionally do need to run other queries, but don't want to change the active query. It's convenient and intuitive to always run the query in the active tab first, and if the active tab is not a .ql file, then run the active query.
Please let me know what you think.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
When I'm working on a query I'm often in editing other files like
.qll
files, but still want to run the primary query after making a change. I'm in the habit of pressing the key binding for running a query, but this doesn't work from.qll
files, so I need to switch tabs back to the original query and then run it. This gets annoying over time.Describe the solution you'd like
If I know I only want to work on a single query, it would be useful to specify this query once, and then have a key binding for running the active query from any file.
Additional context
I've prototyped this feature in a separate extension and it's been working well for me:
This is just a proof of concept to start a discussion about how this feature should work, if you think it makes sense to add it.
In this implementation, you can set any QL file that is in an open tab to the active query (in addition to this, it would probably be good to have an option in the right click context menu in the file explorer to set an active query).
Also, if another
.ql
file is in the active tab, it will always run that QL file instead of the active one. The reason for this is I occasionally do need to run other queries, but don't want to change the active query. It's convenient and intuitive to always run the query in the active tab first, and if the active tab is not a.ql
file, then run the active query.Please let me know what you think.
The text was updated successfully, but these errors were encountered: