@@ -93,116 +93,127 @@ Options:
9393
9494let main () =
9595 let args = Array. to_list Sys. argv in
96- let debugLevel , args =
96+ let debug_level , args =
9797 match args with
98- | _ :: "debug-dump" :: logLevel :: rest ->
99- ( (match logLevel with
98+ | _ :: "debug-dump" :: log_level :: rest ->
99+ ( (match log_level with
100100 | "verbose" -> Debug. Verbose
101101 | "regular" -> Regular
102102 | _ -> Off ),
103103 " dummy" :: rest )
104104 | args -> (Off , args)
105105 in
106- Debug. debugLevel := debugLevel ;
107- let debug = debugLevel <> Debug. Off in
108- let printHeaderInfo path line col =
106+ Debug. debug_level := debug_level ;
107+ let debug = debug_level <> Debug. Off in
108+ let print_header_info path line col =
109109 if debug then
110110 Printf. printf " Debug level: %s\n %s:%s-%s\n\n "
111- (match debugLevel with
111+ (match debug_level with
112112 | Debug. Verbose -> " verbose"
113113 | Regular -> " regular"
114114 | Off -> " off" )
115115 path line col
116116 in
117117 match args with
118- | [_; " cache-project" ; rootPath ] -> (
119- Cfg. readProjectConfigCache := false ;
120- let uri = Uri. fromPath rootPath in
121- match Packages. getPackage ~uri with
122- | Some package -> Cache. cacheProject package
118+ | [_; " cache-project" ; root_path ] -> (
119+ Cfg. read_project_config_cache := false ;
120+ let uri = Uri. from_path root_path in
121+ match Packages. get_package ~uri with
122+ | Some package -> Cache. cache_project package
123123 | None -> print_endline " \" ERR\" " )
124- | [_; " cache-delete" ; rootPath ] -> (
125- Cfg. readProjectConfigCache := false ;
126- let uri = Uri. fromPath rootPath in
127- match Packages. findRoot ~uri (Hashtbl. create 0 ) with
128- | Some (`Bs rootPath ) -> (
129- match BuildSystem. getLibBs rootPath with
124+ | [_; " cache-delete" ; root_path ] -> (
125+ Cfg. read_project_config_cache := false ;
126+ let uri = Uri. from_path root_path in
127+ match Packages. find_root ~uri (Hashtbl. create 0 ) with
128+ | Some (`Bs root_path ) -> (
129+ match Build_system. get_lib_bs root_path with
130130 | None -> print_endline " \" ERR\" "
131- | Some libBs ->
132- Cache. deleteCache (Cache. targetFileFromLibBs libBs );
131+ | Some lib_bs ->
132+ Cache. delete_cache (Cache. target_file_from_lib_bs lib_bs );
133133 print_endline " \" OK\" " )
134134 | _ -> print_endline " \" ERR: Did not find root \" " )
135- | [_; " completion" ; path; line; col; currentFile ] ->
136- printHeaderInfo path line col;
135+ | [_; " completion" ; path; line; col; current_file ] ->
136+ print_header_info path line col;
137137 Cli. completion ~debug ~path
138138 ~pos: (int_of_string line, int_of_string col)
139- ~current File
140- | [_; " completionResolve" ; path; modulePath ] ->
141- Cli. completionResolve ~path ~module Path
139+ ~current_file
140+ | [_; " completionResolve" ; path; module_path ] ->
141+ Cli. completion_resolve ~path ~module_path
142142 | [_; " definition" ; path; line; col] ->
143143 Cli. definition ~path ~pos: (int_of_string line, int_of_string col) ~debug
144144 | [_; " typeDefinition" ; path; line; col] ->
145- Cli. typeDefinition ~path ~pos: (int_of_string line, int_of_string col) ~debug
146- | [_; " documentSymbol" ; path] -> DocumentSymbol. command ~path
147- | [_; " hover" ; path; line; col; currentFile; supportsMarkdownLinks] ->
145+ Cli. type_definition ~path
146+ ~pos: (int_of_string line, int_of_string col)
147+ ~debug
148+ | [_; " documentSymbol" ; path] -> Document_symbol. command ~path
149+ | [_; " hover" ; path; line; col; current_file; supports_markdown_links] ->
148150 Cli. hover ~path
149151 ~pos: (int_of_string line, int_of_string col)
150- ~current File ~debug
151- ~supports MarkdownLinks :
152- (match supportsMarkdownLinks with
152+ ~current_file ~debug
153+ ~supports_markdown_links :
154+ (match supports_markdown_links with
153155 | "true" -> true
154156 | _ -> false )
155157 | [
156- _; " signatureHelp" ; path; line; col; currentFile; allowForConstructorPayloads;
158+ _;
159+ " signatureHelp" ;
160+ path;
161+ line;
162+ col;
163+ current_file;
164+ allow_for_constructor_payloads;
157165 ] ->
158- Cli. signatureHelp ~path
166+ Cli. signature_help ~path
159167 ~pos: (int_of_string line, int_of_string col)
160- ~current File ~debug
161- ~allow ForConstructorPayloads :
162- (match allowForConstructorPayloads with
168+ ~current_file ~debug
169+ ~allow_for_constructor_payloads :
170+ (match allow_for_constructor_payloads with
163171 | "true" -> true
164172 | _ -> false )
165- | [_; " inlayHint" ; path; line_start; line_end; maxLength ] ->
173+ | [_; " inlayHint" ; path; line_start; line_end; max_length ] ->
166174 Cli. inlayhint ~path
167175 ~pos: (int_of_string line_start, int_of_string line_end)
168- ~max Length ~debug
169- | [_; " codeLens" ; path] -> Cli. codeLens ~path ~debug
170- | [_; " codeAction" ; path; startLine; startCol; endLine; endCol; currentFile]
171- ->
172- Cli. codeAction ~path
173- ~start Pos:(int_of_string startLine, int_of_string startCol)
174- ~end Pos:(int_of_string endLine, int_of_string endCol)
175- ~current File ~debug
176+ ~max_length ~debug
177+ | [_; " codeLens" ; path] -> Cli. code_lens ~path ~debug
178+ | [
179+ _; " codeAction" ; path; start_line; start_col; end_line; end_col; current_file;
180+ ] ->
181+ Cli. code_action ~path
182+ ~start_pos: (int_of_string start_line, int_of_string start_col)
183+ ~end_pos: (int_of_string end_line, int_of_string end_col)
184+ ~current_file ~debug
176185 | [_; " codemod" ; path; line; col; typ; hint] ->
177186 let typ =
178187 match typ with
179188 | "add-missing-cases" -> Codemod. AddMissingCases
180189 | _ -> raise (Failure " unsupported type" )
181190 in
182- let source = Files. readFile path |> Option. value ~default: " " in
191+ let source = Files. read_file path |> Option. value ~default: " " in
183192 `String
184193 (Codemod. transform ~source
185194 ~pos: (int_of_string line, int_of_string col)
186195 ~debug ~typ ~hint )
187196 |> Yojson.Safe. pretty_to_string ~std: true
188197 |> print_endline
189- | [_; " diagnosticSyntax" ; path] -> Cli. diagnosticSyntax ~path
198+ | [_; " diagnosticSyntax" ; path] -> Cli. diagnostic_syntax ~path
190199 | [_; " references" ; path; line; col] ->
191200 Cli. references ~path ~pos: (int_of_string line, int_of_string col) ~debug
192201 | [_; " prepareRename" ; path; line; col] ->
193- Cli. prepareRename ~path ~pos: (int_of_string line, int_of_string col) ~debug
194- | [_; " rename" ; path; line; col; newName ] ->
202+ Cli. prepare_rename ~path ~pos: (int_of_string line, int_of_string col) ~debug
203+ | [_; " rename" ; path; line; col; new_name ] ->
195204 Cli. rename ~path
196205 ~pos: (int_of_string line, int_of_string col)
197- ~new Name ~debug
198- | [_; " semanticTokens" ; currentFile] -> Cli. semanticTokens ~path: currentFile
199- | [_; " createInterface" ; path; cmiFile] ->
200- `String (CreateInterface. command ~path ~cmi File)
206+ ~new_name ~debug
207+ | [_; " semanticTokens" ; current_file] ->
208+ Cli. semantic_tokens ~path: current_file
209+ | [_; " createInterface" ; path; cmi_file] ->
210+ `String (Create_interface. command ~path ~cmi_file )
201211 |> Yojson.Safe. pretty_to_string ~std: true
202212 |> print_endline
203213 | [_; " format" ; path] -> Cli. format ~path
204214 | [_; " test" ; path] -> Cli. test ~path
205- | [_; " cmt" ; rescript_json; cmt_path] -> CmtViewer. dump rescript_json cmt_path
215+ | [_; " cmt" ; rescript_json; cmt_path] ->
216+ Cmt_viewer. dump rescript_json cmt_path
206217 | args when List. mem " -h" args || List. mem " --help" args -> prerr_endline help
207218 | _ ->
208219 prerr_endline help;
0 commit comments