File tree Expand file tree Collapse file tree 3 files changed +45
-30
lines changed Expand file tree Collapse file tree 3 files changed +45
-30
lines changed Original file line number Diff line number Diff line change @@ -38,13 +38,25 @@ type nonrec t = t0 option
38
38
39
39
let use_default = None
40
40
41
+ let prepare_warning_concat ~(beg : bool ) s =
42
+ let s = Ext_string. trim s in
43
+ if s = " " then s
44
+ else
45
+ match s.[0 ] with
46
+ | '0' .. '9' -> if beg then " -w +" ^ s else " +" ^ s
47
+ | 'a' .. 'z' ->
48
+ if beg then " -w " ^ s else " +" ^ s
49
+ | _ ->
50
+ if beg then " -w " ^ s else s
51
+
41
52
let to_merlin_string x =
42
53
" -w " ^ Bsc_warnings. defaults_w
43
54
^
44
55
(match x with
45
56
| Some {number = None }
46
57
| None -> Ext_string. empty
47
- | Some {number = Some x } -> Ext_string. trim x )
58
+ | Some {number = Some x } ->
59
+ prepare_warning_concat ~beg: false x )
48
60
49
61
50
62
@@ -75,19 +87,12 @@ let from_map (m : Ext_json_types.t Map_string.t) =
75
87
let to_bsb_string ~toplevel warning =
76
88
match warning with
77
89
| None -> Ext_string. empty
78
- | Some warning ->
79
- " -w " ^ Bsc_warnings. defaults_w ^
90
+ | Some warning ->
80
91
(match warning.number with
81
92
| None ->
82
93
Ext_string. empty
83
94
| Some x ->
84
- let content =
85
- Ext_string. trim x in
86
- if content = " " then content
87
- else
88
- match content.[0 ] with
89
- | '0' .. '9' -> " +" ^ content
90
- | _ -> content
95
+ prepare_warning_concat ~beg: true x
91
96
) ^
92
97
if toplevel then
93
98
match warning.error with
Original file line number Diff line number Diff line change @@ -7030,13 +7030,25 @@ type nonrec t = t0 option
7030
7030
7031
7031
let use_default = None
7032
7032
7033
+ let prepare_warning_concat ~(beg : bool) s =
7034
+ let s = Ext_string.trim s in
7035
+ if s = "" then s
7036
+ else
7037
+ match s.[0] with
7038
+ | '0' .. '9' -> if beg then "-w +" ^ s else "+" ^ s
7039
+ | 'a' .. 'z' ->
7040
+ if beg then "-w " ^ s else "+" ^ s
7041
+ | _ ->
7042
+ if beg then "-w " ^ s else s
7043
+
7033
7044
let to_merlin_string x =
7034
7045
"-w " ^ Bsc_warnings.defaults_w
7035
7046
^
7036
7047
(match x with
7037
7048
| Some {number =None}
7038
7049
| None -> Ext_string.empty
7039
- | Some {number = Some x} -> Ext_string.trim x )
7050
+ | Some {number = Some x} ->
7051
+ prepare_warning_concat ~beg:false x )
7040
7052
7041
7053
7042
7054
@@ -7067,19 +7079,12 @@ let from_map (m : Ext_json_types.t Map_string.t) =
7067
7079
let to_bsb_string ~toplevel warning =
7068
7080
match warning with
7069
7081
| None -> Ext_string.empty
7070
- | Some warning ->
7071
- "-w " ^ Bsc_warnings.defaults_w ^
7082
+ | Some warning ->
7072
7083
(match warning.number with
7073
7084
| None ->
7074
7085
Ext_string.empty
7075
7086
| Some x ->
7076
- let content =
7077
- Ext_string.trim x in
7078
- if content = "" then content
7079
- else
7080
- match content.[0] with
7081
- | '0' .. '9' -> "+" ^ content
7082
- | _ -> content
7087
+ prepare_warning_concat ~beg:true x
7083
7088
) ^
7084
7089
if toplevel then
7085
7090
match warning.error with
Original file line number Diff line number Diff line change @@ -7030,13 +7030,25 @@ type nonrec t = t0 option
7030
7030
7031
7031
let use_default = None
7032
7032
7033
+ let prepare_warning_concat ~(beg : bool) s =
7034
+ let s = Ext_string.trim s in
7035
+ if s = "" then s
7036
+ else
7037
+ match s.[0] with
7038
+ | '0' .. '9' -> if beg then "-w +" ^ s else "+" ^ s
7039
+ | 'a' .. 'z' ->
7040
+ if beg then "-w " ^ s else "+" ^ s
7041
+ | _ ->
7042
+ if beg then "-w " ^ s else s
7043
+
7033
7044
let to_merlin_string x =
7034
7045
"-w " ^ Bsc_warnings.defaults_w
7035
7046
^
7036
7047
(match x with
7037
7048
| Some {number =None}
7038
7049
| None -> Ext_string.empty
7039
- | Some {number = Some x} -> Ext_string.trim x )
7050
+ | Some {number = Some x} ->
7051
+ prepare_warning_concat ~beg:false x )
7040
7052
7041
7053
7042
7054
@@ -7067,19 +7079,12 @@ let from_map (m : Ext_json_types.t Map_string.t) =
7067
7079
let to_bsb_string ~toplevel warning =
7068
7080
match warning with
7069
7081
| None -> Ext_string.empty
7070
- | Some warning ->
7071
- "-w " ^ Bsc_warnings.defaults_w ^
7082
+ | Some warning ->
7072
7083
(match warning.number with
7073
7084
| None ->
7074
7085
Ext_string.empty
7075
7086
| Some x ->
7076
- let content =
7077
- Ext_string.trim x in
7078
- if content = "" then content
7079
- else
7080
- match content.[0] with
7081
- | '0' .. '9' -> "+" ^ content
7082
- | _ -> content
7087
+ prepare_warning_concat ~beg:true x
7083
7088
) ^
7084
7089
if toplevel then
7085
7090
match warning.error with
You can’t perform that action at this time.
0 commit comments