Open tarek101 opened 5 months ago
There is a setting "ensure_final_newline_on_save" which adds an empty line to the end of the file on save if there isn't one and defaults to true. I'm pretty sure that is what you are seeing?
NVM this looks more like the autoformatter deciding to split the code for... some reason?
Looks like auto-formatting. You can try to adjust your formatter configuration https://zed.dev/docs/javascript.
My file is c++ (extension .cxx) not javascript and the auto-formatting was not a good experience adding newlines everywhere in a large code file, sometimes unnecessarily breaking code comments into multiple lines with or without adding the comment symbol with each line and overwriting my edits. Even worse, there is no simple way to disable it. As a newbie to Zed, the impression I got is that saving is not a reliable operation and I immediately started to look for other editors. Auto-formatting should be an option disabled by default, even if it makes the code look better, with a simple way to enable/disable it from the settings page and a user should be able to do it for a portion of the code in the right-click menu of a selected code.
"format_on_save": "off"
Seems pretty simple to me. Unless by "simple" you meant a checkbox on a graphical settings page.
Either way, formatting is disabled by default for C and C++ code starting from version 0.132.0.
A new user would naturally use CMD+, to open the settings page, to find only the two options about the font sizes with a comment to open another page to see a full list of options (the comment might not be even read by some users). In the other page, the user finds a ton of other flags, and without asking here, he will have to read every line to reach a flag for auto-formatting, but he/she should know beforehand that such an option exists in the first place! It seems Zed is designed for power users.
"format_on_save": "off"
doesn't solve the issue for html
...
Looks like format_on_save
doesn't fully work. I'm still getting new lines imported (into a Cargo.toml) whenever I save.
Check for existing issues
Describe the bug / provide steps to reproduce it
When I save a file, sometimes newlines are inserted randomly in a line of code such as the one in the video https://github.com/zed-industries/zed/assets/45533264/b0fb1604-49a4-43b8-84d4-12b28a91c086
Environment
MacOS Ventura 13.2.1
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