iSplasher/preferences-inheritance

Loss of data after merge

Opened this issue · 5 comments

Here testing stuff with 1.1.0.
settings.core.json
settings.ui.json
settings.shell.json
settings.python.json

After merge I get this final json:
settings.json

emeraldwalk.runonsave is missing in the final JSON. Also space formatting is not preserved:

  "emeraldwalk.runonsave": {
    "commands": [
      {
        "match": "\\.vscode/settings\\.(.+)\\.json$",
        "cmd": "sed '/^\\s*\\/\\//d' ${workspaceFolder}/.vscode/settings.*.json | sed -z 's/,\\s*\\([]}]\\)/\\1/g' | jq -s 'reduce .[] as $item ({}; . * $item)' > /tmp/settings.json && mv /tmp/settings.json ${workspaceFolder}/.vscode/settings.json"
      }
    ]
  },

vs

  "commands": [
  {
    "match": "\\.vscode/settings\\.(.+)\\.json$",
    "cmd": "sed '/^\\s*\\/\\//d' ${workspaceFolder}/.vscode/settings.*.json | sed -z 's/,\\s*\\([]}]\\)/\\1/g' | jq -s 'reduce .[] as $item ({}; . * $item)' > /tmp/settings.json && mv /tmp/settings.json ${workspaceFolder}/.vscode/settings.json"
  }
],

Hi, thank you for trying out the extension! I'll try to fix these issues soon. I can see .shell.json and .python.json didn't make it into the final cut at all? Did it report an error before that happened?

Didn't get any errors whatsoever...

Final working result should be the same output as is produced by run on save with this config:

  "emeraldwalk.runonsave": {
    "commands": [
      {
        "cmd": "sed '/^\\s*\\/\\//d' ${workspaceFolder}/.vscode/settings.*.json | sed -z 's/,\\s*\\([]}]\\)/\\1/g' | jq -sS 'reduce .[] as $item ({}; . * $item)' > /tmp/settings.json && mv /tmp/settings.json ${workspaceFolder}/.vscode/settings.json",
        "match": "\\.vscode/settings\\.(.+)\\.json$"
      }
    ]
  },

Admittedly, my config is much simpler, so i didn't encounter any issues. I'll strip the values out of the files you posted and add them to the test cases.

Here are more test cases
settings.json
settings.core.json
settings.standards.json
settings.ui.json
settings.optimization.json

(settings.json is generated correctly with my script)