From a4f049e06e8a7b15c977b6d4dfeb9445cbff1264 Mon Sep 17 00:00:00 2001 From: Joshua Lansford Date: Thu, 14 Aug 2025 13:44:39 -0400 Subject: [PATCH 1/2] Implemented disableUiMinification --- package.json | 6 ++ src/extension.ts | 60 ++++++++++++------- .../SplashScreen/SplashScreenProvider.ts | 11 +++- 3 files changed, 54 insertions(+), 23 deletions(-) diff --git a/package.json b/package.json index f8feb709f..07dd6ba06 100644 --- a/package.json +++ b/package.json @@ -592,6 +592,12 @@ { "title": "Codex Extension", "properties": { + "codex-editor-extension.disableUiMinification": { + "title": "Disable UI Minification", + "type": "boolean", + "default": false, + "description": "When enabled, prevents the extension from hiding VSCode interface elements to provide a cleaner translation studio experience. Useful for developers who want to access VSCode features." + }, "codex-editor-extension.api_key": { "title": "API Key", "type": "string", diff --git a/src/extension.ts b/src/extension.ts index 1cc5df062..a470e1eae 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -249,9 +249,14 @@ export async function activate(context: vscode.ExtensionContext) { try { // Configure editor layout const layoutStart = globalThis.performance.now(); - // Use maximizeEditorHideSidebar directly to create a clean, focused editor experience on startup - // note: there may be no active editor yet, so we need to see if the welcome view is needed initially - await vscode.commands.executeCommand("workbench.action.maximizeEditorHideSidebar"); + // Check if UI minification is disabled + const disableUiMinification = vscode.workspace.getConfiguration("codex-editor-extension").get("disableUiMinification", false); + + if (!disableUiMinification) { + // Use maximizeEditorHideSidebar directly to create a clean, focused editor experience on startup + // note: there may be no active editor yet, so we need to see if the welcome view is needed initially + await vscode.commands.executeCommand("workbench.action.maximizeEditorHideSidebar"); + } stepStart = trackTiming("Configuring Editor Layout", layoutStart); // Setup pre-activation commands @@ -619,24 +624,31 @@ async function watchForInitialization(context: vscode.ExtensionContext, metadata } async function executeCommandsBefore(context: vscode.ExtensionContext) { + // Check if UI minification is disabled + const disableUiMinification = vscode.workspace.getConfiguration("codex-editor-extension").get("disableUiMinification", false); + // Start status bar command non-blocking void vscode.commands.executeCommand("workbench.action.toggleStatusbarVisibility"); // Batch all config updates with Promise.all instead of sequential awaits const config = vscode.workspace.getConfiguration(); - await Promise.all([ - config.update("workbench.statusBar.visible", false, true), - config.update("breadcrumbs.filePath", "last", true), - config.update("breadcrumbs.enabled", false, true), // hide breadcrumbs for now... it shows the file name which cannot be localized - config.update("workbench.editor.editorActionsLocation", "hidden", true), - config.update("workbench.editor.showTabs", "none", true), // Hide tabs during splash screen - config.update("window.autoDetectColorScheme", true, true), - config.update("workbench.editor.revealIfOpen", true, true), - config.update("workbench.layoutControl.enabled", false, true), - config.update("workbench.tips.enabled", false, true), - config.update("workbench.editor.limit.perEditorGroup", false, true), - config.update("workbench.editor.limit.value", 4, true), - ]); + + if (!disableUiMinification) { + // Only hide UI elements if minification is enabled + await Promise.all([ + config.update("workbench.statusBar.visible", false, true), + config.update("breadcrumbs.filePath", "last", true), + config.update("breadcrumbs.enabled", false, true), // hide breadcrumbs for now... it shows the file name which cannot be localized + config.update("workbench.editor.editorActionsLocation", "hidden", true), + config.update("workbench.editor.showTabs", "none", true), // Hide tabs during splash screen + config.update("workbench.layoutControl.enabled", false, true), + config.update("workbench.tips.enabled", false, true), + config.update("workbench.editor.limit.perEditorGroup", false, true), + config.update("workbench.editor.limit.value", 4, true), + config.update("window.autoDetectColorScheme", true, true), + config.update("workbench.editor.revealIfOpen", true, true), + ]); + } registerCommandsBefore(context); } @@ -673,10 +685,18 @@ async function executeCommandsAfter(context: vscode.ExtensionContext) { debug( "[Extension] Splash screen closed, checking if welcome view needs to be shown" ); - // Show tabs again after splash screen closes - await vscode.workspace - .getConfiguration() - .update("workbench.editor.showTabs", "multiple", true); + + // Check if UI minification is disabled + const disableUiMinification = vscode.workspace.getConfiguration("codex-editor-extension").get("disableUiMinification", false); + + // Only show tabs again if minification is enabled (default behavior) + // If minification is disabled, tabs should already be visible + if (!disableUiMinification) { + // Show tabs again after splash screen closes + await vscode.workspace + .getConfiguration() + .update("workbench.editor.showTabs", "multiple", true); + } // Restore tab layout after splash screen closes await restoreTabLayout(context); diff --git a/src/providers/SplashScreen/SplashScreenProvider.ts b/src/providers/SplashScreen/SplashScreenProvider.ts index e9fa14b68..c0f8770b7 100644 --- a/src/providers/SplashScreen/SplashScreenProvider.ts +++ b/src/providers/SplashScreen/SplashScreenProvider.ts @@ -77,9 +77,14 @@ export class SplashScreenProvider { // Execute UI commands in background after splash is visible setTimeout(async () => { try { - // Maximize editor and hide tab bar after splash is shown - await vscode.commands.executeCommand("workbench.action.maximizeEditorHideSidebar"); - debug("[SplashScreen] Maximized editor layout"); + // Check if UI minification is disabled + const disableUiMinification = vscode.workspace.getConfiguration("codex-editor-extension").get("disableUiMinification", false); + + if (!disableUiMinification) { + // Maximize editor and hide tab bar after splash is shown + await vscode.commands.executeCommand("workbench.action.maximizeEditorHideSidebar"); + debug("[SplashScreen] Maximized editor layout"); + } } catch (error) { console.warn("Failed to execute maximize command:", error); } From 18d28f36dfef82a71958a441250206980c8e48d9 Mon Sep 17 00:00:00 2001 From: Joshua Lansford Date: Thu, 14 Aug 2025 14:13:19 -0400 Subject: [PATCH 2/2] Missed the status bar toggle --- src/extension.ts | 35 ++++++++++++++--------- src/projectManager/projectInitializers.ts | 33 ++++++++++++--------- 2 files changed, 41 insertions(+), 27 deletions(-) diff --git a/src/extension.ts b/src/extension.ts index a470e1eae..623f8a558 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -627,8 +627,11 @@ async function executeCommandsBefore(context: vscode.ExtensionContext) { // Check if UI minification is disabled const disableUiMinification = vscode.workspace.getConfiguration("codex-editor-extension").get("disableUiMinification", false); - // Start status bar command non-blocking - void vscode.commands.executeCommand("workbench.action.toggleStatusbarVisibility"); + // Only toggle status bar visibility if minification is enabled + if (!disableUiMinification) { + // Start status bar command non-blocking + void vscode.commands.executeCommand("workbench.action.toggleStatusbarVisibility"); + } // Batch all config updates with Promise.all instead of sequential awaits const config = vscode.workspace.getConfiguration(); @@ -665,17 +668,23 @@ async function executeCommandsAfter(context: vscode.ExtensionContext) { console.warn("Failed to set editor font, possibly due to network issues:", error); } - // Configure auto-save in settings - await vscode.workspace - .getConfiguration() - .update("files.autoSave", "afterDelay", vscode.ConfigurationTarget.Global); - await vscode.workspace - .getConfiguration() - .update("files.autoSaveDelay", 1000, vscode.ConfigurationTarget.Global); + // Check if UI minification is disabled + const disableUiMinification = vscode.workspace.getConfiguration("codex-editor-extension").get("disableUiMinification", false); - await vscode.workspace - .getConfiguration() - .update("codex-project-manager.spellcheckIsEnabled", false, vscode.ConfigurationTarget.Global); + // Only apply opinionated global settings if UI minification is enabled (not disabled) + if (!disableUiMinification) { + // Configure auto-save in settings - only when minification is enabled + await vscode.workspace + .getConfiguration() + .update("files.autoSave", "afterDelay", vscode.ConfigurationTarget.Global); + await vscode.workspace + .getConfiguration() + .update("files.autoSaveDelay", 1000, vscode.ConfigurationTarget.Global); + + await vscode.workspace + .getConfiguration() + .update("codex-project-manager.spellcheckIsEnabled", false, vscode.ConfigurationTarget.Global); + } // Final splash screen update and close updateSplashScreenSync(100, "Finalizing setup..."); @@ -692,7 +701,7 @@ async function executeCommandsAfter(context: vscode.ExtensionContext) { // Only show tabs again if minification is enabled (default behavior) // If minification is disabled, tabs should already be visible if (!disableUiMinification) { - // Show tabs again after splash screen closes + // Show tabs again after splash screen closes - only when minification was enabled await vscode.workspace .getConfiguration() .update("workbench.editor.showTabs", "multiple", true); diff --git a/src/projectManager/projectInitializers.ts b/src/projectManager/projectInitializers.ts index 00d3a4e16..1d040eed1 100644 --- a/src/projectManager/projectInitializers.ts +++ b/src/projectManager/projectInitializers.ts @@ -56,19 +56,24 @@ export async function setTargetFont() { ); } } - const config = vscode.workspace.getConfiguration(); - const fallbackFont = "serif"; - // config.update( - // "editor.fontFamily", - // fallbackFont, - // vscode.ConfigurationTarget.Workspace, - // ); - config.update( - "editor.fontFamily", - `${defaultFontFamily} ${fallbackFont}`, - vscode.ConfigurationTarget.Workspace - ); - console.log(`Font set to ${defaultFontFamily} with fallback to ${fallbackFont}`); + // Check if UI minification is disabled before setting font + const disableUiMinification = vscode.workspace.getConfiguration("codex-editor-extension").get("disableUiMinification", false); + + if (!disableUiMinification) { + const config = vscode.workspace.getConfiguration(); + const fallbackFont = "serif"; + // config.update( + // "editor.fontFamily", + // fallbackFont, + // vscode.ConfigurationTarget.Workspace, + // ); + config.update( + "editor.fontFamily", + `${defaultFontFamily} ${fallbackFont}`, + vscode.ConfigurationTarget.Workspace + ); + console.log(`Font set to ${defaultFontFamily} with fallback to ${fallbackFont}`); + } } } enum ConfirmationOptions { @@ -207,4 +212,4 @@ export async function initializeProject(shouldImportUSFM: boolean) { } } ); -} \ No newline at end of file +}