-
-
Notifications
You must be signed in to change notification settings - Fork 102
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
csharpier-ignore comments force CRLF line endings #884
Comments
This is a very odd issue but I have a hunch what may be going on. It could be that when csharpier asks Roslyn for the source of an ignored node, Roslyn is using CRLF. CSharpier does have code to replace mismatched line endings in ignored code with what is configured, but I believe that only happens with statements in ranged ignores. I'm out of town right now so can't verify the theory, but I can look at a fix when I'm back next week. |
I haven't been able to reproduce this. I tried on the file system as well as in a test, with a bunch of combinations of line endings in the file + line ending options. CSharpier doesn't expose the line endings as an option in the Could you supply the full file? Or a trimmed down version that reproduces the problem. |
Sure! Here's a repository that exhibits the issue: https://github.com/pingzing/CSharpierRepro In order to reproduce it, do the following:
But here's the really interesting part: If I replace the contents of EDIT: Ah--and another note: the original issue was in a repo where Git's |
It took a bit to track down, but this had to do with the combination of preprocessor symbols + csharpier-ignore not properly replacing line endings in the ignored section of code. And of course was a one line fix once I found it. And I believe it only shows up if the file in question does not use the system's default line endings (file with LF on windows which defaults to CRLF). |
Fantastic work! Thanks a bunch! |
I'm running into an interesting issue with line endings! I have a project configured to use
LF
line-endings, both at the .editorconfig level, and in CSharpier'scsharpierrc
config file. That works fine.However! I have a block of code that I have
// csharpier-ignore
d. When CSharpier hits that line, it replaces theLF
s withCRLF
s.I'm running on Windows, and this is CSharpier v0.24.1.
Example:
No
//csharpier-ignore
:After adding
// csharpier-ignore
and runningdotnet csharpier .
:What makes things even more fun is that once this hits CI, it fails the
--check
check that we do, because I have git'score.autocrlf
set totrue
, which forces allCRLF
s toLF
s upon pushing it up to the remote. When CSharpier's--check
command runs in CI, it detects that it would change theseLF
s toCRLF
s, and fails the build.I'm not sure what my expected fix is here. Maybe make the newline-inserting that CSharpier (seems to?) do here respect
endOfLine
?The text was updated successfully, but these errors were encountered: