Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
- Build system: Add OpenTelemetry tracing support for cli commands. https://github.com/rescript-lang/rescript/pull/8370
- Use a single vendored @rescript/react package across the repo. https://github.com/rescript-lang/rescript/pull/7525
- Improve deprecated attribute extraction and support record form. https://github.com/rescript-lang/rescript/pull/8396
- Refactor analysis to decouple I/O from core logic. https://github.com/rescript-lang/rescript/pull/8426

#### :house: Internal

Expand Down
45 changes: 18 additions & 27 deletions analysis/bin/main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -134,22 +134,18 @@ let main () =
| _ -> print_endline "\"ERR: Did not find root \"")
| [_; "completion"; path; line; col; currentFile] ->
printHeaderInfo path line col;
Commands.completion ~debug ~path
Cli.completion ~debug ~path
~pos:(int_of_string line, int_of_string col)
~currentFile
| [_; "completionResolve"; path; modulePath] ->
Commands.completionResolve ~path ~modulePath
Cli.completionResolve ~path ~modulePath
| [_; "definition"; path; line; col] ->
Commands.definition ~path
~pos:(int_of_string line, int_of_string col)
~debug
Cli.definition ~path ~pos:(int_of_string line, int_of_string col) ~debug
| [_; "typeDefinition"; path; line; col] ->
Commands.typeDefinition ~path
~pos:(int_of_string line, int_of_string col)
~debug
Cli.typeDefinition ~path ~pos:(int_of_string line, int_of_string col) ~debug
| [_; "documentSymbol"; path] -> DocumentSymbol.command ~path
| [_; "hover"; path; line; col; currentFile; supportsMarkdownLinks] ->
Commands.hover ~path
Cli.hover ~path
~pos:(int_of_string line, int_of_string col)
~currentFile ~debug
~supportsMarkdownLinks:
Expand All @@ -159,21 +155,21 @@ let main () =
| [
_; "signatureHelp"; path; line; col; currentFile; allowForConstructorPayloads;
] ->
Commands.signatureHelp ~path
Cli.signatureHelp ~path
~pos:(int_of_string line, int_of_string col)
~currentFile ~debug
~allowForConstructorPayloads:
(match allowForConstructorPayloads with
| "true" -> true
| _ -> false)
| [_; "inlayHint"; path; line_start; line_end; maxLength] ->
Commands.inlayhint ~path
Cli.inlayhint ~path
~pos:(int_of_string line_start, int_of_string line_end)
~maxLength ~debug
| [_; "codeLens"; path] -> Commands.codeLens ~path ~debug
| [_; "codeLens"; path] -> Cli.codeLens ~path ~debug
| [_; "codeAction"; path; startLine; startCol; endLine; endCol; currentFile]
->
Commands.codeAction ~path
Cli.codeAction ~path
~startPos:(int_of_string startLine, int_of_string startCol)
~endPos:(int_of_string endLine, int_of_string endCol)
~currentFile ~debug
Expand All @@ -183,34 +179,29 @@ let main () =
| "add-missing-cases" -> Codemod.AddMissingCases
| _ -> raise (Failure "unsupported type")
in
let source = Files.readFile path |> Option.value ~default:"" in
let res =
Codemod.transform ~path
Codemod.transform ~source
~pos:(int_of_string line, int_of_string col)
~debug ~typ ~hint
|> Json.escape
in
Printf.printf "\"%s\"" res
| [_; "diagnosticSyntax"; path] -> Commands.diagnosticSyntax ~path
| [_; "diagnosticSyntax"; path] -> Cli.diagnosticSyntax ~path
| [_; "references"; path; line; col] ->
Commands.references ~path
~pos:(int_of_string line, int_of_string col)
~debug
Cli.references ~path ~pos:(int_of_string line, int_of_string col) ~debug
| [_; "prepareRename"; path; line; col] ->
Commands.prepareRename ~path
~pos:(int_of_string line, int_of_string col)
~debug
Cli.prepareRename ~path ~pos:(int_of_string line, int_of_string col) ~debug
| [_; "rename"; path; line; col; newName] ->
Commands.rename ~path
Cli.rename ~path
~pos:(int_of_string line, int_of_string col)
~newName ~debug
| [_; "semanticTokens"; currentFile] ->
SemanticTokens.semanticTokens ~currentFile
| [_; "semanticTokens"; currentFile] -> Cli.semanticTokens ~path:currentFile
| [_; "createInterface"; path; cmiFile] ->
Printf.printf "\"%s\""
(Json.escape (CreateInterface.command ~path ~cmiFile))
| [_; "format"; path] ->
Printf.printf "\"%s\"" (Json.escape (Commands.format ~path))
| [_; "test"; path] -> Commands.test ~path
| [_; "format"; path] -> Cli.format ~path
| [_; "test"; path] -> Cli.test ~path
| [_; "cmt"; rescript_json; cmt_path] -> CmtViewer.dump rescript_json cmt_path
| args when List.mem "-h" args || List.mem "--help" args -> prerr_endline help
| _ ->
Expand Down
Loading
Loading