package MlFront_Exec

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module MlFront_Exec.AutofixSource

Sourcetype t

The type of an autofix suggestion.

Sourceval create : problematic_text:string -> replace_with:string -> condition:string -> unit -> t

create ~problematic_text ~replace_with ~condition () creates a new autofix suggestion.

  • problematic_text is the text that is to be replaced.
  • replace_with is the text that should replace the problematic text.
  • condition is a human-readable condition that should be verified before applying the fix, without any periods. For example, "only if the checksum is valid"
Sourceval hint : t -> string

hint autofix returns a human-readable hint describing the autofix suggestion.

Sourceval parse_string : string -> (t, string) result

parse_string s parses an autofix suggestion from the string s. Returns Ok autofix if s is a valid autofix suggestion, or Error msg if it is not.

Sourceval edit_file : file_path:string -> line:int -> col:int -> t -> (unit, string) result

edit_file replaces the problematic text in a file with the suggested replacement.

Sourceval save_with_fix : file_path:string -> contents:string -> line:int -> col:int -> t -> (unit, string) result

save_with_fix ~file_path ~contents autofix saves the contents contents to the file file_path with the suggested edit from autofix.