Bug 1865492 - Enable Prettier with VS Code for more JSON files r=nalexander

VS Code detects most files as jsonc (JSON with Comments) by default.

Differential Revision: https://phabricator.services.mozilla.com/D193994
This commit is contained in:
Mathew Hodson 2023-11-24 16:54:59 +00:00
Родитель dd03a7aa0c
Коммит 6e2245fceb
1 изменённых файлов: 9 добавлений и 12 удалений

Просмотреть файл

@ -161,7 +161,7 @@ def setup_vscode(command_context, interactive):
},
# Note, the top-level editor settings are left as default to allow the
# user's defaults (if any) to take effect.
"[javascript][javascriptreact][typescript][typescriptreact][json][html]": {
"[javascript][javascriptreact][typescript][typescriptreact][json][jsonc][html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": True,
},
@ -206,17 +206,14 @@ def setup_vscode(command_context, interactive):
# If we've got an old section with the formatting configuration, remove it
# so that we effectively "upgrade" the user to include json from the new
# settings. The user is presented with the diffs so should spot any issues.
if "[javascript][javascriptreact][typescript][typescriptreact]" in old_settings:
old_settings.pop(
"[javascript][javascriptreact][typescript][typescriptreact]"
)
if (
"[javascript][javascriptreact][typescript][typescriptreact][json]"
in old_settings
):
old_settings.pop(
"[javascript][javascriptreact][typescript][typescriptreact][json]"
)
deprecated = [
"[javascript][javascriptreact][typescript][typescriptreact]",
"[javascript][javascriptreact][typescript][typescriptreact][json]",
"[javascript][javascriptreact][typescript][typescriptreact][json][html]",
]
for entry in deprecated:
if entry in old_settings:
old_settings.pop(entry)
settings = {**old_settings, **new_settings}