-
-
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
Print in keyword after correct SynBinding #1180
Conversation
@@ -2000,7 +2000,7 @@ and genExpr astContext synExpr = | |||
mkRange "IN" binding.RangeOfBindingAndRhs.End e.Range.Start | |||
|
|||
Map.tryFindOrEmptyList IN ctx.TriviaTokenNodes | |||
|> TriviaHelpers.``keyword token inside range`` inRange | |||
|> TriviaHelpers.``keyword token after start column and on same line`` inRange |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably a better thing to do here would be looking inside the range between the last binding end and the body expression start.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, thought of that but we capture nested LetOrUse
expressions so that information is lost in CodePrinter.
See
fantomas/src/Fantomas/SourceParser.fs
Line 876 in 3035e5a
let rec (|LetOrUses|_|) = |
trivia | ||
|> List.choose (fun t -> | ||
match t.Type with | ||
| TriviaNodeType.Token (_, tok) when (range.StartLine = t.Range.StartLine |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it need to handle cases where in
is on another line?
do
let _ = ()
in
() // note the different indent is allowed here due to `in` use
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I think it should since we are doing this.
Thanks for pointing that out.
Fixes #1176