@@ -1658,63 +1658,85 @@ async function rawExtraction(uri?: vscode.Uri, uris?: vscode.Uri[]): Promise<voi
16581658function dumpAllExtensionSettings ( ) : void {
16591659 try {
16601660 log ( '=== EXTENSION SETTINGS DUMP ===' , 'dumpAllExtensionSettings' , 'debug' ) ;
1661-
16621661 const extensionId = 'excel-power-query-editor' ;
1663-
16641662 // Get all configuration scopes
16651663 const userConfig = vscode . workspace . getConfiguration ( extensionId , null ) ;
16661664 const workspaceConfig = vscode . workspace . getConfiguration ( extensionId , vscode . workspace . workspaceFolders ?. [ 0 ] ?. uri ) ;
1667-
1668- // Define all known extension settings
1669- const knownSettings = [
1670- 'watchAlways' ,
1671- 'watchAlwaysMaxFiles' ,
1672- 'watchOffOnDelete' ,
1673- 'syncDeleteAlwaysConfirm' ,
1674- 'verboseMode' ,
1675- 'autoBackupBeforeSync' ,
1676- 'backupLocation' ,
1677- 'customBackupPath' ,
1678- 'backup.maxFiles' ,
1679- 'autoCleanupBackups' ,
1680- 'syncTimeout' ,
1681- 'debugMode' ,
1682- 'showStatusBarInfo' ,
1683- 'sync.openExcelAfterWrite' ,
1684- 'sync.debounceMs' ,
1685- 'watch.checkExcelWriteable'
1686- ] ;
1687-
1688- log ( 'USER SETTINGS (Global):' , 'dumpAllExtensionSettings' , 'debug' ) ;
1689- for ( const setting of knownSettings ) {
1690- const value = userConfig . get ( setting ) ;
1691- const hasValue = userConfig . has ( setting ) ;
1692- log ( ` ${ setting } : ${ hasValue ? JSON . stringify ( value ) : '<not set>' } ` , 'dumpAllExtensionSettings' , 'debug' ) ;
1693- }
1694-
1695- log ( 'WORKSPACE SETTINGS:' , 'dumpAllExtensionSettings' , 'debug' ) ;
1696- for ( const setting of knownSettings ) {
1697- const value = workspaceConfig . get ( setting ) ;
1698- const hasValue = workspaceConfig . has ( setting ) ;
1699- log ( ` ${ setting } : ${ hasValue ? JSON . stringify ( value ) : '<not set>' } ` , 'dumpAllExtensionSettings' , 'debug' ) ;
1665+ // Collect all keys from both configs
1666+ const allKeys = new Set < string > ( ) ;
1667+ for ( const key of Object . keys ( userConfig ) ) { allKeys . add ( key ) ; }
1668+ for ( const key of Object . keys ( workspaceConfig ) ) { allKeys . add ( key ) ; }
1669+ // Always include logLevel
1670+ // allKeys.add('logLevel');
1671+ // Dump each setting with its value and source
1672+ for ( const key of Array . from ( allKeys ) . sort ( ) ) {
1673+ let value : any = undefined ;
1674+ let source : string = 'default' ;
1675+ if ( workspaceConfig . has ( key ) ) {
1676+ value = workspaceConfig . get ( key ) ;
1677+ source = 'workspace' ;
1678+ } else if ( userConfig . has ( key ) ) {
1679+ value = userConfig . get ( key ) ;
1680+ source = 'user' ;
1681+ } else {
1682+ value = vscode . workspace . getConfiguration ( extensionId ) . inspect ( key ) ?. defaultValue ;
1683+ }
1684+ log ( ` ${ key } : ${ JSON . stringify ( value ) } [${ source } ]` , 'dumpAllExtensionSettings' , 'debug' ) ;
17001685 }
1701-
17021686 // Check environment info
17031687 log ( 'ENVIRONMENT INFO:' , 'dumpAllExtensionSettings' , 'debug' ) ;
17041688 log ( ` Remote Name: ${ vscode . env . remoteName || '<not remote>' } ` , 'dumpAllExtensionSettings' , 'info' ) ;
17051689 log ( ` VS Code Version: ${ vscode . version } ` , 'dumpAllExtensionSettings' , 'info' ) ;
17061690 log ( ` Workspace Folders: ${ vscode . workspace . workspaceFolders ?. length || 0 } ` , 'dumpAllExtensionSettings' , 'info' ) ;
1707-
17081691 // Check if we're in a dev container
17091692 const isDevContainer = vscode . env . remoteName ?. includes ( 'dev-container' ) ;
17101693 log ( ` Is Dev Container: ${ isDevContainer } ` , 'dumpAllExtensionSettings' , 'info' ) ;
1711-
17121694 log ( '=== END SETTINGS DUMP ===' , 'dumpAllExtensionSettings' , 'info' ) ;
1713-
17141695 } catch ( error ) {
17151696 log ( `Failed to dump settings: ${ error } ` , 'dumpAllExtensionSettings' , 'error' ) ;
17161697 }
17171698}
1699+ // Migrate legacy debugMode/verboseMode to logLevel at activation
1700+ export async function migrateLegacySettings ( ) {
1701+ const extensionId = 'excel-power-query-editor' ;
1702+ const config = vscode . workspace . getConfiguration ( extensionId ) ;
1703+ const debugMode = config . get ( 'debugMode' ) ;
1704+ const verboseMode = config . get ( 'verboseMode' ) ;
1705+ let needsUpdate = false ;
1706+ let newLogLevel : string | undefined = undefined ;
1707+ if ( debugMode === true ) {
1708+ newLogLevel = 'debug' ;
1709+ needsUpdate = true ;
1710+ } else if ( verboseMode === true ) {
1711+ newLogLevel = 'verbose' ;
1712+ needsUpdate = true ;
1713+ }
1714+ if ( needsUpdate ) {
1715+ await config . update ( 'logLevel' , newLogLevel , vscode . ConfigurationTarget . Workspace ) ;
1716+ await config . update ( 'debugMode' , undefined , vscode . ConfigurationTarget . Workspace ) ;
1717+ await config . update ( 'verboseMode' , undefined , vscode . ConfigurationTarget . Workspace ) ;
1718+ log ( `Migrated legacy settings to logLevel='${ newLogLevel } ' and removed debugMode/verboseMode from workspace settings` , 'settingsMigration' , 'info' ) ;
1719+ }
1720+ // Also check user settings
1721+ const userConfig = vscode . workspace . getConfiguration ( extensionId , null ) ;
1722+ const userDebug = userConfig . get ( 'debugMode' ) ;
1723+ const userVerbose = userConfig . get ( 'verboseMode' ) ;
1724+ let userNeedsUpdate = false ;
1725+ let userLogLevel : string | undefined = undefined ;
1726+ if ( userDebug === true ) {
1727+ userLogLevel = 'debug' ;
1728+ userNeedsUpdate = true ;
1729+ } else if ( userVerbose === true ) {
1730+ userLogLevel = 'verbose' ;
1731+ userNeedsUpdate = true ;
1732+ }
1733+ if ( userNeedsUpdate ) {
1734+ await userConfig . update ( 'logLevel' , userLogLevel , vscode . ConfigurationTarget . Global ) ;
1735+ await userConfig . update ( 'debugMode' , undefined , vscode . ConfigurationTarget . Global ) ;
1736+ await userConfig . update ( 'verboseMode' , undefined , vscode . ConfigurationTarget . Global ) ;
1737+ log ( `Migrated legacy settings to logLevel='${ userLogLevel } ' and removed debugMode/verboseMode from user settings` , 'settingsMigration' , 'info' ) ;
1738+ }
1739+ }
17181740
17191741async function findExcelFile ( mFilePath : string ) : Promise < string | undefined > {
17201742 const dir = path . dirname ( mFilePath ) ;
@@ -1735,6 +1757,8 @@ async function findExcelFile(mFilePath: string): Promise<string | undefined> {
17351757
17361758async function cleanupBackupsCommand ( uri ?: vscode . Uri ) : Promise < void > {
17371759 try {
1760+ // Migrate legacy settings on every activation
1761+ await migrateLegacySettings ( ) ;
17381762 // Validate URI parameter - don't show file dialog for invalid input
17391763 if ( uri && ( ! uri . fsPath || typeof uri . fsPath !== 'string' ) ) {
17401764 const errorMsg = 'Invalid URI parameter provided to cleanupBackups command' ;
0 commit comments