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
50.51k stars 3.13k forks source link

[Prettier] Configuration tips #13806

Open 0x2CA opened 4 months ago

0x2CA commented 4 months 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 4 months 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 4 months 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.