Merge pull request #2677 from github/robert-nora/set-up-model-details-view
Set up model details view
This commit is contained in:
@@ -1655,6 +1655,13 @@
|
||||
"title": "CodeQL",
|
||||
"icon": "media/logo.svg"
|
||||
}
|
||||
],
|
||||
"panel": [
|
||||
{
|
||||
"id": "codeql-model-details",
|
||||
"title": "CodeQL Model Details",
|
||||
"icon": "media/logo.svg"
|
||||
}
|
||||
]
|
||||
},
|
||||
"views": {
|
||||
@@ -1685,9 +1692,20 @@
|
||||
"name": "Evaluator Log Viewer",
|
||||
"when": "config.codeQL.canary"
|
||||
}
|
||||
],
|
||||
"codeql-model-details": [
|
||||
{
|
||||
"id": "codeQLModelDetails",
|
||||
"name": "CodeQL Model Details",
|
||||
"when": "config.codeQL.canary && config.codeQL.dataExtensions.modelDetailsView"
|
||||
}
|
||||
]
|
||||
},
|
||||
"viewsWelcome": [
|
||||
{
|
||||
"view": "codeQLModelDetails",
|
||||
"contents": "Loading..."
|
||||
},
|
||||
{
|
||||
"view": "codeQLAstViewer",
|
||||
"contents": "Run the 'CodeQL: View AST' command on an open source file from a CodeQL database.\n[View AST](command:codeQL.viewAst)"
|
||||
|
||||
@@ -58,6 +58,7 @@ export type ExplorerSelectionCommandFunction<Item> = (
|
||||
type BuiltInVsCodeCommands = {
|
||||
// The codeQLDatabases.focus command is provided by VS Code because we've registered the custom view
|
||||
"codeQLDatabases.focus": () => Promise<void>;
|
||||
"codeQLModelDetails.focus": () => Promise<void>;
|
||||
"markdown.showPreviewToSide": (uri: Uri) => Promise<void>;
|
||||
"workbench.action.closeActiveEditor": () => Promise<void>;
|
||||
revealFileInOS: (uri: Uri) => Promise<void>;
|
||||
|
||||
@@ -714,6 +714,11 @@ const EXTENSIONS_DIRECTORY = new Setting(
|
||||
"extensionsDirectory",
|
||||
DATA_EXTENSIONS,
|
||||
);
|
||||
const MODEL_DETAILS_VIEW = new Setting("modelDetailsView", DATA_EXTENSIONS);
|
||||
|
||||
export function showModelDetailsView(): boolean {
|
||||
return !!MODEL_DETAILS_VIEW.getValue<boolean>();
|
||||
}
|
||||
|
||||
export function showLlmGeneration(): boolean {
|
||||
return !!LLM_GENERATION.getValue<boolean>();
|
||||
|
||||
@@ -47,6 +47,7 @@ import {
|
||||
import {
|
||||
enableFrameworkMode,
|
||||
showLlmGeneration,
|
||||
showModelDetailsView,
|
||||
useLlmGenerationV2,
|
||||
} from "../config";
|
||||
import { getAutoModelUsages } from "./auto-model-usages-query";
|
||||
@@ -138,7 +139,7 @@ export class DataExtensionsEditorView extends AbstractWebview<
|
||||
|
||||
break;
|
||||
case "jumpToUsage":
|
||||
await this.jumpToUsage(msg.location);
|
||||
await this.handleJumpToUsage(msg.location);
|
||||
|
||||
break;
|
||||
case "saveModeledMethods":
|
||||
@@ -211,6 +212,18 @@ export class DataExtensionsEditorView extends AbstractWebview<
|
||||
});
|
||||
}
|
||||
|
||||
protected async handleJumpToUsage(location: ResolvableLocationValue) {
|
||||
if (showModelDetailsView()) {
|
||||
await this.openModelDetailsView();
|
||||
} else {
|
||||
await this.jumpToUsage(location);
|
||||
}
|
||||
}
|
||||
|
||||
protected async openModelDetailsView() {
|
||||
await this.app.commands.execute("codeQLModelDetails.focus");
|
||||
}
|
||||
|
||||
protected async jumpToUsage(
|
||||
location: ResolvableLocationValue,
|
||||
): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user