Unix line-endings for extensions.json (#4153)

This commit is contained in:
Scott Lahteine
2022-01-09 05:58:39 -06:00
committed by GitHub
parent fc907c568d
commit 7256102785

View File

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