Skip to content

Commit ff915a4

Browse files
committed
Clarify the case sensitivity of .editorconfig file
This has been generally assumed since we don't specifically mention other capitalizations, and core libraries have also assumed so. However, some communities seem to have used capital letters in some places, and it's best if we can clarify. If we go the other route, as a standard, the current core libraries would break because they don't work consistently with each other. Additionally, core libraries are cumbersome to implement on case-sensitive filesystems, because they always have to use some regex to search the `.editorconfig` file in a directory, instead of just pointing to the file named `.editorconfig`. Close editorconfig/editorconfig#523
1 parent 21749e9 commit ff915a4

File tree

1 file changed

+25
-9
lines changed

1 file changed

+25
-9
lines changed

index.rst

+25-9
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ Terminology
5151

5252
In EditorConfig:
5353

54-
- "EditorConfig files" (usually named ``.editorconfig``) include section(s)
55-
storing key-value pairs. EditorConfig files must conform to
56-
this specification.
54+
- "EditorConfig files" (named ``.editorconfig`` in lowercase) include
55+
section(s) storing key-value pairs. EditorConfig files must conform to this
56+
specification.
5757
- "Cores" parse files conforming to this specification, and provide
5858
key-value pairs to plugins.
5959
- "Plugins" receive key-value pairs from cores and update an editor's
@@ -185,7 +185,7 @@ If the glob contains a path separator (a ``/`` not inside square brackets), then
185185
to the directory level of the particular `.editorconfig` file itself.
186186
Otherwise the pattern may also match at any level below the `.editorconfig`
187187
level. For example, ``*.c`` matches any file that ends with ``.c`` in the
188-
directory of ``.editorconfig`` or any other directory below one that stores this ``.editorconfig``.
188+
directory of ``.editorconfig`` or any other directory below one that stores this ``.editorconfig``.
189189
However, the glob ``subdir/*.c`` only matches files that end
190190
with ``.c`` in the ``subdir`` directory in the directory of ``.editorconfig``.
191191

@@ -202,18 +202,34 @@ File Processing
202202

203203
When a filename is given to EditorConfig a search is performed in the
204204
directory of the given file and all parent directories for an EditorConfig
205-
file (named ".editorconfig" by default). Non-existing directories are treated
206-
as if they exist and are empty. All found EditorConfig files are
207-
searched for sections with section names matching the given filename. The
208-
search shall stop if an EditorConfig file is found with the ``root``
209-
key set to ``true`` in the preamble or when reaching the root
205+
file. An EditorConfig file is named ".editorconfig", all lowercased.
206+
Non-existing directories are treated as if they exist and are empty. All found
207+
EditorConfig files are searched for sections with section names matching the
208+
given filename. The search shall stop if an EditorConfig file is found with
209+
the ``root`` key set to ``true`` in the preamble or when reaching the root
210210
filesystem directory.
211211

212212
Files are read top to bottom and the most recent rules found take
213213
precedence. If multiple EditorConfig files have matching sections, the rules
214214
from the closer EditorConfig file are read last, so pairs in closer
215215
files take precedence.
216216

217+
Capitalization of the File Name
218+
-------------------------------
219+
220+
As noted above, the ``.editorconfig`` filename should be lowercased. On some
221+
platforms, opening a file with a different capitalization results in opening
222+
the same file with lowercased file names. This is common with a
223+
case-insensitive filesystem. For example, a file named ``.editorConfig``
224+
exists in the filesystem, but opening a file named ``.editorconfig`` via a
225+
file-opening API still opens the differently capitalized ``.editorConfig``
226+
file.
227+
228+
On such a platform, a Core may choose to treat the file with a different
229+
capitalization as if it were all lowercased. This is to prevent the need of
230+
the additional operation of specifically retrieving the filename, which is
231+
relatively expensive in the context of EditorConfig.
232+
217233
.. _supported-pairs:
218234

219235
Supported Pairs

0 commit comments

Comments
 (0)