6 ms·
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
by haspok 2y ago
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?
- praveenperera 2y agowrong for you, right for me everyone on your team should be using a auto-formatter
- nopcode 2y agoEnforcing 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.
- haspok 2y agoNo, 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.
- flexagoon 2y ago> 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.
- p5a0u9l 2y agoEvidently 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.
- nicce 2y agoDepends if there is actually well known standard to format. E.g Go or Rust has very commonly used defaults.
- haspok 2y agoBut 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.
- rcoppolo 2y agoCan you please explain why auto-formatting conflicts with version control/collaboration?
- haspok 2y agoIf 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?
- p5a0u9l 2y agoNot sure it should be default, but auto formatting actually helps reduce git noise.
- ashenke 2y agoYou can change this behaviour if that's really a problem https://zed.dev/docs/configuring-zed?highlight=Format#format-on-save 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)