Skip to content

Commit 8f9c75d

Browse files
committed
warning and dead code alert formatting
1 parent e379770 commit 8f9c75d

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed

src/state/gvMessages.ml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ module Message = struct
1010
| Single p -> loc p
1111
| Group { pieces; _ } -> pieces |> List.filter_map loc |> List.enum |> Enum.get
1212

13+
let severity_to_bs_alert m = match m.severity with
14+
| Error -> "alert-danger"
15+
| Warning -> "alert-warning"
16+
| Info -> "alert-info"
17+
| Debug -> "alert-light"
18+
| Success -> "alert-success"
19+
1320
let to_string msg =
1421
let out = IO.output_string () in
1522
let fmt = Format.formatter_of_output out in

src/stylesheet.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,8 @@ ul {
2828
padding-left: 10px;
2929
font-size: small;
3030
}
31+
32+
.alert {
33+
padding: 8px 16px;
34+
margin: 0px;
35+
}

src/ui/panel/DeadCodeView.re

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ let make = (~dispatch, ~locations) => {
1111
{locations
1212
|> List.mapi((i, loc: GoblintCil.location) => {
1313
<li
14-
className="cursor warnitem"
14+
className="link-like alert alert-secondary"
1515
key={string_of_int(i)}
1616
onClick={_ => {
1717
dispatch @@ `DisplayFile(loc.file);

src/ui/panel/WarningView.re

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ let make = (~warnings, ~dispatch) => {
1111
} else {
1212
<ul>
1313
{warnings
14-
|> List.map(w => (Message.to_string(w), Message.location(w)))
15-
|> List.mapi((i, (text, loc)) => {
14+
|> List.map(w => (Message.to_string(w), Message.location(w), Message.severity_to_bs_alert(w)))
15+
|> List.mapi((i, (text, loc, alert)) => {
1616
let onClick =
1717
loc
1818
|> Option.map((loc, _) =>
1919
dispatch @@ `InspectLine(GvInspect.Line.of_location(loc))
2020
);
21-
<li className="cursor warnitem" key={string_of_int(i)} ?onClick>
21+
<li className={"link-like alert " ++ alert} key={string_of_int(i)} ?onClick>
2222
{text |> React.string}
2323
</li>;
2424
})

0 commit comments

Comments
 (0)