Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Clarify capitalization of .editorconfig file #523

Open
openjck opened this issue Oct 24, 2024 · 14 comments · May be fixed by editorconfig/specification#70
Open

[FEATURE] Clarify capitalization of .editorconfig file #523

openjck opened this issue Oct 24, 2024 · 14 comments · May be fixed by editorconfig/specification#70

Comments

@openjck
Copy link

openjck commented Oct 24, 2024

Which problem does this feature fix?

The EditorConfig website states that:

EditorConfig plugins look for a file named .editorconfig in the directory of the opened file and in every parent directory

However, the site is not clear about whether capitalization matters. Some tools, like Neovim, do not use files named .editorConfig (notice the capital C), but other editors, like VSCode, do use files named .editorConfig.

edit (2025-01-23): As it turns out, it's not the editor that matters, but whether the filesystem is case-sensitive. See this comment.

Describe the solution you'd like

On the EditorConfig website, please clearly document whether capitalization matters in the name of the .editorconfig file.

@cxw42
Copy link
Member

cxw42 commented Oct 26, 2024

I've only seen all-lowercase, myself.

@florianb
Copy link
Member

@cxw42 @openjck - i created a proposal for the spec because the EditorConfig-file might have been created or might be used in conjunction with a file-system thats not case sensitive.

It would make the spec more robust to specify the recognition case insesitive as well.

@xuhdev
Copy link
Member

xuhdev commented Jan 20, 2025

I don't think we've ever recognized capital file names. If a filesystem doesn't recognize letter cases, the processes that open the file with a different case will succeed, but I don't think it is our business here to recognize case insensitive names as it will break a lot of existing plugins.

This seems like a pretty common pattern among cross-platform programs: directories named .git will work on all filesystems, but .GIT only works on those that doesn't recognize cases.

@florianb
Copy link
Member

I understand - i think it is more an issue of a file being created on a insensitive fs and eventually being shared with a case sensitive system.

My experience with cross-platform applications is that people don't anticipate the usage scenario per se and part of my work is to migrate between systems.

As for the example of Git - i am not sure if Git works on every file system (see f.e. this blog post) and for the usage of git, one wouldn't probably migrate the git repo to a case sensitive fs by copying it.

I just thought that especially these cross-system applications would be of a special interest for us due to the nature of EditorConfig.

I also wouldn't say that this is a breaking change. Yes it would eventually require the plugins to pick the change up but it's not like when this happens it changes anything for most of the people - it would be more of a it just works.

But I'm not attached to the change either - I just think it makes sense.

@cxw42
Copy link
Member

cxw42 commented Jan 24, 2025

breaking change

I don't think it's a breaking change in a semver-MAJOR sense. Semver-MINOR is "add functionality in a backward compatible manner", and that's what recognizing any case would do.

On the other hand, how about this? Two devs A and B share a project.

  • A creates .EditorConfig. A has a new enough plugin that this works fine.
  • B does not have a new enough plugin, so the settings in .EditorConfig are not used by B's editor.

That could be confusing at the very least!

@cxw42
Copy link
Member

cxw42 commented Jan 24, 2025

@openjck does VSCode recognize .editorConfig on all platforms, or only on platforms with case-insensitive filesystems? I'm wondering if it's VSCode itself accepting the camel case, or if it's just the OS smashing case before looking up the file.

Also, do you happen to have an example of a project using a casing other than all-lowercase?

Thanks!

@openjck
Copy link
Author

openjck commented Jan 24, 2025

Thanks for the questions.

I only just realized EditorConfig support in vscode comes from an extension that appears to be published by the EditorConfig organization itself. I was wrong to say vscode itself was acting one way or the other. I'm not sure that changes anything, but I wanted to clarify that.

To answer your first question, it does appear that vscode (with the extension) only supports a mixed-case file (e.g., .editorConfig) if vscode is working with a case-insensitive filesystem. I saw vscode support a mixed-case filename on Windows. However, I just confirmed that, here on my Linux machine, vscode does not support/read/use/apply a mixed-case filename.

Here are some public repos I found which use the name .editorConfig. These files won't do any harm if all of the developers are on, say, Windows, but if some developers are on Windows and some are on Linux, those on Linux won't benefit from the .editorConfig file.

https://sourcegraph.com/search?q=context:global%20file:.editorConfig&patternType=keyword&case=yes&sm=0

@openjck
Copy link
Author

