-
Notifications
You must be signed in to change notification settings - Fork 26
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
Clarify behavior of formatting (non-"root") properties at top level #8
Comments
I agree with updating the spec to clarify the current behaviour. I agree that implicit |
To be clear, the EditorConfig INI parser allows you to specify any/all custom properties that you want. Some people actually use this for their own custom implementations outside of EditorConfig. That said, I also very much agree that we need more clarification and less ambiguity about these things and I'm actively working on that very goal during my international travels. I hope at least we can make one step forward on this. |
It doesn't sound right to me to put any other settings on root. Do we have statistics on what we do right now? |
@xuhdev for the purposes of EditorConfig, you're right. That's all we would ever need or support. But for anyone outside of EditorConfig who is perhps using the config inheritance feature of EditorConfig, there's nothing stopping them from defining custom properties at the root level. This is another reason why I think it's important to distinguish between:
These are all very different things and I can see non-EditorConfig implementations that rely upon 1 & 3, but not 2. |
I think whether an assignment not under any section is a matter of syntactic definition. If we allow any anything other than Currently, as far as I see, the C core does not output anything not in any sections. |
You're right. It doesn't look like the js core does either. root = true
foo = bar
[*]
qux = corge The output was just I think the INI parser should definitely record those properties at root though. Whether we do anything with them is another story. |
I'm not sure whether there's any benefit to break with the existing behavior and output properties at root. I'm personally leaning toward clarifying this existing behavior rather than altering it. |
To be clear, I'm not suggesting we output, change or break anything with respect to the existing EditorConfig implementation. I'm saying that the INI parsing aspect of EditorConfig can be decoupled into a separate parser that knows nothing about EditorConfig's rules and especially nothing about As it doesn't know anything about The point is, we can keep the INI parsing as agnostic to implementation as possible and put EditorConfig-specific "business logic" into the cores instead of the INI parser itself. |
OK, sounds good to me. |
Now to answer the OP, I think we should stick with what he said:
And don't do any of the default |
Fixes editorconfig#8 Fixes editorconfig#2
Currently there is no mention of what these things should do in neither the simplified nor the formal version of the spec. The example files in official libraries seems to generally avoid doing so, and WebStorm seems to agree that they are in general invalid.
If the current behavior is intended to be kept, I recommend adding this to the spec:
This, however, can feel counterintuitive to some. It could be more intuitive to do this (at a cost of changing quite a few libraries; we will need a versioning scheme for that):
The example should probably be changed to illustrate the precedence behavior too. Maybe define a indent under
[*]
and overwriting it for js will help show the point.The text was updated successfully, but these errors were encountered: