1- import { ViewColumn } from "vscode" ;
1+ import type { ConfigurationChangeEvent } from "vscode" ;
2+ import { ViewColumn , workspace } from "vscode" ;
23import type { WebviewPanelConfig } from "../common/vscode/abstract-webview" ;
34import { AbstractWebview } from "../common/vscode/abstract-webview" ;
45import {
@@ -27,6 +28,7 @@ import type { App } from "../common/app";
2728import {
2829 getVariantAnalysisDefaultResultsFilter ,
2930 getVariantAnalysisDefaultResultsSort ,
31+ isCanary ,
3032} from "../config" ;
3133
3234export class VariantAnalysisView
@@ -46,13 +48,48 @@ export class VariantAnalysisView
4648 manager . registerView ( this ) ;
4749
4850 this . dataFlowPathsView = new DataFlowPathsView ( app ) ;
51+
52+ // Set up configuration change listener
53+ this . push (
54+ workspace . onDidChangeConfiguration (
55+ this . onConfigurationChanged . bind ( this ) ,
56+ ) ,
57+ ) ;
58+ }
59+
60+ /**
61+ * Handler for configuration changes
62+ */
63+ private onConfigurationChanged ( e : ConfigurationChangeEvent ) : void {
64+ // Check if the canary setting has changed
65+ if ( e . affectsConfiguration ( "codeQL.canary" ) ) {
66+ void this . updateUserSettings ( ) ;
67+ }
68+ }
69+
70+ private async updateUserSettings ( ) : Promise < void > {
71+ if ( ! this . isShowingPanel ) {
72+ return ;
73+ }
74+
75+ await this . postMessage ( {
76+ t : "setUserSettings" ,
77+ userSettings : {
78+ // Provenance is not supported in variant analysis view
79+ shouldShowProvenance : false ,
80+ // Only show "View Autofixes" button in canary mode.
81+ shouldShowViewAutofixesBtn : isCanary ( ) ,
82+ } ,
83+ } ) ;
4984 }
5085
5186 public async openView ( ) {
5287 const panel = await this . getPanel ( ) ;
5388 panel . reveal ( undefined , true ) ;
5489
5590 await this . waitForPanelLoaded ( ) ;
91+
92+ await this . updateUserSettings ( ) ;
5693 }
5794
5895 public async updateView ( variantAnalysis : VariantAnalysis ) : Promise < void > {
0 commit comments