Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
93 changes: 61 additions & 32 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -619,24 +624,34 @@ async function watchForInitialization(context: vscode.ExtensionContext, metadata
}

async function executeCommandsBefore(context: vscode.ExtensionContext) {
// Start status bar command non-blocking
void vscode.commands.executeCommand("workbench.action.toggleStatusbarVisibility");
// Check if UI minification is disabled
const disableUiMinification = vscode.workspace.getConfiguration("codex-editor-extension").get("disableUiMinification", false);

// 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();
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);
}
Expand All @@ -653,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...");
Expand All @@ -673,10 +694,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 - only when minification was enabled
await vscode.workspace
.getConfiguration()
.update("workbench.editor.showTabs", "multiple", true);
}
// Restore tab layout after splash screen closes
await restoreTabLayout(context);

Expand Down
33 changes: 19 additions & 14 deletions src/projectManager/projectInitializers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -207,4 +212,4 @@ export async function initializeProject(shouldImportUSFM: boolean) {
}
}
);
}
}
11 changes: 8 additions & 3 deletions src/providers/SplashScreen/SplashScreenProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down