Add the concept of an active query
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 5/5
- Tempo estimado
- Mais de uma semana
- Facilidade para iniciantes
- 30/100
- Tipo de issue
- Funcionalidade
- Clareza
- Razoavelmente clara
- Status de atividade
- Estagnada
- Stack de tecnologia
- typescript, vscode
- Domínio
- developer-experience, tooling
Direção de pesquisa
Nenhum arquivo ou teste do repositório é especificado. Comece localizando o registro da extensão para o comando codeQL.runQuery e o tratamento do estado do workspace do VS Code mostrado na prova de conceito. A conclusão deve incluir uma forma de escolher um arquivo .ql aberto como a consulta ativa e executá-lo a partir de outro arquivo, continuando a permitir que a consulta na aba ativa tenha precedência.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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:
function getQLFileFromTab(tab: vscode.Tab): string | null {
if (tab.input === undefined) {
return null;
}
const tabInput = tab.input as vscode.TabInputText
if (tabInput.uri === undefined) {
return null;
}
const path: string = tabInput.uri.fsPath
if (path.endsWith(".ql")) {
return path
}
return null;
}
context.subscriptions.push(vscode.commands.registerCommand('gsgx.runActiveCodeQLQuery', async () => {
const activeTab = vscode.window.tabGroups.activeTabGroup.activeTab
let activeTabPath = null;
if (activeTab !== undefined) {
activeTabPath = getQLFileFromTab(activeTab)
if (activeTabPath !== null) {
vscode.commands.executeCommand("codeQL.runQuery",
vscode.Uri.file(activeTabPath)
);
return;
}
}
const activeQuery = <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');
}
}));
class QLFileQuickPickItem implements vscode.QuickPickItem {
label: string;
path: string;
detail: string;
constructor(path: string) {
this.path = path
this.detail = path
this.label = basename(path)
}
}
context.subscriptions.push(vscode.commands.registerCommand('gsgx.setActiveCodeQLQuery', async () => {
let openFiles = []
const activeTab = vscode.window.tabGroups.activeTabGroup.activeTab
let activeTabPath = null;
let activeTabFiles = []
if (activeTab !== undefined) {
activeTabPath = getQLFileFromTab(activeTab)
if (activeTabPath !== null) {
activeTabFiles.push(new QLFileQuickPickItem(activeTabPath))
}
}
console.log(activeTabPath)
for (const tg of vscode.window.tabGroups.all) {
for (const tab of tg.tabs) {
const path = getQLFileFromTab(tab)
if (path === null) {
continue
}
const item = new QLFileQuickPickItem(path)
if (tab.isActive) {
if (activeTabPath != path) {
activeTabFiles.push(item)
}
} else {
openFiles.push(item)
}
}
}
// activeTabFiles come first
openFiles.unshift(...activeTabFiles)
if (openFiles.length != 0) {
const result = await vscode.window.showQuickPick(openFiles, {
title: "Query path",
canPickMany: false,
});
await context.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.
- Linguagem predominante
- TypeScript
- Estrelas
- 539
- Forks
- 240
- Merge médio
- 2d 6h
- PRs com merge (30d)
- 29
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de github/vscode-codeql
-
bug VSCode
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
github/vscode-codeql#4471 · 1 comentário ·
-
bug enhancement VSCode
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
github/vscode-codeql#592 · 2 comentários ·
-
enhancement VSCode
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 55/100
github/vscode-codeql#4432 · 1 comentário ·
-
bug VSCode
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 52/100
github/vscode-codeql#4356 ·
-
bug VSCode
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 64/100
github/vscode-codeql#4339 · 1 comentário ·
Todas as issues de github/vscode-codeql
Issues semelhantes
-
Browser Waiting for: Product Owner
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 85/100
getsentry/sentry-javascript#24577 · 1 comentário ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
agilepathway/label-checker#640 ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
copse-dev/agent-pane#2953 ·
-
[aw] Upgrade available Abertaagentic-workflows
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 85/100
githubnext/rig#534 ·
-
automation missing-model model-sync provider:pioneer
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
anomalyco/models.dev#7701 ·