Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format default settings.json with Prettier #8500

Merged
merged 1 commit into from
Feb 27, 2024

Conversation

maxdeviant
Copy link
Member

This PR formats the default settings.json file with Prettier.

This should help avoid unnecessary modifications in other PRs making consequential changes to this file.

Release Notes:

  • N/A

@maxdeviant maxdeviant self-assigned this Feb 27, 2024
@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Feb 27, 2024
@maxdeviant maxdeviant merged commit f93272e into main Feb 27, 2024
8 checks passed
@maxdeviant maxdeviant deleted the marshall/format-default-settings-file branch February 27, 2024 19:14
@SomeoneToIgnore
Copy link
Contributor

When I try to open the file in Zed and save it, it gets 2->4 whitespaces replaced.
So I wonder if we have to pin tab_size of both yaml and json files the way we do for Markdown now?

"tab_size": 2,

Maybe even go more paranoid and define 4 for *.rs files there?

@maxdeviant
Copy link
Member Author

When I try to open the file in Zed and save it, it gets 2->4 whitespaces replaced. So I wonder if we have to pin tab_size of both yaml and json files the way we do for Markdown now?

"tab_size": 2,

Maybe even go more paranoid and define 4 for *.rs files there?

Yea, I think we should set a tab size of 2 for JSON and YAML files, since it seems to vary somehow.

SomeoneToIgnore added a commit that referenced this pull request Feb 27, 2024
Follow-up of
#8500 (comment)

Now things are much better, but I still reformat the default.json
settings file:

```diff
diff --git a/assets/settings/default.json b/assets/settings/default.json
index c60c53026..67bf4505b 100644
--- a/assets/settings/default.json
+++ b/assets/settings/default.json
@@ -75,14 +75,7 @@
   // Hide the values of in variables from visual display in private files
   "redact_private_values": false,
   // Globs to match against file paths to determine if a file is private.
-  "private_files": [
-    "**/.env*",
-    "**/*.pem",
-    "**/*.key",
-    "**/*.cert",
-    "**/*.crt",
-    "**/secrets.yml"
-  ],
+  "private_files": ["**/.env*", "**/*.pem", "**/*.key", "**/*.cert", "**/*.crt", "**/secrets.yml"],
   // Whether to use additional LSP queries to format (and amend) the code after
   // every "trigger" symbol input, defined by LSP server capabilities.
   "use_on_type_format": true,
```

For me, Zed's doing that with the default prettier:
```
['/Users/someonetoignore/work/zed/zed/assets/settings/default.json' with options: {"printWidth":120,"tabWidth":2,"parser":"json","plugins":[],"path":"/Users/someonetoignore/work/zed/zed/assets/settings/default.json"}](stderr: Resolved config: {}, will format file '/Users/someonetoignore/work/zed/zed/assets/settings/default.json' with options: {"printWidth":120,"tabWidth":2,"parser":"json","plugins":[],"path":"/Users/someonetoignore/work/zed/zed/assets/settings/default.json"})
```

and `!/Library/Application Support/Zed/prettier/package-lock.json`
states that I have
```
    "node_modules/prettier": {
      "version": "3.2.5",
      "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz",
      "integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==",
      "bin": {
        "prettier": "bin/prettier.cjs"
      },
      "engines": {
        "node": ">=14"
      },
      "funding": {
        "url": "https://github.com/prettier/prettier?sponsor=1"
      }
    },
```

Release Notes:

- N/A
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants