Skip to content

Add an .editorconfig file

FeRD (Frank Dana) requested to merge ferdnyc/meld:editorconfig into main

This MR adds a basic .editorconfig file to the repo.

Editorconfig enjoys widespread support across IDEs and code editors, with either built-in support or a plugin available for nearly any application that can edit text files. While the set of supported configurations is extensible and varies greatly, with some applications defining vast collections of vendor-specific customizations that can be used only with their software, a certain set of "core parameters" makes up the official set of customizations supported by nearly all tools. Only those rules are in use here.

The rules supplied define basic, universal formatting parameters for common filetypes. (Inspired by commit bfc1b074 that homogenized indentation in the meson build files.) These rules shouldn't change how existing files are edited. The goal is to formalize whatever formatting is already in use in the repo (for the benefit of future editors), not to force any changes.

Not all files are represented by specific rules, and the degree to which configs are applied varies.

  • Meson's scripts/configs, .xml files, and .json files are configured for 2-space indents.
  • .py files are configured for 4-space indents.
  • .page files in /help/, don't have a consistent indentation distance, so they get configured for space indents (no tabs), but indents aren't set to any fixed size.
  • The existing .sh and .po files don't contain any indented lines, so they get no specific config.
  • Some types I likely either missed, or got lazy and didn't bother addressing.

Configuration for more files can, of course, be added at any point in the future.

All files (regardless of type) are configured for:

  • UTF-8 encoding
  • LF line endings (as opposed to Windows CRLF)
  • trailing spaces to be trimmed from lines automatically
  • a final newline to be added at the end of the file if not present

The root = true at the top of the file prevents editors from scanning outside the project when looking for configuration, since by default supporting editors will look for configuration first in the current directory, then each successive parent directory. (Which is why only one config is needed for the entire repo.)

Edited by FeRD (Frank Dana)

Merge request reports