forked from fsprojects/fantomas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFormatConfig.fs
88 lines (79 loc) · 3.62 KB
/
FormatConfig.fs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
module Fantomas.FormatConfig
open System
let SAT_SOLVE_MAX_STEPS = 100
type FormatException(msg : string) =
inherit Exception(msg)
type Num = int
type FormatConfig =
{ /// Number of spaces for each indentation
IndentSpaceNum : Num;
/// The column where we break to new lines
PageWidth : Num;
SemicolonAtEndOfLine : bool;
SpaceBeforeArgument : bool;
SpaceBeforeColon : bool;
SpaceAfterComma : bool;
SpaceAfterSemicolon : bool;
IndentOnTryWith : bool;
/// Reordering and deduplicating open statements
ReorderOpenDeclaration : bool;
SpaceAroundDelimiter : bool;
KeepNewlineAfter : bool
/// Prettyprinting based on ASTs only
StrictMode : bool }
static member Default =
{ IndentSpaceNum = 4
PageWidth = 120
SemicolonAtEndOfLine = false
SpaceBeforeArgument = true
SpaceBeforeColon = false
SpaceAfterComma = true
SpaceAfterSemicolon = true
IndentOnTryWith = false
ReorderOpenDeclaration = false
SpaceAroundDelimiter = true
KeepNewlineAfter = false
StrictMode = false }
static member create(indentSpaceNum, pageWith, semicolonAtEndOfLine,
spaceBeforeArgument, spaceBeforeColon, spaceAfterComma,
spaceAfterSemicolon, indentOnTryWith, reorderOpenDeclaration) =
{ FormatConfig.Default with
IndentSpaceNum = indentSpaceNum;
PageWidth = pageWith;
SemicolonAtEndOfLine = semicolonAtEndOfLine;
SpaceBeforeArgument = spaceBeforeArgument;
SpaceBeforeColon = spaceBeforeColon;
SpaceAfterComma = spaceAfterComma;
SpaceAfterSemicolon = spaceAfterSemicolon;
IndentOnTryWith = indentOnTryWith;
ReorderOpenDeclaration = reorderOpenDeclaration }
static member create(indentSpaceNum, pageWith, semicolonAtEndOfLine,
spaceBeforeArgument, spaceBeforeColon, spaceAfterComma,
spaceAfterSemicolon, indentOnTryWith, reorderOpenDeclaration, spaceAroundDelimiter) =
{ FormatConfig.Default with
IndentSpaceNum = indentSpaceNum;
PageWidth = pageWith;
SemicolonAtEndOfLine = semicolonAtEndOfLine;
SpaceBeforeArgument = spaceBeforeArgument;
SpaceBeforeColon = spaceBeforeColon;
SpaceAfterComma = spaceAfterComma;
SpaceAfterSemicolon = spaceAfterSemicolon;
IndentOnTryWith = indentOnTryWith;
ReorderOpenDeclaration = reorderOpenDeclaration;
SpaceAroundDelimiter = spaceAroundDelimiter }
static member create(indentSpaceNum, pageWith, semicolonAtEndOfLine,
spaceBeforeArgument, spaceBeforeColon, spaceAfterComma,
spaceAfterSemicolon, indentOnTryWith, reorderOpenDeclaration,
spaceAroundDelimiter, strictMode) =
{ FormatConfig.Default with
IndentSpaceNum = indentSpaceNum;
PageWidth = pageWith;
SemicolonAtEndOfLine = semicolonAtEndOfLine;
SpaceBeforeArgument = spaceBeforeArgument;
SpaceBeforeColon = spaceBeforeColon;
SpaceAfterComma = spaceAfterComma;
SpaceAfterSemicolon = spaceAfterSemicolon;
IndentOnTryWith = indentOnTryWith;
ReorderOpenDeclaration = reorderOpenDeclaration;
SpaceAroundDelimiter = spaceAroundDelimiter;
StrictMode = strictMode }