sindresorhus / atom-editorconfig

Helps developers maintain consistent coding styles between different editors
https://atom.io/packages/editorconfig
MIT License
812 stars 80 forks source link

Syntax #211

Closed ghost closed 6 years ago

ghost commented 6 years ago

I am currently in the process creating a PR to add a syntax property as per https://github.com/editorconfig/editorconfig/issues/190

The idea is that a comma delimited string can be set to allow for the different language identifiers in different editors.

syntax = cpp14,cpp

The reasons for using a comma separated list are firstly, so there is a fallback if a syntax type cannot be found, and secondly for when syntax identifiers are different in different editors.

A good use case for this is C/C++ header files. When using .h for both, editors will decide the syntax based on the order of loaded plugins. If I have a plugin that associated .h files with C++14, then any C header file will have the wrong syntax set. I accept that I could use .hpp for C++ headers but not everyone is doing this, so the problem still exists. I can also set file associations in the editor settings, but this is tedious to change when switching projects.

One issue I have encountered, is that when you specify a language for [*], this will also change the .editorconfig syntax. Should I explicitly stop .editorconfig syntax from being modified or just accept that this would be expected behaviour based on the globbing pattern?

florianb commented 6 years ago

There must exist an EditorConfig-rule before this can be implemented. I personally guess there is a lot to think about, since this would intercept the os-based file-extension handling. It would also need a standardized file format-list for the Editor-Config standard.

I will close this issue for now, since there is no immediate action we can take in this repository. And as you already found out, you should try to propose a rule in the EditorConfig-Repository: https://github.com/editorconfig/editorconfig/issues/190

ghost commented 6 years ago

Thanks and understood.

I've jumped in at the deep end based on personal need, without thinking of the bureaucracy involved.

florianb commented 6 years ago

Now worries - i am sorry there's so much to think about.

florianb commented 6 years ago

But i'm happy you took some action. 😄