Skip to content

Commit

Permalink
pw_ide: Preserve modified editor settings
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Anthony DiGirolamo <[email protected]>
Commit-Queue: Chad Norvell <[email protected]>
Lint: Lint 🤖 <[email protected]>
  • Loading branch information
chadnorvell authored and CQ Bot Account committed Jun 5, 2024
1 parent 46a21c4 commit 3b855f6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pw_ide/docs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions pw_ide/py/pw_ide/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3b855f6

Please sign in to comment.