src/lsp/checker/argv.bend
bolt@1.27.0.0 · 41 lines · 6 definitions
1
2
3
4
5
6import Base
7import bolt@1.27.0.0/src/paths.bend as Paths
8import bolt@1.27.0.0/src/lsp/report.bend as Rep
9
10
11type Run is Data:
12 Run{path: String, flag: String}
13
14
15def flag(rr: Run) -> String:
16 Run{path, ff} = rr
17 ff
18
19
20def run_of(path: String) -> Run:
21 Run{path, "--check-only"}
22
23
24
25def only_todos(ds: List<&2, Rep.Diag>) -> Bool:
26 match ds:
27 case Con{Rep.Diag{line, +msg}, Nil{}}:
28 Bool.or(String.contains(msg, "TODO found"), String.contains(msg, "TODOs found"))
29 case other:
30 False{}
31
32
33def proof_path(+path: String) -> String:
34 String.take(path, Nat.sub(String.length(path), 9n)) ++ "PROOF.bend"
35
36
37
38
39
40def followup(+ds: List<&2, Rep.Diag>, +path: String) -> Maybe<&2, Run>:
41 Bool.pick(Maybe<&2, Run>, Bool.and(only_todos(ds), Paths.is_laws(path)), Some{run_of(proof_path(path))}, None{})