33 ExtensionContext ,
44 Uri ,
55 ViewColumn ,
6+ window ,
67 workspace ,
78} from "vscode" ;
89import { AbstractWebview , WebviewPanelConfig } from "../abstract-webview" ;
@@ -25,6 +26,8 @@ import {
2526import { DatabaseItem } from "../local-databases" ;
2627import { CodeQLCliServer } from "../cli" ;
2728import { asError , assertNever , getErrorMessage } from "../pure/helpers-pure" ;
29+ import { ResolvableLocationValue } from "../pure/bqrs-cli-types" ;
30+ import { showResolvableLocation } from "../interface-utils" ;
2831import { decodeBqrsToExternalApiUsages } from "./bqrs" ;
2932import { redactableError } from "../pure/errors" ;
3033import { createDataExtensionYaml , loadDataExtensionYaml } from "./yaml" ;
@@ -73,6 +76,10 @@ export class DataExtensionsEditorView extends AbstractWebview<
7376 case "viewLoaded" :
7477 await this . onWebViewLoaded ( ) ;
7578
79+ break ;
80+ case "jumpToUsage" :
81+ await this . jumpToUsage ( msg . location ) ;
82+
7683 break ;
7784 case "saveModeledMethods" :
7885 await this . saveModeledMethods (
@@ -96,6 +103,26 @@ export class DataExtensionsEditorView extends AbstractWebview<
96103 ] ) ;
97104 }
98105
106+ protected async jumpToUsage (
107+ location : ResolvableLocationValue ,
108+ ) : Promise < void > {
109+ try {
110+ await showResolvableLocation ( location , this . databaseItem ) ;
111+ } catch ( e ) {
112+ if ( e instanceof Error ) {
113+ if ( e . message . match ( / F i l e n o t f o u n d / ) ) {
114+ void window . showErrorMessage (
115+ "Original file of this result is not in the database's source archive." ,
116+ ) ;
117+ } else {
118+ void extLogger . log ( `Unable to handleMsgFromView: ${ e . message } ` ) ;
119+ }
120+ } else {
121+ void extLogger . log ( `Unable to handleMsgFromView: ${ e } ` ) ;
122+ }
123+ }
124+ }
125+
99126 protected async saveModeledMethods (
100127 externalApiUsages : ExternalApiUsage [ ] ,
101128 modeledMethods : Record < string , ModeledMethod > ,
0 commit comments