File tree Expand file tree Collapse file tree 2 files changed +29
-2
lines changed Expand file tree Collapse file tree 2 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -2639,3 +2639,24 @@ let isUnix =
26392639 |> fun p -> (p = 4) || (p = 6) || (p = 128)
26402640#endif
26412641"""
2642+
2643+ [<Test>]
2644+ let ``indented #if directive inside another non - indented #if directive should format correctly , 1866`` () =
2645+ formatSourceString
2646+ false
2647+ """
2648+ #if FOO
2649+ #if BAR
2650+ #endif
2651+ #endif
2652+ """
2653+ config
2654+ |> prepend newline
2655+ |> should
2656+ equal
2657+ """
2658+ #if FOO
2659+ #if BAR
2660+ #endif
2661+ #endif
2662+ """
Original file line number Diff line number Diff line change @@ -157,8 +157,14 @@ let rec private getTokenizedHashes (sourceCode: string) : Token list =
157157 ( fun t ->
158158 let info =
159159 { t.TokenInfo with
160- LeftColumn = t.TokenInfo.LeftColumn + hashContentLength
161- RightColumn = t.TokenInfo.RightColumn + hashContentLength }
160+ LeftColumn =
161+ t.TokenInfo.LeftColumn
162+ + hashContentLength
163+ + offset
164+ RightColumn =
165+ t.TokenInfo.RightColumn
166+ + hashContentLength
167+ + offset }
162168
163169 { t with
164170 LineNumber = lineNumber
You can’t perform that action at this time.
0 commit comments