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
42.12k stars 2.21k forks source link

Formatting fails silently when Prettier cannot be found #11987

Open paulzzy opened 2 months ago

paulzzy commented 2 months ago

Check for existing issues

Describe the bug / provide steps to reproduce it

I noticed that my HTML file wasn't being formatted on save. Zed didn't show any errors (e.g. Project Diagnostics said "No problems in workspace"). It was only when I checked the logs with the zed: open log command that I found the following line and realized I had forgotten to npm install:

2024-05-17T10:36:19-07:00 [ERROR] Failed to determine prettier path for buffer: No prettier found in node_modules for ancestors of "/path/to/project/index.html", but discovered prettier package.json dependency in "/path/to/project"

It would be helpful to show an error somewhere when formatting fails (or linting, looks like this affects ESLint too).

Environment

Zed: v0.135.2 (Zed) OS: macOS 14.4.1 Memory: 8 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

paulzzy commented 1 month ago

When Prettier formatting fails (e.g. because of a parse error) a helpful message is shown in the taskbar at the bottom. I might've missed a similar message for my issue (where Prettier wasn't even installed), but I don't recall seeing it.

image