zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
39.9k stars 2.08k forks source link

[Prettier] Configuration tips #13806

Open 0x2CA opened 6 days ago

0x2CA commented 6 days ago

Check for existing issues

Describe the feature

in settings.json no prettier tips.

image image

in .prettierrc no prettier tips. image

If applicable, add mockups / screenshots to help present your vision of the feature

No response

notpeter commented 5 days ago
  1. I believe the behavior for prettier key in Zed settings.json are correct. I think there are only three valid keys there (allowed, parser, plugins) and Zed does not support configuring prettier via global settings like VSCode. (I could be wrong).

  2. I am able to see the same behavior with .prettierrc where Zed does not automatically identify it as TOML/JSON and then inject the correct JSON schema for validation/autocomplete.

As a workaround you can switch to using .pettierrc.json and explicitly define the schema and it works as expected for me.

"$schema": "https://json.schemastore.org/prettierrc.json",
image

According to the prettier docs there are a bunch of different places prettier look for configuration. Zed should consider adding support for validating that jsonschema in the following:

SomeoneToIgnore commented 5 days ago

and Zed does not support configuring prettier via global settings like VSCode. (I could be wrong).

It does support them, prettier as the root key in Zed's settings.json is passed into prettier as its config json (same as package.json would contain).

So in theory we could add a json schema similar to what https://github.com/zed-industries/zed/pull/12792 did, but I have no idea how volatile prettier schema is from version to version.