Skip to content

Commit 81294ec

Browse files
committed
Focus on panel when clicking view button
1 parent 839e4d6 commit 81294ec

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

extensions/ql-vscode/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1658,7 +1658,7 @@
16581658
],
16591659
"panel": [
16601660
{
1661-
"id": "codeql-model-details-view",
1661+
"id": "codeql-model-details",
16621662
"title": "CodeQL Model Details",
16631663
"icon": "media/logo.svg"
16641664
}
@@ -1693,7 +1693,7 @@
16931693
"when": "config.codeQL.canary"
16941694
}
16951695
],
1696-
"codeql-model-details-view": [
1696+
"codeql-model-details": [
16971697
{
16981698
"id": "codeQLModelDetails",
16991699
"name": "CodeQL Model Details",

extensions/ql-vscode/src/common/commands.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ export type ExplorerSelectionCommandFunction<Item> = (
5858
type BuiltInVsCodeCommands = {
5959
// The codeQLDatabases.focus command is provided by VS Code because we've registered the custom view
6060
"codeQLDatabases.focus": () => Promise<void>;
61+
"codeQLModelDetails.focus": () => Promise<void>;
6162
"markdown.showPreviewToSide": (uri: Uri) => Promise<void>;
6263
"workbench.action.closeActiveEditor": () => Promise<void>;
6364
revealFileInOS: (uri: Uri) => Promise<void>;

extensions/ql-vscode/src/data-extensions-editor/data-extensions-editor-view.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ import {
4747
import {
4848
enableFrameworkMode,
4949
showLlmGeneration,
50+
showModelDetailsView,
5051
useLlmGenerationV2,
5152
} from "../config";
5253
import { getAutoModelUsages } from "./auto-model-usages-query";
@@ -138,7 +139,7 @@ export class DataExtensionsEditorView extends AbstractWebview<
138139

139140
break;
140141
case "jumpToUsage":
141-
await this.jumpToUsage(msg.location);
142+
await this.handleJumpToUsage(msg.location);
142143

143144
break;
144145
case "saveModeledMethods":
@@ -211,6 +212,18 @@ export class DataExtensionsEditorView extends AbstractWebview<
211212
});
212213
}
213214

215+
protected async handleJumpToUsage(location: ResolvableLocationValue) {
216+
if (showModelDetailsView()) {
217+
await this.openModelDetailsView();
218+
} else {
219+
await this.jumpToUsage(location);
220+
}
221+
}
222+
223+
protected async openModelDetailsView() {
224+
await this.app.commands.execute("codeQLModelDetails.focus");
225+
}
226+
214227
protected async jumpToUsage(
215228
location: ResolvableLocationValue,
216229
): Promise<void> {

0 commit comments

Comments
 (0)