Skip to content

Create EndOfLine option - #295

Open
virzak wants to merge 5 commits into
Xavalon:masterfrom
virzak:eol
Open

virzak wants to merge 5 commits into
Xavalon:masterfrom
virzak:eol

Conversation

@virzak

@virzak virzak commented Aug 16, 2020 •

Copy link
Copy Markdown
Contributor

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
Copy Markdown

What's keeping this?

@grochocki grochocki left a comment

Copy link
Copy Markdown
Contributor

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.

Comment thread src/XamlStyler/DocumentProcessors/CDATADocumentProcessor.cs Outdated
Comment thread src/XamlStyler/Options/IStylerOptions.cs Outdated
Comment thread src/XamlStyler.Console/Options.cs
Comment thread src/XamlStyler/Options/StylerOptions.cs Outdated
[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
Copy Markdown
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"?

Comment thread src/XamlStyler/Options/StylerOptions.cs
Comment thread src/XamlStyler/Options/StylerOptions.cs Outdated
Comment thread src/XamlStyler/Options/StylerOptions.cs Outdated
[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
Copy Markdown
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

virzak commented Jan 26, 2024

Copy link
Copy Markdown
Contributor Author

@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

virzak commented Apr 12, 2024

Copy link
Copy Markdown
Contributor Author

@grochocki would it be possible to merge this soon?

@Sergio0694

Copy link
Copy Markdown

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

@virzak

virzak commented Jan 30, 2025

Copy link
Copy Markdown
Contributor Author

@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
Copy Markdown

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

@virzak

virzak commented Jul 11, 2025

Copy link
Copy Markdown
Contributor Author

Man, just merge it :)

@virzak

virzak commented Aug 19, 2025

Copy link
Copy Markdown
Contributor Author

Happy belated birthday to this PR

image

@rent-a-developer

Copy link
Copy Markdown

It's a pity this hasn't been merged and published yet.
I hope it will be fixed soon.

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

6 participants