Do not overwrite a custom items in VSCode's "extensions.json" // Resolve #3374

This commit is contained in:
Ivan Kravets committed 2020-02-08 21:36:32 +02:00
1 parent 96f60aab66
commit 86f2dde6f3
2 files changed
+23 -6

No files matched your search

+21 -6
View File
@@ -1,7 +1,22 @@
% import json
% import os
% import re
%
% recommendations = set(["platformio.platformio-ide"])
% previous_json = os.path.join(project_dir, ".vscode", "extensions.json")
% if os.path.isfile(previous_json):
% with open(previous_json) as fp:
% contents = re.sub(r"^\s*//.*$", "", fp.read(), flags=re.M).strip()
% if contents:
% recommendations |= set(json.loads(contents).get("recommendations", []))
% end
% end
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"platformio.platformio-ide"
]
}
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
% for i, item in enumerate(sorted(recommendations)):
"{{ item }}"{{ ("," if (i + 1) < len(recommendations) else "") }}
% end
]
}