Add the concept of an active query
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 30/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- typescript, vscode
- Lĩnh vực
- developer-experience, tooling
Hướng nghiên cứu
Không có tệp hoặc bài kiểm thử nào trong kho mã được nêu. Hãy bắt đầu bằng cách xác định phần đăng ký của extension cho lệnh codeQL.runQuery và cách xử lý trạng thái workspace của VS Code được minh họa trong proof of concept. Phần hoàn tất cần bao gồm cách chọn một tệp .ql đang mở làm truy vấn hiện hoạt và chạy nó từ một tệp khác, đồng thời vẫn cho phép truy vấn trong tab hiện hoạt được ưu tiên.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- TypeScript
- Star
- 539
- Fork
- 240
- Merge trung bình
- 2 ngày 6 giờ
- Pull request đã merge (30 ngày)
- 29
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của github/vscode-codeql
-
bug VSCode
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
github/vscode-codeql#4471 · 1 bình luận ·
-
bug enhancement VSCode
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
github/vscode-codeql#592 · 2 bình luận ·
-
enhancement VSCode
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
github/vscode-codeql#4432 · 1 bình luận ·
-
bug VSCode
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 52/100
github/vscode-codeql#4356 ·
-
bug VSCode
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 64/100
github/vscode-codeql#4339 · 1 bình luận ·
Tất cả issue của github/vscode-codeql
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
copse-dev/agent-pane#2953 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
[Bug]: Matrix progress drafts fail with "Matrix runtime not initialized" during tool activity Đang mởbug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Client support matrix inclusion Đang mởenhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
calcite-components needs triage refactor
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Esri/calcite-design-system#15203 ·