Skip to content

Commit c6ec68d

Browse files
committed
wip
1 parent 82bbdc5 commit c6ec68d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+8578
-9132
lines changed

analysis/src/Codemod.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ let transform ~path ~pos ~debug ~typ ~hint =
1111
| AddMissingCases -> (
1212
let source = "let " ^ hint ^ " = ()" in
1313
let {Res_driver.parsetree = hintStructure} =
14-
Res_driver.parse_implementation_from_source ~for_printer:false
15-
~display_filename:"<none>" ~source
14+
Res_driver.parseImplementationFromSource ~forPrinter:false
15+
~displayFilename:"<none>" ~source
1616
in
1717
match hintStructure with
1818
| [{pstr_desc = Pstr_value (_, [{pvb_pat = pattern}])}] -> (

analysis/src/Commands.ml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -278,21 +278,17 @@ let rename ~path ~pos ~newName ~debug =
278278
let format ~path =
279279
if Filename.check_suffix path ".res" then
280280
let {Res_driver.parsetree = structure; comments; diagnostics} =
281-
Res_driver.parsing_engine.parse_implementation ~for_printer:true
281+
Res_driver.parsingEngine.parseImplementation ~forPrinter:true
282282
~filename:path
283283
in
284284
if List.length diagnostics > 0 then ""
285-
else
286-
Res_printer.print_implementation ~width:!Res_cli.ResClflags.width
287-
~comments structure
285+
else Res_printer.printImplementation ~width:80 ~comments structure
288286
else if Filename.check_suffix path ".resi" then
289287
let {Res_driver.parsetree = signature; comments; diagnostics} =
290-
Res_driver.parsing_engine.parse_interface ~for_printer:true ~filename:path
288+
Res_driver.parsingEngine.parseInterface ~forPrinter:true ~filename:path
291289
in
292290
if List.length diagnostics > 0 then ""
293-
else
294-
Res_printer.print_interface ~width:!Res_cli.ResClflags.width ~comments
295-
signature
291+
else Res_printer.printInterface ~width:80 ~comments signature
296292
else ""
297293

298294
let diagnosticSyntax ~path =

analysis/src/CompletionFrontEnd.ml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ let findArgCompletables ~(args : arg list) ~endPos ~posBeforeCursor
7777
if CursorPosition.locIsEmpty exp.pexp_loc ~pos:posBeforeCursor then
7878
someArgHadEmptyExprLoc := true;
7979

80-
if Res_parsetree_viewer.is_template_literal exp then None
80+
if Res_parsetree_viewer.isTemplateLiteral exp then None
8181
else if exp.pexp_loc |> Loc.hasPos ~pos:posBeforeCursor then (
8282
if Debug.verbose () then
8383
print_endline
@@ -294,7 +294,7 @@ let rec exprToContextPathInner (e : Parsetree.expression) =
294294

295295
and exprToContextPath (e : Parsetree.expression) =
296296
match
297-
( Res_parsetree_viewer.has_await_attribute e.pexp_attributes,
297+
( Res_parsetree_viewer.hasAwaitAttribute e.pexp_attributes,
298298
exprToContextPathInner e )
299299
with
300300
| true, Some ctxPath -> Some (CPAwait ctxPath)
@@ -1134,7 +1134,7 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor
11341134
completionContext =
11351135
(if
11361136
isLikelyModulePath
1137-
&& expr |> Res_parsetree_viewer.is_braced_expr
1137+
&& expr |> Res_parsetree_viewer.isBracedExpr
11381138
then ValueOrField
11391139
else Value);
11401140
}))
@@ -1228,7 +1228,7 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor
12281228
}))
12291229
| None -> ())
12301230
| Pexp_apply ({pexp_desc = Pexp_ident compName}, args)
1231-
when Res_parsetree_viewer.is_jsx_expression expr ->
1231+
when Res_parsetree_viewer.isJsxExpression expr ->
12321232
inJsxContext := true;
12331233
let jsxProps = CompletionJsx.extractJsxProps ~compName ~args in
12341234
let compNamePath = flattenLidCheckDot ~jsx:true compName in
@@ -1585,7 +1585,7 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor
15851585

