@@ -4,7 +4,7 @@ import { Features } from './utils';
44import * as vars from './variables' ;
55import * as dbg from './debugger' ;
66import * as dap from './dap' ;
7- import { refreshConfiguration , refreshVariablesConfiguration } from './configuration' ;
7+ import { markConfigFileDirty , refreshConfiguration } from './configuration' ;
88import { Log as logger } from './logger' ;
99import { setupPgConfSupport } from './pgconf' ;
1010import { setupFormatting } from './formatter' ;
@@ -515,49 +515,16 @@ function setupPgVariablesView(context: vscode.ExtensionContext) {
515515 const pgvars = createPgVariablesView ( context , nodeVars ) ;
516516
517517 setupNodeTagFiles ( context , nodeVars ) ;
518-
519- /* Refresh config files when debug session starts */
520- vscode . debug . onDidStartDebugSession ( async _ => {
521- if ( ! vscode . workspace . workspaceFolders ?. length ) {
522- return ;
523- }
524-
525- for ( const folder of vscode . workspace . workspaceFolders ) {
526- logger . info ( 'refreshing configuration files due to debug session start' ) ;
527- try {
528- const file = Configuration . getConfigFile ( folder . uri ) ;
529- await refreshVariablesConfiguration ( file ) ;
530- } catch ( err : unknown ) {
531- logger . error ( 'could not refresh configuration in workspace %s' , folder . uri . fsPath , err ) ;
532- }
533- }
534- } , undefined , context . subscriptions ) ;
535518
536519 return pgvars ;
537520}
538521
539522function setupConfigurationFile ( context : vscode . ExtensionContext ) {
540523 /* Mark configuration dirty when user changes it - no eager parsing */
541- /*
542- * TODO: use dirty flag, instead of eager parsing
543- * const configFileWatcher = vscode.workspace.createFileSystemWatcher(Configuration.ExtensionSettingsFileName, false, false, true);
544- * context.subscriptions.push(configFileWatcher);
545- * configFileWatcher.onDidChange(() => markConfigFileDirty());
546- * configFileWatcher.onDidCreate(() => markConfigFileDirty());
547- */
548-
549- /* Refresh config files when debug session starts */
550- vscode . debug . onDidStartDebugSession ( async _ => {
551- if ( ! vscode . workspace . workspaceFolders ?. length ) {
552- return ;
553- }
554-
555- logger . info ( 'refreshing configuration files due to debug session start' ) ;
556- for ( const folder of vscode . workspace . workspaceFolders ) {
557- const file = Configuration . getConfigFile ( folder . uri ) ;
558- await refreshVariablesConfiguration ( file ) ;
559- }
560- } , undefined , context . subscriptions ) ;
524+ const configFileWatcher = vscode . workspace . createFileSystemWatcher ( Configuration . ExtensionSettingsFileName , false , false , true ) ;
525+ context . subscriptions . push ( configFileWatcher ) ;
526+ configFileWatcher . onDidChange ( markConfigFileDirty , undefined , context . subscriptions ) ;
527+ configFileWatcher . onDidCreate ( markConfigFileDirty , undefined , context . subscriptions ) ;
561528}
562529
563530function registerCommands ( context : vscode . ExtensionContext , pgvars : vars . PgVariablesViewProvider ) {
@@ -611,18 +578,11 @@ function registerCommands(context: vscode.ExtensionContext, pgvars: vars.PgVaria
611578
612579 /* Refresh config file command */
613580 const refreshConfigCmd = async ( ) => {
614- if ( ! vscode . workspace . workspaceFolders ?. length ) {
615- return ;
616- }
617-
618581 logger . info ( 'refreshing config file due to command execution' ) ;
619- for ( const folder of vscode . workspace . workspaceFolders ) {
620- try {
621- const file = Configuration . getConfigFile ( folder . uri ) ;
622- await refreshConfiguration ( file ) ;
623- } catch ( err : unknown ) {
624- logger . error ( 'could not refresh configuration in workspace %s' , folder . uri . fsPath , err ) ;
625- }
582+ try {
583+ await refreshConfiguration ( ) ;
584+ } catch ( err : unknown ) {
585+ logger . error ( 'could not refresh configuration' , err ) ;
626586 }
627587 } ;
628588
@@ -761,6 +721,7 @@ function registerCommands(context: vscode.ExtensionContext, pgvars: vars.PgVaria
761721
762722async function setupNodeTagFiles ( context : vscode . ExtensionContext ,
763723 nodeVars : vars . NodeVarRegistry ) {
724+ /* TODO: remove this thing with setting */
764725 const getNodeTagFiles = ( ) => {
765726 /* TODO: remove this setting */
766727 const customNodeTagFiles = Configuration . getCustomNodeTagFiles ( ) ;
0 commit comments