|
|
|
|
|
by beginnings
663 days ago
|
|
On indentation, most files are going to be autoformatted by the LSP, and there are tab_size settings in the languages section, needing specific file settings seems like an edge case. As for collaboration and AI features, I have no use for them personally, but I think that's their avenue for future monetization, so I can't really complain that they are focussing on that when I get an amazing piece of software for free. |
|
Wow, absolutely not!
Just so we're clear, when I say "per-file" settings, I don't mean in the configuration. I mean at runtime overriding the indentation settings for an open file.
This is needed for many, many cases that I definitely don't consider edge cases.
- Configuration files: Loose configuration files might be in a bespoke format with no language server to begin with. JSON and YAML files can have pretty much any indentation style, and in many cases when editing configuration files there will be no "project-specific" configuration files to read from. I use my editor of choice to edit configuration files in various places including just in my home directory.
- You are not necessarily allowed to fully reformat files in a given project, even if the project has inconsistently-formatted files. Some LSPs are cooperative with this and won't change the indentation, since not all languages have a canonical format. Auto-detection is very important here.
- Even when an LSP is being used, that doesn't mean Zed is synced up with it. The Nix LSP will use whatever nixfmt binary you are using. I'm using nixfmt-rfc-style, which uses 2-space indentation, but the default in Zed seems to be 4-space indentation for Nix files, which means that without configuration it will be out-of-sync. (Generally this would be better to just configure globally but I'm just trying to say that having an LSP in and of itself doing formatting is not a panacea.)
In almost any editor I can think of, from Vim, to Visual Studio Code, to IntelliJ, to Notepad++, to kwrite, to gedit... I can at least override the indentation style if it is wrong for some reason. In Neovim I use vim-sleuth, and my indentation settings in Vim are very rarely incorrect no matter what file I'm editing where.
Modern text editors can and should do better than this, and almost always do; being able to change the current indentation settings is something most editors support before supporting most other basic functions. It's not a weird edge case, it's just flat-out a missing basic feature.