From ac466afabb0a554c85d47af9e479c3a6214208c0 Mon Sep 17 00:00:00 2001 From: Himanshu Date: Tue, 28 Jan 2025 16:20:21 +0530 Subject: [PATCH] revert copy settings --- extensions/vscode/src/copySettings.ts | 38 ++++----------------------- 1 file changed, 5 insertions(+), 33 deletions(-) diff --git a/extensions/vscode/src/copySettings.ts b/extensions/vscode/src/copySettings.ts index 155c87a0f9..84f39b89ff 100644 --- a/extensions/vscode/src/copySettings.ts +++ b/extensions/vscode/src/copySettings.ts @@ -45,32 +45,8 @@ async function copyVSCodeSettingsToPearAIDir() { await fs.promises.mkdir(pearAIDevSettingsDir, { recursive: true }); await fs.promises.mkdir(pearAIDevExtensionsDir, { recursive: true }); + const itemsToCopy = ['settings.json', 'keybindings.json', 'snippets', 'sync', 'globalStorage/state.vscdb', 'globalStorage/state.vscdb.backup']; - // Special handling for copying settings.json to filter out layout settings - const settingsSource = path.join(vscodeSettingsDir, 'settings.json'); - const settingsDestination = path.join(pearAIDevSettingsDir, 'settings.json'); - try { - if (await fs.promises.access(settingsSource).then(() => true).catch(() => false)) { - const settingsContent = await fs.promises.readFile(settingsSource, 'utf8'); - const settings = JSON.parse(settingsContent); - - // Filter out layout-related settings - const filteredSettings = Object.fromEntries( - Object.entries(settings).filter(([key]) => !key.includes('workbench.') && !key.includes('window.')) - ); - - await fs.promises.writeFile( - settingsDestination, - JSON.stringify(filteredSettings, null, 2) - ); - } - } catch (error) { - console.error(`Error copying settings.json: ${error}`); - } - - - const itemsToCopy = ['snippets', 'keybindings.json', 'sync', 'globalStorage/state.vscdb', 'globalStorage/state.vscdb.backup']; - for (const item of itemsToCopy) { const source = path.join(vscodeSettingsDir, item); const destination = path.join(pearAIDevSettingsDir, item); @@ -167,14 +143,10 @@ export async function importUserSettingsFromVSCode() { vscode.window.showInformationMessage('Copying your current VSCode settings and extensions over to PearAI!'); await copyVSCodeSettingsToPearAIDir(); - const result = await vscode.window.showInformationMessage( - 'Your VSCode settings and extensions have been transferred over to PearAI! Please restart extension host to activate imported extensions.', - 'Ok', 'Restart Extension Host' + vscode.window.showInformationMessage( + 'Your VSCode settings and extensions have been transferred over to PearAI! You may need to restart your editor for the changes to take effect.', + 'Ok' ); - - if (result === 'Restart Extension Host') { - vscode.commands.executeCommand('workbench.action.restartExtensionHost'); - } } catch (error) { vscode.window.showErrorMessage(`Failed to copy settings: ${error}`); } @@ -194,4 +166,4 @@ export async function markCreatorOnboardingCompleteFileBased() { } catch (error) { console.error('Error marking creator onboarding complete:', error); } -} +} \ No newline at end of file