Skip to content

Commit 36d9227

Browse files
committed
format
1 parent bd74145 commit 36d9227

File tree

8 files changed

+26
-23
lines changed

8 files changed

+26
-23
lines changed

Makefile

+6
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ clean:
99
test:
1010
make -C analysis test
1111

12+
format:
13+
make -C analysis format
14+
15+
checkformat:
16+
make -C analysis checkformat
17+
1218
.DEFAULT_GOAL := build
1319

1420
.PHONY: build clean test

analysis/Makefile

+6
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ clean:
3333
make -C tests clean
3434
make -C reanalyze clean
3535

36+
format:
37+
dune build @fmt --auto-promote
38+
39+
checkformat:
40+
dune build @fmt
41+
3642
.DEFAULT_GOAL := build
3743

3844
.PHONY: build-analysis-binary build-reanalyze build-tests dce clean format test

analysis/reanalyze/src/EmitJson.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
let items = ref 0
22
let start () = Printf.printf "["
3-
let finish ()= Printf.printf "\n]\n"
3+
let finish () = Printf.printf "\n]\n"
44
let emitClose () = "\n}"
55

66
let emitItem ~ppf ~name ~kind ~file ~range ~message =

analysis/reanalyze/src/Exception.ml

+1-4
Original file line numberDiff line numberDiff line change
@@ -249,10 +249,7 @@ let traverseAst () =
249249
case.c_guard |> iterExprOpt self;
250250
case.c_rhs |> iterExpr self)
251251
in
252-
let isRaise s =
253-
s = "Pervasives.raise"
254-
|| s = "Pervasives.raise_notrace"
255-
in
252+
let isRaise s = s = "Pervasives.raise" || s = "Pervasives.raise_notrace" in
256253
let raiseArgs args =
257254
match args with
258255
| [(_, Some {Typedtree.exp_desc = Texp_construct ({txt}, _, _)})] ->

analysis/src/Cli.ml

+1-2
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,7 @@ let main () =
9393
Commands.codeAction ~path
9494
~pos:(int_of_string line, int_of_string col)
9595
~currentFile ~debug:false
96-
| [_; "diagnosticSyntax"; path;] ->
97-
Commands.diagnosticSyntax ~path
96+
| [_; "diagnosticSyntax"; path] -> Commands.diagnosticSyntax ~path
9897
| _ :: "reanalyze" :: _ ->
9998
let len = Array.length Sys.argv in
10099
for i = 1 to len - 2 do

analysis/src/Commands.ml

+1-2
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,7 @@ let format ~path =
258258
else ""
259259

260260
let diagnosticSyntax ~path =
261-
print_endline
262-
(Diagnostics.document_syntax ~path |> Protocol.array)
261+
print_endline (Diagnostics.document_syntax ~path |> Protocol.array)
263262

264263
let test ~path =
265264
Uri.stripPath := true;

analysis/src/Diagnostics.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ let document_syntax ~path =
3030
Res_driver.parsingEngine.parseInterface ~forPrinter:false ~filename:path
3131
in
3232
get_diagnostics parseInterface.diagnostics
33-
else []
33+
else []

analysis/src/Protocol.ml

+9-13
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,12 @@ type completionItem = {
1010
documentation: markupContent option;
1111
}
1212

13-
type location = {uri : string; range : range}
14-
type documentSymbolItem = {name : string; kind : int; location : location}
15-
type renameFile = {oldUri : string; newUri : string}
16-
type textEdit = {range : range; newText : string}
17-
18-
type diagnostic = {
19-
range : range;
20-
message : string;
21-
severity : int;
22-
}
13+
type location = {uri: string; range: range}
14+
type documentSymbolItem = {name: string; kind: int; location: location}
15+
type renameFile = {oldUri: string; newUri: string}
16+
type textEdit = {range: range; newText: string}
17+
18+
type diagnostic = {range: range; message: string; severity: int}
2319

2420
type optionalVersionedTextDocumentIdentifier = {
2521
version: int option;
@@ -134,11 +130,11 @@ let stringifyCodeAction ca =
134130

135131
(* https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#diagnostic *)
136132
let stringifyDiagnostic d =
137-
Printf.sprintf {|{
133+
Printf.sprintf
134+
{|{
138135
"range": %s,
139136
"message": "%s",
140137
"severity": %d,
141138
"source": "ReScript"
142139
}|}
143-
(stringifyRange d.range) (Json.escape d.message)
144-
d.severity
140+
(stringifyRange d.range) (Json.escape d.message) d.severity

0 commit comments

Comments
 (0)