News for hackers. Stuff that matters.
Re:Zed on Linux Is Here by haspok on Thursday July 11, 2024 @08:44AM (#40936097)
I downloaded ZED for a quick play-around, but was quite shocked to find out that editing and saving a file runs an auto-formatter on it _by default_...

Whoever thought that was a great idea obviously has never worked with version control, with other people on a project? Sorry, but this is such an obviously wrong default setting, I'm surprised nobody pointed this out before?

Re:Zed on Linux Is Here by nopcode on Thursday July 11, 2024 @08:54AM (#40936197)
Enforcing auto-formatting is a common practice in my experience. Currently working on a project where the repo will refuse commits that are not following the repo-specific formatting settings.

I think it is a sane default in 2024.

Re:Zed on Linux Is Here by haspok on Thursday July 11, 2024 @09:24AM (#40936531)
No, it isn't. And anyway, I downloaded a generic text editor which has no idea of what autoformatting settings are applicable to my repos (maybe it differs per repo?), yet is trying to autoformat anyway? For example, it decided to replace ' characters in a YAML file with ". WTF? The _default_ setting should be to save as-is.
Re:Zed on Linux Is Here by p5a0u9l on Thursday July 11, 2024 @11:49AM (#40937940)
Evidently this is all very new to you, sounding slightly histrionic.

The zed complaint is purely about it be auto enabled. For each language there is usually a standard and at least one tool. Most people want formatting and can’t stands code bases where sometimes it’s a single quote, sometimes a double quote.

Re:Zed on Linux Is Here by flexagoon on Monday July 15, 2024 @01:47PM (#40969951)
> maybe it differs per repo

Then you'll already have a formatter config file in the root of your repo, and the formatter that Zed runs will use those settings.

Re:Zed on Linux Is Here by p5a0u9l on Thursday July 11, 2024 @11:44AM (#40937901)
Not sure it should be default, but auto formatting actually helps reduce git noise.
Re:Zed on Linux Is Here by nicce on Thursday July 11, 2024 @08:58AM (#40936232)
Depends if there is actually well known standard to format. E.g Go or Rust has very commonly used defaults.
Re:Zed on Linux Is Here by haspok on Thursday July 11, 2024 @09:20AM (#40936477)
But this is the _default_ setting. If you want autoformat on save, that's perfectly fine. Just do not make it default. I can't think of any other editor that does this.
Re:Zed on Linux Is Here by rcoppolo on Thursday July 11, 2024 @08:59AM (#40936238)
Can you please explain why auto-formatting conflicts with version control/collaboration?
Re:Zed on Linux Is Here by haspok on Thursday July 11, 2024 @09:19AM (#40936469)
If I have to change one character, but the autoformatter reformats the whole file instead... that is a problem. My actual change will be lost in the formatting changes. And who says that I want to reformat anyway?

EDIT: I usually work on projects with a long history. File endings, tab/spaces, etc. are usually all over the place, and we haven't touched actual code yet. I usually have no authority and time to fix formatting issues, especially in "miscellaneous" files like yaml. And the PRs in most places I'd worked at are rejected if they contain something other than what is relevant to the topic of the PR. And then there is the issue of the hidden change, when you reformat a 1000 line long file, and also make an actual change - this will be very easy to overlook.

And finally, I might be using another tool for 99% of the editing (I use IDEA), yet sometimes I just want to edit a file quickly, outside this tool. So I do have an autoformatting setup in IDEA, should that mean that I can't use another editor for quick changes?

Re:Zed on Linux Is Here by praveenperera on Thursday July 11, 2024 @08:53AM (#40936178)
wrong for you, right for me

everyone on your team should be using a auto-formatter

Re:Zed on Linux Is Here by ashenke on Thursday July 11, 2024 @12:45PM (#40938415)
You can change this behaviour if that's really a problem https://zed.dev/docs/configuring-zed?highlight=Format#format...

Or there's a "save without format" command that I used once (when working on a pywal template for a zed theme, that is not valid json but Zed really wanted to format it)