Skip to content

Commit d9f42e2

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 d9f42e2

1 file changed

Lines changed: 20 additions & 6 deletions

File tree

index.rst

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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,32 @@ 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+
The ``.editorconfig`` filename should be lowercased. On some platforms,
221+
opening a file with a different capitalization results in opening the same
222+
file with lowercased file names. This is common with a case-insensitive
223+
filesystem. For example, a file named ``.editorConfig`` exists in the
224+
filesystem, but opening a file named ``.editorconfig`` via a file-opening API
225+
still opens the differently capitalized ``.editorConfig`` file.
226+
227+
On such a platform, a Core may choose to treat the file with a different
228+
capitalization as if it were all lowercased. This is to prevent the need of
229+
retrieving the file name after opening it.
230+
217231
.. _supported-pairs:
218232

219233
Supported Pairs

0 commit comments

Comments
 (0)