@@ -15,7 +15,7 @@ import Logger from './common/logger';
1515import * as PersistentState from './common/persistentState' ;
1616import { parseRepositoryRemotes } from './common/remote' ;
1717import { Resource } from './common/resources' ;
18- import { BRANCH_PUBLISH , EXPERIMENTAL_CHAT , EXPERIMENTAL_NOTIFICATIONS , FILE_LIST_LAYOUT , GIT , OPEN_DIFF_ON_CLICK , PR_SETTINGS_NAMESPACE } from './common/settingKeys' ;
18+ import { BRANCH_PUBLISH , EXPERIMENTAL_CHAT , EXPERIMENTAL_NOTIFICATIONS , FILE_LIST_LAYOUT , GIT , OPEN_DIFF_ON_CLICK , PR_SETTINGS_NAMESPACE , SHOW_INLINE_OPEN_FILE_ACTION } from './common/settingKeys' ;
1919import { TemporaryState } from './common/temporaryState' ;
2020import { Schemes , handler as uriHandler } from './common/uri' ;
2121import { EXTENSION_ID , FOCUS_REVIEW_MODE } from './constants' ;
@@ -286,8 +286,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<GitApi
286286 await commands . focusView ( 'github:activePullRequest:welcome' ) ;
287287 showPRController . shouldShow = shouldShow ;
288288 } ) ;
289- const openDiff = vscode . workspace . getConfiguration ( GIT , null ) . get ( OPEN_DIFF_ON_CLICK , true ) ;
290- await vscode . commands . executeCommand ( 'setContext' , 'openDiffOnClick' , openDiff ) ;
289+ await setGitSettingContexts ( context ) ;
291290
292291 // initialize resources
293292 Resource . initialize ( context ) ;
@@ -302,6 +301,22 @@ export async function activate(context: vscode.ExtensionContext): Promise<GitApi
302301 return apiImpl ;
303302}
304303
304+ async function setGitSettingContexts ( context : vscode . ExtensionContext ) {
305+ // We set contexts instead of using the config directly in package.json because the git extension might not actually be available.
306+ const settings : [ string , ( ) => void ] [ ] = [
307+ [ 'openDiffOnClick' , ( ) => vscode . workspace . getConfiguration ( GIT , null ) . get ( OPEN_DIFF_ON_CLICK , true ) ] ,
308+ [ 'showInlineOpenFileAction' , ( ) => vscode . workspace . getConfiguration ( GIT , null ) . get ( SHOW_INLINE_OPEN_FILE_ACTION , true ) ]
309+ ] ;
310+ for ( const [ contextName , setting ] of settings ) {
311+ commands . setContext ( contextName , setting ( ) ) ;
312+ context . subscriptions . push ( vscode . workspace . onDidChangeConfiguration ( e => {
313+ if ( e . affectsConfiguration ( `${ GIT } .${ contextName } ` ) ) {
314+ commands . setContext ( contextName , setting ( ) ) ;
315+ }
316+ } ) ) ;
317+ }
318+ }
319+
305320async function doRegisterBuiltinGitProvider ( context : vscode . ExtensionContext , credentialStore : CredentialStore , apiImpl : GitApiImpl ) : Promise < boolean > {
306321 const builtInGitProvider = await registerBuiltinGitProvider ( credentialStore , apiImpl ) ;
307322 if ( builtInGitProvider ) {
0 commit comments