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

Remove the description of inline comments at all #31

Merged
merged 4 commits into from
Oct 30, 2022
Merged

Conversation

florianb
Copy link
Member

It looks like the current wording still leads to too much confusion: #29 (comment)

I therefore propose to remove the explaining addition about inline comments at all, in favor of a description of the former behavior of EditorConfig parsers.

It looks like the current wording still leads to too much confusion: #29 (comment)

I therefore propose to remove the explaining addition about inline comments at all, in favor of a description of the former behavior of EditorConfig parsers.
@florianb
Copy link
Member Author

florianb commented May 20, 2022

Dear @xuhdev, it seems like the issue is just not solved yet so i would say we remove the inline comments entirely for clarification. Is this something we should propose a dedicated vote for (i don't think so)?

@florianb
Copy link
Member Author

I don't know if this requires a version bump. It looks like but in my opinion the change "just" makes undefined behavior to defined behavior. And elements like escaping a) weren't defined and b) were handled differently by the implemented INI-parsers.

index.rst Outdated Show resolved Hide resolved
index.rst Outdated
Comment on lines 100 to 103
The EditorConfig file format formerly allowed the use of `;` and `#` after the
beginning of the line to mark the rest of a line as comment. This led to
confusion how to parse values containing those characters. Old EditorConfig
parsers may still allow inline comments.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The leading whitespace would probably mess up the formatting...

Technically we didn't formerly "allowed" inline comment, but we have left them undefined. So the best wording might be "formerly left the use of ; and # after the beginning of the line to mark the rest of a line as comment undefined"?

@cxw42
Copy link
Member

cxw42 commented Jul 11, 2022

Sorry for jumping in late! Based on the current tests, it looks like the situation is a bit of a mess :( . I think the current text should stay (i.e., I recommend not merging this PR). Per editorconfig/editorconfig-vote#6, values that look like inline comments are expressly undefined. I think it would be better for people to know it's undefined than to incorrectly assume that, because whole-line comments work, inline comments also work.

@florianb
Copy link
Member Author

florianb commented Aug 9, 2022

No worries @cxw42 - i wish i would see a way to act immediately (and see how that time could be used in a productive way to bring EC forward).

The whole attempt is pinning down a parsing issue in the dotnet roslyn compiler: dotnet/roslyn#44596 (comment)

And while i agreed to the voting in 2019 i changed my mind in general. I think we should move forward and make the init file format and EditorConfig explicit. This said i'd love to see a spec going forward creating the demand for all implementers to align to the spec eventually. This wouldn't require immediate action but for everyone having to implement EC or fixing bugs it would be possible to do it in a explicit and defined way.

@xuhdev
Copy link
Member

xuhdev commented Aug 10, 2022

I also tend to agree now we better explicit state that inline comments are not supported. Often people simply assume their implementation's choice of the "undefined" behavior. This issue may entrench as time goes by (maybe already too late).

@cxw42
Copy link
Member

cxw42 commented Sep 6, 2022

I agree with explicitly removing support for inline comments. Would that require a vote? As far as I can tell, editorconfig/editorconfig-vote#6 still controls.

Some possible text:

A ; or # anywhere other than at the beginning of a line [or after /^\s*/?] does not start a comment, but is part of the text of that line. E.g.,

[*.txt]
foo = editorconfig ;)

gives variable foo the value editorconfig ;) in *.txt files, not the value editorconfig.

@florianb
Copy link
Member Author

florianb commented Sep 6, 2022

I don't think so since "backslash/semicolon/octothorpe escaping" would still be "undefined" (as its not mentioned at all).

I am fine with that proposal - i am not sure if it satifies the requirements of the Roslyn team. But i feel like it's something where i have to build some knowledge about writing technical specifications in english. 😬

@xuhdev
Copy link
Member

xuhdev commented Sep 10, 2022

I agree with the proposed text. Actually, not defining escaping would become natural because it's no longer needed.

@cxw42
Copy link
Member

cxw42 commented Sep 22, 2022

@xuhdev

I agree

Thanks :) . Do we need a formal vote to modify editorconfig/editorconfig-vote#6 ?

@xuhdev
Copy link
Member

xuhdev commented Sep 23, 2022

Maybe we can avoid modifying editorconfig/editorconfig-vote#6 by appending the text:

Naturally, backslash/semicolon/octothorpe escaping is undefined.

@cxw42
Copy link
Member

cxw42 commented Oct 3, 2022

Revised proposed text:

A ; or # anywhere other than at the beginning of a line does not start a comment, but is part of the text of that line. E.g.,

[*.txt]
foo = editorconfig ;)

gives variable foo the value editorconfig ;) in *.txt files, not the value editorconfig.

This specification does not define any "escaping" mechanism for ; or # characters.

Edit I asked in the roslyn issue if the above would meet their needs.

@florianb
Copy link
Member Author

florianb commented Oct 6, 2022

Awesome @cxw42 - thank you so much!

@xuhdev
Copy link
Member

xuhdev commented Oct 6, 2022

Sounds good to me!

@xuhdev
Copy link
Member

xuhdev commented Oct 6, 2022

gives variable foo the value editorconfig ;) in *.txt files, not the value editorconfig.

Are you sure this is true? I thought this remains undefined. The reason is that some implementation has already seen it as comment and we don't have the need to force them to change for now.

@cxw42
Copy link
Member

cxw42 commented Oct 8, 2022

@xuhdev I am proposing that we define it now in the specification, since it's currently implementation-defined. The tests used to include semicolons in the value - https://github.com/editorconfig/editorconfig-core-test/blob/70840cfaf6a06766ab61e975b8a1fe3b891ee08e/parser/comments.in#L14-L16 . I think Roslyn's use case shows that we need to standardize, or else lose cross-core compatibility of values that include # or ; .

Please let me know if I misunderstood your question!

Separately, the proposed language got some upvotes and no downvotes in the Roslyn issue.

@xuhdev
Copy link
Member

xuhdev commented Oct 8, 2022

Sorry I lost the context over time. Yes, your proposed text makes sense to me. Thanks for organizing them into well-written text!

@xuhdev
Copy link
Member

xuhdev commented Oct 8, 2022

Do you wanna make another PR for the proposed text?

@florianb
Copy link
Member Author

Let's just change the attached source of this PR - should i do this?

@xuhdev
Copy link
Member

xuhdev commented Oct 14, 2022

Absolutely, I have no problem with that

@cxw42
Copy link
Member

cxw42 commented Oct 22, 2022

@florianb fine with me - thanks!

@florianb
Copy link
Member Author

👍 thanks a lot, i am on vacation for two weeks. I'll add it after that. If someone wants to take this over to speed it up - please feel free. ☺️

cxw42 added a commit that referenced this pull request Oct 29, 2022
- Clarify that inline comments are _not_ supported.  See
  <#31 (comment)>
- Bump the specification to 0.15.0 as a warning, since this change will
  break cores that have been supporting inline comments.
@cxw42
Copy link
Member

cxw42 commented Oct 29, 2022

@florianb @xuhdev I have taken the liberty of updating this PR to:

  • Implement the changes discussed above; and
  • Bump the version from 0.14.0 to 0.15.0.

I added new commits rather than removing the existing ones, for ease of comparison. The new commits are 645214f and 69ac8ff. Let me know what you think!

If this change is approved, we will need to add back in the core tests we previously removed. That is why I thought it would be good to bump the minor version, as a sign that cores may need to change.

index.rst Outdated Show resolved Hide resolved
Copy link
Member

@xuhdev xuhdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All else LTGM! Thanks for picking this up!

- Clarify that inline comments are _not_ supported.  See
  <#31 (comment)>
- Bump the specification to 0.15.0 as a warning, since this change will
  break cores that have been supporting inline comments.
@cxw42
Copy link
Member

cxw42 commented Oct 29, 2022

@xuhdev would you please merge? I am not sure whether you want to squash. Thanks!

@cxw42 cxw42 linked an issue Oct 29, 2022 that may be closed by this pull request
cxw42 added a commit to cxw42/editorconfig-core-test that referenced this pull request Oct 30, 2022
cxw42 added a commit to cxw42/editorconfig-core-test that referenced this pull request Oct 30, 2022
- Hash in value is part of the value, not a comment
- Backslashes before hashes or semicolons are part of the value as well,
  not an escaping mechanism.

editorconfig/specification#31 (comment)
cxw42 added a commit to cxw42/editorconfig-core-test that referenced this pull request Oct 30, 2022
- Hash in value is part of the value, not a comment
- Backslashes before hashes or semicolons are part of the value as well,
  not an escaping mechanism.

editorconfig/specification#31 (comment)
@cxw42
Copy link
Member

cxw42 commented Oct 30, 2022

I have WIP editorconfig-core-test updates at https://github.com/cxw42/editorconfig-core-c/tree/no-inline-comments

cxw42 added a commit to cxw42/editorconfig-core-test that referenced this pull request Oct 30, 2022
- Hash in value is part of the value, not a comment
- Backslashes before hashes or semicolons are part of the value as well,
  not an escaping mechanism.

editorconfig/specification#31 (comment)
cxw42 added a commit to cxw42/editorconfig-core-test that referenced this pull request Oct 30, 2022
- Hash in value is part of the value, not a comment
- Backslashes before hashes or semicolons are part of the value as well,
  not an escaping mechanism.
- This supersedes the change made in editorconfig#33.

editorconfig/specification#31 (comment)
@xuhdev xuhdev merged commit 287517a into master Oct 30, 2022
@xuhdev xuhdev deleted the florianb-patch-1 branch October 30, 2022 19:40
@cxw42
Copy link
Member

cxw42 commented Oct 30, 2022

@xuhdev Thanks! I'll let roslyn know. I will be opening PRs shortly for the core-test and editorconfig-core-c changes :) .

@cxw42
Copy link
Member

cxw42 commented Oct 30, 2022

And @florianb --- thanks again for opening this PR and for your flexibility! 👍

cxw42 added a commit to cxw42/editorconfig-core-test that referenced this pull request Oct 30, 2022
This implements the specification changes made by
<editorconfig/specification#31>.

- A hash or semicolon in a value is part of the value, not the beginning
  of a comment.
- Backslashes before hashes or semicolons are part of the value as well,
  not an escaping mechanism.
- This supersedes the change made in editorconfig#33.
@florianb
Copy link
Member Author

I have to thank you @cxw42 for pushing this forward during my absence! You are absolutely welcome!

@cxw42
Copy link
Member

cxw42 commented Oct 30, 2022

xuhdev pushed a commit to editorconfig/editorconfig-core-test that referenced this pull request Oct 31, 2022
This implements the specification changes made by
<editorconfig/specification#31>.

- A hash or semicolon in a value is part of the value, not the beginning
  of a comment.
- Backslashes before hashes or semicolons are part of the value as well,
  not an escaping mechanism.
- This supersedes the change made in #33.
craigbarnes added a commit to craigbarnes/dte that referenced this pull request May 31, 2023
The EditorConfig specification now explicitly states that comments
can only start at the beginning of a line and that "inline comments"
are no longer recognized as such.

See also:

* editorconfig/specification#31
* https://github.com/editorconfig/specification/pull/31/files#diff-54a294a5d016e1a8e98bc95668ed84a99a9edd5c10394d9a2b1ee848006e98a7R91
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clarify behavior of ; and # within values
3 participants