-
-
Notifications
You must be signed in to change notification settings - Fork 193
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
Breaking method chain in the middle of an if
statement causes offside error
#1712
Comments
Maybe be can go with module Foo =
let bar =
if
Regex(
"long long long long long long long long long"
)
.Match(
s
)
.Success
then
None
else
Some "hi" as suggested in the MS style guide here. What do you think? It would be easy to get around those offset errors that way. |
Oof, I find that extremely ugly, I'm afraid! @TobyShaw I don't suppose you have any cunning ideas here? |
Well I feel like there are two parts to this:
As for 1: Regex(
"long long long long long long long long long"
)
.Match(s)
.Success might be an option. When it comes to 2, I do like the if
longExpression
then
// ... style, it nicely highlights that you may wanted to go with a intermediate let binding instead. |
I guess in real life an expression that is long and complex enough to format this way is going to get changed at review time. I think I agree with both your suggestions 1 and 2; it's just the implied combination that makes me sad :P perhaps it's fine, though, and we'll just have an informal rule saying "you should never write code that falls into this case". |
Issue created from fantomas-online
Code
Result
Problem description
Not really sure what the best format here would be. Maybe:
assuming that actually compiles.
Extra information
Options
Fantomas Master at 05/09/2021 13:45:10 - f10b822
Default Fantomas configuration
Did you know that you can ignore files when formatting from fantomas-tool or the FAKE targets by using a .fantomasignore file?
The text was updated successfully, but these errors were encountered: