Add command to jump to usage location
This commit is contained in:
@@ -12,6 +12,7 @@ import type {
|
||||
} from "../variant-analysis/shared/variant-analysis";
|
||||
import type { QLDebugConfiguration } from "../debugger/debug-configuration";
|
||||
import type { QueryTreeViewItem } from "../queries-panel/query-tree-view-item";
|
||||
import type { Usage } from "../data-extensions-editor/external-api-usage";
|
||||
|
||||
// A command function matching the signature that VS Code calls when
|
||||
// a command is invoked from a context menu on a TreeView with
|
||||
@@ -304,6 +305,10 @@ export type PackagingCommands = {
|
||||
|
||||
export type DataExtensionsEditorCommands = {
|
||||
"codeQL.openDataExtensionsEditor": () => Promise<void>;
|
||||
"codeQLDataExtensions.jumpToUsageLocation": (
|
||||
usage: Usage,
|
||||
databaseItem: DatabaseItem,
|
||||
) => Promise<void>;
|
||||
};
|
||||
|
||||
export type EvalLogViewerCommands = {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { DataExtensionsEditorView } from "./data-extensions-editor-view";
|
||||
import { DataExtensionsEditorCommands } from "../common/commands";
|
||||
import { CliVersionConstraint, CodeQLCliServer } from "../codeql-cli/cli";
|
||||
import { QueryRunner } from "../query-server";
|
||||
import { DatabaseManager } from "../databases/local-databases";
|
||||
import { DatabaseItem, DatabaseManager } from "../databases/local-databases";
|
||||
import { ensureDir } from "fs-extra";
|
||||
import { join } from "path";
|
||||
import { App } from "../common/app";
|
||||
@@ -23,6 +23,8 @@ import { setUpPack } from "./external-api-usage-query";
|
||||
import { DisposableObject } from "../common/disposable-object";
|
||||
import { ModelDetailsPanel } from "./model-details/model-details-panel";
|
||||
import { Mode } from "./shared/mode";
|
||||
import { showResolvableLocation } from "../databases/local-databases/locations";
|
||||
import { Usage } from "./external-api-usage";
|
||||
|
||||
const SUPPORTED_LANGUAGES: string[] = ["java", "csharp"];
|
||||
|
||||
@@ -154,6 +156,12 @@ export class DataExtensionsEditorModule extends DisposableObject {
|
||||
},
|
||||
);
|
||||
},
|
||||
"codeQLDataExtensions.jumpToUsageLocation": async (
|
||||
usage: Usage,
|
||||
databaseItem: DatabaseItem,
|
||||
) => {
|
||||
await showResolvableLocation(usage.url, databaseItem, this.app.logger);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,8 @@ describe("commands declared in package.json", () => {
|
||||
command.match(/^codeQLQueryHistory\./) ||
|
||||
command.match(/^codeQLAstViewer\./) ||
|
||||
command.match(/^codeQLEvalLogViewer\./) ||
|
||||
command.match(/^codeQLTests\./)
|
||||
command.match(/^codeQLTests\./) ||
|
||||
command.match(/^codeQLDataExtensions\./)
|
||||
) {
|
||||
scopedCmds.add(command);
|
||||
expect(title).toBeDefined();
|
||||
|
||||
Reference in New Issue
Block a user