zed icon indicating copy to clipboard operation
zed copied to clipboard

Zed's formatting, assumed to be Prettier, doesn't respect ignore patterns

Open silvenon opened this issue 9 months ago • 0 comments

Check for existing issues

  • [X] Completed

Describe the bug / provide steps to reproduce it

Here is a minimal repro: https://github.com/silvenon/repro/tree/zed-prettier-ignroe

It has a local Zed config that enables formatting everywhere. The documentation leads me to believe that Prettier should be added as a separate formatting command, but based on the source code it's my understanding that Zed is using Prettier.

The linked example shows an ignored package.json via .prettierignore which Zed formats anyway. package.json shouldn't be formatted because package managers format it differently, so that's why I often like to ignore it in Prettier's ignore file.

What I previously did is something like this:

"format_on_save": {
  "external": {
    "command": "npx",
    "arguments": [
      "prettier",
      "--ignore-unknown",
      "--stdin-filepath",
      "{buffer_path}"
    ]
  }
}

which worked, but it would be nice if I can use Zed's own Prettier integration.

Environment

Zed: v0.132.3 (Zed) OS: macOS 14.4.1 Memory: 16 GiB Architecture: aarch64

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

No response

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

No response

silvenon avatar Apr 28 '24 00:04 silvenon