Change:
const values: IJSONValue[] = []; if (extensionsConfigContent) { if (add) { <del> values.push({ path: ['extensions', 'recommendations'], value: [...extensionsConfigContent.recommendations || [], extensionId] }); if (extensionsConfigContent.unwantedRecommendations && extensionsConfigContent.unwantedRecommendations.some(e => e === extensionId)) { values.push({ path: ['extensions', 'unwantedRecommendations'], value: extensionsConfigContent.unwantedRecommendations.filter(e => e !== extensionId) }); </del> <ins> const path: JSONPath = ['extensions', 'recommendations']; if (Array.isArray(extensionsConfigContent.recommendations)) { values.push({ path: [...path, -1], value: extensionId }); } else { values.push({ path, value: [extensionId] }); } const unwantedRecommendationEdit = this.getEditToRemoveValueFromArray(['extensions', 'unwantedRecommendations'], extensionsConfigContent.unwantedRecommendations, extensionId); if (unwantedRecommendationEdit) { values.push(unwantedRecommendationEdit); </ins> } } else if (extensionsConfigContent.recommendations) { <del> values.push({ path: ['extensions', 'recommendations'], value: extensionsConfigContent.recommendations.filter(e => e !== extensionId) }); </del> <ins> const recommendationEdit = this.getEditToRemoveValueFromArray(['extensions', 'recommendations'], extensionsConfigContent.recommendations, extensionId); if (recommendationEdit) { values.push(recommendationEdit); } </ins> } } else if (add) { values.push({ path: ['extensions'], value: { recommendations: [extensionId] } });

Discussion:
<!-- Do Not Delete This! bugreporttemplate --<!-- Please read our Rules of Conduct: --<!-- Read our guide about submitting issues: --<!-- Search existing issues to avoid creating duplicates. --<!-- Test using the latest Insiders build to see if your issue has already been fixed: --<!-- Instead of creating your report here, use 'Report Issue' from the 'Help' menu in VS Code to pre-fill useful information. --<!-- Launch with to check. --Does this issue occur when all extensions are disabled?: Yes <!-- If you answered No above, use 'Help: Start Extension Bisect' from Command Palette to try to identify the cause. --<!-- Issues caused by an extension need to be reported directly to the extension publisher. The 'Help Report Issue' dialog can assist with this. --- VS Code Version: Version: 1.84.0 (system setup) OS: WindowsNT x64 10.0. Steps to Reproduce: "Add to Workspace Recommendations" any extension and select whichever place you like (i.e. among workspace & workspace folder) the or some comments inside_ the array once step 1. the comment from step 3. got erased. <!-- -- Titles & summaries: "add to rec" removes comments from extensions-recommendations array in the configuration file "add to rec" rewrites & hence erases any comments in extensions-recommendations array "add to rec" rewrites & hence erases any comments in Sample file:
Thanks for creating this issue! It looks like you may be using an old version of VS Code, the latest stable release is 1.84.2. Please try upgrading to the latest version and checking whether this issue remains. Happy Coding!
i wish there were patch updates if i have to update that frequently
p.s.: wow, never tried doing it from command palette pps: i think that no longer exists now
thanks all a lot