@@ -501,8 +501,6 @@ export class Remote {
501501 sshMonitor . onLogFilePathChange ( ( newPath ) => {
502502 this . commands . workspaceLogPath = newPath ;
503503 } ) ,
504- // Watch for logDir configuration changes
505- this . watchLogDirSetting ( logDir , featureSet ) ,
506504 // Register the label formatter again because SSH overrides it!
507505 vscode . extensions . onDidChange ( ( ) => {
508506 // Dispose previous label formatter
@@ -516,6 +514,18 @@ export class Remote {
516514 } ) ,
517515 ...( await this . createAgentMetadataStatusBar ( agent , workspaceClient ) ) ,
518516 ) ;
517+
518+ const settingsToWatch = [
519+ { setting : "coder.globalFlags" , title : "Global flags" } ,
520+ { setting : "coder.sshFlags" , title : "SSH flags" } ,
521+ ] ;
522+ if ( featureSet . proxyLogDirectory ) {
523+ settingsToWatch . push ( {
524+ setting : "coder.proxyLogDirectory" ,
525+ title : "Proxy log directory" ,
526+ } ) ;
527+ }
528+ disposables . push ( this . watchSettings ( settingsToWatch ) ) ;
519529 } catch ( ex ) {
520530 // Whatever error happens, make sure we clean up the disposables in case of failure
521531 disposables . forEach ( ( d ) => d . dispose ( ) ) ;
@@ -790,29 +800,26 @@ export class Remote {
790800 return sshConfig . getRaw ( ) ;
791801 }
792802
793- private watchLogDirSetting (
794- currentLogDir : string ,
795- featureSet : FeatureSet ,
803+ private watchSettings (
804+ settings : Array < { setting : string ; title : string } > ,
796805 ) : vscode . Disposable {
797806 return vscode . workspace . onDidChangeConfiguration ( ( e ) => {
798- if ( ! e . affectsConfiguration ( "coder.proxyLogDirectory" ) ) {
799- return ;
800- }
801- const newLogDir = this . getLogDir ( featureSet ) ;
802- if ( newLogDir === currentLogDir ) {
803- return ;
807+ for ( const { setting, title } of settings ) {
808+ if ( ! e . affectsConfiguration ( setting ) ) {
809+ continue ;
810+ }
811+ vscode . window
812+ . showInformationMessage (
813+ `${ title } setting changed. Reload window to apply.` ,
814+ "Reload" ,
815+ )
816+ . then ( ( action ) => {
817+ if ( action === "Reload" ) {
818+ vscode . commands . executeCommand ( "workbench.action.reloadWindow" ) ;
819+ }
820+ } ) ;
821+ break ;
804822 }
805-
806- vscode . window
807- . showInformationMessage (
808- "Log directory configuration changed. Reload window to apply." ,
809- "Reload" ,
810- )
811- . then ( ( action ) => {
812- if ( action === "Reload" ) {
813- vscode . commands . executeCommand ( "workbench.action.reloadWindow" ) ;
814- }
815- } ) ;
816823 } ) ;
817824 }
818825
0 commit comments