vscode-file-nesting-config icon indicating copy to clipboard operation
vscode-file-nesting-config copied to clipboard

custom rules lost after update config

Open Krysl opened this issue 1 year ago • 3 comments

Describe the bug

I have some custom rules in %AppData%\Code\User\settings.json-explorer.fileNesting.patterns after update config by this extension, the custom rules are gone.

Reproduction

  1. add some custom rule in %AppData%\Code\User\settings.json, under explorer.fileNesting.patterns
  2. open Command Palette and run command File Nesting Updater: Update config now
  3. you will see the custom rule gone

System Info

System:
    OS: Windows 10 10.0.19045

Used Package Manager

n/a

Validations

  • [X] Follow our Code of Conduct
  • [X] Read the Contributing Guide.
  • [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • [X] Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • [X] The provided reproduction is a minimal reproducible of the bug.

Contributions

  • [ ] I am willing to submit a PR to fix this issue
  • [ ] I am willing to submit a PR with failing tests (actually just go ahead and do it, thanks!)

Krysl avatar Jul 11 '24 03:07 Krysl

Can confirm this happens for me too, annoying when I want to extend it. Maybe a comment can be added to the end for the updater to ignore that line? Better yet it should only replace or update what's in the config as opposed to that whole section.

joshistoast avatar Oct 08 '24 13:10 joshistoast

What can we do with this? Any idea?

baruchiro avatar Jul 31 '25 07:07 baruchiro

I'd have two solutions:

  1. Have a custom config field that gets added to the main on update, where you place your additions; possibly with a "_": "Please use file_nesting.custom instead!" (or comment, aldoe idk if extensions can write comments to settings.json
  2. Cache the old maps (if available) in the extension and store previous version somewhere, then only override the ones that match the previous maps

tizu69 avatar Aug 03 '25 09:08 tizu69