15861586
if Filename.check_suffix path ".res" then (
15871587
let parser =
1588-
Res_driver.parsing_engine.parse_implementation ~for_printer:false
1588+
Res_driver.parsingEngine.parseImplementation ~forPrinter:false
15891589
in
15901590
let {Res_driver.parsetree = str} = parser ~filename:currentFile in
15911591
iterator.structure iterator str |> ignore;
@@ -1597,7 +1597,7 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor
15971597
if !found = false then if debug then Printf.printf "XXX Not found!\n";
15981598
!result)
15991599
else if Filename.check_suffix path ".resi" then (
1600-
let parser = Res_driver.parsing_engine.parse_interface ~for_printer:false in
1600+
let parser = Res_driver.parsingEngine.parseInterface ~forPrinter:false in
16011601
let {Res_driver.parsetree = signature} = parser ~filename:currentFile in
16021602
iterator.signature iterator signature |> ignore;
16031603
if blankAfterCursor = Some ' ' || blankAfterCursor = Some '\n' then (

analysis/src/CreateInterface.ml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,7 @@ let printSignature ~extractor ~signature =
147147

148148
Printtyp.reset_names ();
149149
let sigItemToString (item : Outcometree.out_sig_item) =
150-
item |> Res_outcome_printer.print_out_sig_item_doc
151-
|> Res_doc.to_string ~width:!Res_cli.ResClflags.width
150+
item |> Res_outcome_printer.printOutSigItemDoc |> Res_doc.toString ~width:80
152151
in
153152

154153
let genSigStrForInlineAttr lines attributes id vd =

analysis/src/Diagnostics.ml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ let document_syntax ~path =
33
diagnostics
44
|> List.map (fun diagnostic ->
55
let _, startline, startcol =
6-
Location.get_pos_info (Res_diagnostics.get_start_pos diagnostic)
6+
Location.get_pos_info (Res_diagnostics.getStartPos diagnostic)
77
in
88
let _, endline, endcol =
9-
Location.get_pos_info (Res_diagnostics.get_end_pos diagnostic)
9+
Location.get_pos_info (Res_diagnostics.getEndPos diagnostic)
1010
in
1111
Protocol.stringifyDiagnostic
1212
{
@@ -21,14 +21,13 @@ let document_syntax ~path =
2121
in
2222
if FindFiles.isImplementation path then
2323
let parseImplementation =
24-
Res_driver.parsing_engine.parse_implementation ~for_printer:false
24+
Res_driver.parsingEngine.parseImplementation ~forPrinter:false
2525
~filename:path
2626
in
2727
get_diagnostics parseImplementation.diagnostics
2828
else if FindFiles.isInterface path then
2929
let parseInterface =
30-
Res_driver.parsing_engine.parse_interface ~for_printer:false
31-
~filename:path
30+
Res_driver.parsingEngine.parseInterface ~forPrinter:false ~filename:path
3231
in
3332
get_diagnostics parseInterface.diagnostics
3433
else []

analysis/src/DocumentSymbol.ml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,14 +136,12 @@ let command ~path =
136136

137137
(if Filename.check_suffix path ".res" then
138138
let parser =
139-
Res_driver.parsing_engine.parse_implementation ~for_printer:false
139+
Res_driver.parsingEngine.parseImplementation ~forPrinter:false
140140
in
141141
let {Res_driver.parsetree = structure} = parser ~filename:path in
142142
iterator.structure iterator structure |> ignore
143143
else
144-
let parser =
145-
Res_driver.parsing_engine.parse_interface ~for_printer:false
146-
in
144+
let parser = Res_driver.parsingEngine.parseInterface ~forPrinter:false in
147145
let {Res_driver.parsetree = signature} = parser ~filename:path in
148146
iterator.signature iterator signature |> ignore);
149147
let isInside

analysis/src/DumpAst.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ let printStructItem structItem ~pos ~source =
313313

314314
let dump ~currentFile ~pos =
315315
let {Res_driver.parsetree = structure; source} =
316-
Res_driver.parsing_engine.parse_implementation ~for_printer:true
316+
Res_driver.parsingEngine.parseImplementation ~forPrinter:true
317317
~filename:currentFile
318318
in
319319

analysis/src/Hint.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ let inlay ~path ~pos ~maxLength ~debug =
7272
let iterator = {Ast_iterator.default_iterator with value_binding} in
7373
(if Files.classifySourceFile path = Res then
7474
let parser =
75-
Res_driver.parsing_engine.parse_implementation ~for_printer:false
75+
Res_driver.parsingEngine.parseImplementation ~forPrinter:false
7676
in
7777
let {Res_driver.parsetree = structure} = parser ~filename:path in
7878
iterator.structure iterator structure |> ignore);
@@ -136,7 +136,7 @@ let codeLens ~path ~debug =
136136
where the definition itself will be the same thing as what would've been printed in the code lens. *)
137137
(if Files.classifySourceFile path = Res then
138138
let parser =
139-
Res_driver.parsing_engine.parse_implementation ~for_printer:false
139+
Res_driver.parsingEngine.parseImplementation ~forPrinter:false
140140
in
141141
let {Res_driver.parsetree = structure} = parser ~filename:path in
142142
iterator.structure iterator structure |> ignore);

analysis/src/PrintType.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
let printExpr ?(lineWidth = 60) typ =
22
Printtyp.reset_names ();
33
Printtyp.reset_and_mark_loops typ;
4-
Res_doc.to_string ~width:lineWidth
5-
(Res_outcome_printer.print_out_type_doc (Printtyp.tree_of_typexp false typ))
4+
Res_doc.toString ~width:lineWidth
5+
(Res_outcome_printer.printOutTypeDoc (Printtyp.tree_of_typexp false typ))
66

77
let printDecl ?printNameAsIs ~recStatus name decl =
88
Printtyp.reset_names ();
9-
Res_doc.to_string ~width:60
10-
(Res_outcome_printer.print_out_sig_item_doc ?print_name_as_is:printNameAsIs
9+
Res_doc.toString ~width:60
10+
(Res_outcome_printer.printOutSigItemDoc ?printNameAsIs
1111
(Printtyp.tree_of_type_declaration (Ident.create name) decl recStatus))

analysis/src/ProcessCmt.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ let mapRecordField {Types.ld_id; ld_type; ld_attributes} =
2727
stamp = astamp;
2828
fname = Location.mknoloc name;
2929
typ = ld_type;
30-
optional = Res_parsetree_viewer.has_optional_attribute ld_attributes;
30+
optional = Res_parsetree_viewer.hasOptionalAttribute ld_attributes;
3131
docstring =
3232
(match ProcessAttributes.findDocAttribute ld_attributes with
3333
| None -> []
@@ -261,7 +261,7 @@ let forTypeDeclaration ~env ~(exported : Exported.t)
261261
typ = f.ld_type.ctyp_type;
262262
optional =
263263
Res_parsetree_viewer
264-
.has_optional_attribute
264+
.hasOptionalAttribute
265265
f.ld_attributes;
266266
docstring =
267267
(match
@@ -308,7 +308,7 @@ let forTypeDeclaration ~env ~(exported : Exported.t)
308308
fname;
309309
typ = ctyp_type;
310310
optional =
311-
Res_parsetree_viewer.has_optional_attribute
311+
Res_parsetree_viewer.hasOptionalAttribute
312312
ld_attributes;
313313
docstring = attrsToDocstring ld_attributes;
314314
deprecated =

0 commit comments

Comments
 (0)