From 3b855f66736b7a3fe9d3f9f037ecf08ce0fb070d Mon Sep 17 00:00:00 2001 From: Chad Norvell Date: Wed, 5 Jun 2024 19:29:50 +0000 Subject: [PATCH] pw_ide: Preserve modified editor settings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If you directly edit files like `settings.json`, those edits will be preserved during calls to `pw ide sync`. Fixes: b/344681641 Change-Id: Iac8f07f48f71e37915210cb71e9b9483e5ecc7f8 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/213670 Presubmit-Verified: CQ Bot Account Reviewed-by: Anthony DiGirolamo Commit-Queue: Chad Norvell Lint: Lint 🤖 --- pw_ide/docs.rst | 6 ++++++ pw_ide/py/pw_ide/commands.py | 1 + 2 files changed, 7 insertions(+) diff --git a/pw_ide/docs.rst b/pw_ide/docs.rst index f3cdf5d2d5..10c78076ae 100644 --- a/pw_ide/docs.rst +++ b/pw_ide/docs.rst @@ -213,6 +213,12 @@ can be augmented or overridden at the project level or the user level using generated ``settings.json`` file is essentially a build artifact and shouldn't be committed to source control. +.. note:: + + You should treat ``settings.json`` as a build artifact and avoid editing it + directly. However, if you do make changes to it, don't worry! The changes + will be preserved after running ``pw ide sync`` + The same pattern applies to ``tasks.json``, which provides Visual Studio Code tasks for ``pw_ide`` commands. Access these by opening the command palette (Ctrl/Cmd-Shift-P), selecting ``Tasks: Run Task``, then selecting the desired diff --git a/pw_ide/py/pw_ide/commands.py b/pw_ide/py/pw_ide/commands.py index c3d9646b2a..324dda5b62 100644 --- a/pw_ide/py/pw_ide/commands.py +++ b/pw_ide/py/pw_ide/commands.py @@ -260,6 +260,7 @@ def cmd_vscode( vsc_manager.default(settings_type).sync_to(active_settings) vsc_manager.project(settings_type).sync_to(active_settings) vsc_manager.user(settings_type).sync_to(active_settings) + vsc_manager.active(settings_type).sync_to(active_settings) new_settings_hash = vsc_manager.active(settings_type).hash() settings_changed = new_settings_hash != prev_settings_hash