openjck commented Jan 24, 2025

For whatever it's worth, one of the largest repos I see which uses the capitalization .editorConfig is RxSwift (link to .editorConfig file), which has 4.2k forks.

@xuhdev
Copy link
Member

xuhdev commented Jan 24, 2025

The mentioned project RxSwift also seems to be working primarily on case-insensitive filesystems.

To my knowledge, none of the existing core libraries specifically cater case-insensitive .editorconfig file names. Frankly, it would be a more difficult task on a case-sensitive filesystem: You can't just open a file with a name any longer, but have to search with regex.

I would suggest we add a clarification in the spec: Case sensitivity is often unspelled in a lot of places assuming case-sensitivity, but it doesn't hurt to be more clear. What do you think?

@openjck
Copy link
Author

openjck commented Jan 24, 2025

You're right about RxSwift primarily being interesting to Mac developers. At the same time, perhaps not all the repos in the original list would only be likely to receive contributions from developers on a single platform. I myself am on a team where we have some developers on Windows and some (like myself) on Linux. Unfortunately, the name .editorConfig is common, and it took me a while to understand why my editor didn't use it. I unfortunately can't link to those repos because they're private.

I'm all for clarity, even if the implementation doesn't change. Anything to help devs recognize that naming the file with mixed case is a bad idea if they want devs on Linux, say, to benefit.

xuhdev added a commit to editorconfig/specification that referenced this issue Jan 24, 2025
This has been generally assumed since we don't specifically mention other
capitalizations. 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. Besides, core libraries
are cumbersome to implement on case-sensitive filesystems, because they always
have to use some regex to search a directory.

Close editorconfig/editorconfig#523
xuhdev added a commit to editorconfig/specification that referenced this issue Jan 24, 2025
This has been generally assumed since we don't specifically mention other
capitalizations. 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. Besides, 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
xuhdev added a commit to editorconfig/specification that referenced this issue Jan 24, 2025
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
xuhdev added a commit to editorconfig/editorconfig.github.com that referenced this issue Jan 24, 2025
@xuhdev
Copy link
Member

xuhdev commented Jan 24, 2025

I've opened PRs:

@openjck I think the reason probably stems from the authors using case-insensitive filesystems themselves. As far as I know, none of them should be working on a case-sensitive filesystem given the current implementation of all core libraries.

I personally had worked cross-platform for a long time and this is a common issue when naming files :/

@florianb
Copy link
Member

I took a look into the proposed change.

In my perspective we're currently facing a situation where the current standard cannot be interpreted unambiguously and we try to make it more clear.

@xuhdev your proposed change would bring us this definition:

(usually named .editorconfig, case-sensitive)

I would like to point out that

  • "usually named" just keeps room for interpretation

  • "case-sensitive" is invalidating at least the current behaviour of the VSCode plugin (and to be nitpicky for all uses of EditorConfig on case insensitive file systems with the default of upper case letters).

I absolutely get your point @xuhdev, but currently we have the situation EditorConfig doesn't work as expected people look into the spec and can't see what's actually wrong. Therefore they can't fix it.

In the future EditorConfig might also not work as expected. But now they can look it up and get it fixed.

xuhdev added a commit to editorconfig/specification that referenced this issue Jan 24, 2025
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
@xuhdev
Copy link
Member

xuhdev commented Jan 24, 2025

@florianb I agree, shouldn't have done it before sleeping time 😄 . Looks like I didn't change the right spot.

I've made changes with additional details.

xuhdev added a commit to editorconfig/specification that referenced this issue Jan 24, 2025
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
xuhdev added a commit to editorconfig/specification that referenced this issue Jan 24, 2025
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
@cxw42
Copy link
Member

cxw42 commented Jan 25, 2025

@openjck Thanks for the additional detail and data!

@xuhdev I'll take a look at those PRs.

xuhdev added a commit to editorconfig/specification that referenced this issue Jan 25, 2025
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
xuhdev added a commit to editorconfig/specification that referenced this issue Jan 25, 2025
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
xuhdev added a commit to editorconfig/specification that referenced this issue Jan 25, 2025
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
xuhdev added a commit to editorconfig/editorconfig.github.com that referenced this issue Jan 25, 2025
xuhdev added a commit to editorconfig/editorconfig.github.com that referenced this issue Jan 25, 2025
xuhdev added a commit to editorconfig/specification that referenced this issue Jan 25, 2025
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants