Skip to content

Conversation

@virzak
Copy link
Contributor

@virzak virzak commented Aug 16, 2020

Description:

Add styler option end-of-line ( lf | crlf ) to force specific line endings

xstyler -p -r -d WPF -l Minimal --end-of-line lf

Partially fixes #285

Checklist:

  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have tested my changes by running the extension in VS2017
  • I have tested my changes by running the extension in VS2019
  • If changes to the documentation are needed, I have noted this in the description above

@Jay-o-Way
Copy link

What's keeping this?

Copy link
Contributor

@grochocki grochocki left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution! I am suggesting a slightly different approach that follows a pattern more similar to how we handle IndentSize that I would be interested in your feedback on.

[Category("Misc")]
[RefreshProperties(RefreshProperties.All)]
[Description("Defines end of line character. Specify 'lf' or 'crlf'; otherwise, default character of the host will be used.")]
[JsonProperty("EndOfLine", DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
Copy link
Contributor

Choose a reason for hiding this comment

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

For consistency with Visual Studio, can we call this "LineEndings"?

[Description("Defines end of line character. Specify 'lf' or 'crlf'; otherwise, default character of the host will be used.")]
[JsonProperty("EndOfLine", DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
[DefaultValue("")]
public string EndOfLine
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of exposing this setting in the UI at all, I am wondering if this setting should follow the pattern of UseVisualStudioIndentSize/IndentSize (i.e., do not expose in settings UI, but still allow IDE to be overwritten in config file)?

Though, in this case, we wouldn't need UseVisualStudioLineEndings because we don't need to look it up from the XAML editor properties. Instead, if LineEndings is unset in a configuration file, NewLine is set to Environment.NewLine (current behavior), but then it could be overwritten. Instead of accepting a string, follow pattern of options like AttributeIndentationStyle and create an enum with: CRLF, LF, CR.

@virzak
Copy link
Contributor Author

virzak commented Jan 26, 2024

@grochocki, all issues are resolved apart from end-of-line vs line-ending. I'm cool with whatever you decide. Do you have a suggestion on automated testing for this PR?

@virzak
Copy link
Contributor Author

virzak commented Apr 12, 2024

@grochocki would it be possible to merge this soon?

@Sergio0694
Copy link

I'm also very interested in this. Is any help needed? @grochocki are there any blockers? 🙂

@virzak
Copy link
Contributor Author

virzak commented Jan 30, 2025

@grochocki , it's almost been 5 years. We can't make use of your tool without being forced into crlf for Windows. Could you please merge this?

@xiyaowong
Copy link

Very useful option. May I ask what is preventing this PR from being merged?

@virzak
Copy link
Contributor Author

virzak commented Jul 11, 2025

Man, just merge it :)

@virzak
Copy link
Contributor Author

virzak commented Aug 19, 2025

Happy belated birthday to this PR

image

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.

Provide Line Ending option

5 participants