@@ -4,13 +4,19 @@ import {resetGitHubContext} from "../git/repository";
44
55const settingsKey = "github-actions" ;
66const DEFAULT_GITHUB_API = "https://api.github.com" ;
7+ const reloadWindowAction = "Reload Window" ;
8+ const debuggerEnabledSettingsKey = getSettingsKey ( "debugger.enabled" ) ;
9+
10+ let debuggerSettingReloadPromptVisible = false ;
711
812export function initConfiguration ( context : vscode . ExtensionContext ) {
913 context . subscriptions . push (
1014 vscode . workspace . onDidChangeConfiguration ( async e => {
1115 if ( e . affectsConfiguration ( getSettingsKey ( "workflows.pinned" ) ) ) {
1216 pinnedWorkflowsChangeHandlers . forEach ( h => h ( ) ) ;
13- } else if (
17+ }
18+
19+ if (
1420 e . affectsConfiguration ( getSettingsKey ( "use-enterprise" ) ) ||
1521 ( useEnterprise ( ) &&
1622 ( e . affectsConfiguration ( "github-enterprise.uri" ) || e . affectsConfiguration ( getSettingsKey ( "remote-name" ) ) ) )
@@ -19,6 +25,10 @@ export function initConfiguration(context: vscode.ExtensionContext) {
1925 resetGitHubContext ( ) ;
2026 await vscode . commands . executeCommand ( "github-actions.explorer.refresh" ) ;
2127 }
28+
29+ if ( e . affectsConfiguration ( debuggerEnabledSettingsKey ) ) {
30+ await promptToReloadForDebuggerSettingChange ( context ) ;
31+ }
2232 } )
2333 ) ;
2434}
@@ -64,6 +74,10 @@ export function getRemoteName(): string {
6474 return getConfiguration ( ) . get < string > ( getSettingsKey ( "remote-name" ) , "origin" ) ;
6575}
6676
77+ export function isDebuggerEnabled ( ) : boolean {
78+ return getConfiguration ( ) . get < boolean > ( debuggerEnabledSettingsKey , false ) ;
79+ }
80+
6781export function useEnterprise ( ) : boolean {
6882 return getConfiguration ( ) . get < boolean > ( getSettingsKey ( "use-enterprise" ) , false ) ;
6983}
@@ -87,3 +101,35 @@ async function updateLanguageServerApiUrl(context: vscode.ExtensionContext) {
87101
88102 await initLanguageServer ( context ) ;
89103}
104+
105+ async function promptToReloadForDebuggerSettingChange ( context : vscode . ExtensionContext ) {
106+ if ( vscode . env . uiKind !== vscode . UIKind . Desktop ) {
107+ return ;
108+ }
109+
110+ if ( debuggerSettingReloadPromptVisible ) {
111+ return ;
112+ }
113+
114+ debuggerSettingReloadPromptVisible = true ;
115+
116+ try {
117+ if ( context . extensionMode !== vscode . ExtensionMode . Production ) {
118+ await vscode . window . showInformationMessage (
119+ "Reload VS Code manually to apply the GitHub Actions debugger preview setting change. Automatic reload is disabled in the Extension Development Host."
120+ ) ;
121+ return ;
122+ }
123+
124+ const selection = await vscode . window . showInformationMessage (
125+ "Reload VS Code to apply the GitHub Actions debugger preview setting change." ,
126+ reloadWindowAction
127+ ) ;
128+
129+ if ( selection === reloadWindowAction ) {
130+ await vscode . commands . executeCommand ( "workbench.action.reloadWindow" ) ;
131+ }
132+ } finally {
133+ debuggerSettingReloadPromptVisible = false ;
134+ }
135+ }
0 commit comments