text
stringlengths 12
786k
|
---|
let register ( ) = let open Services_registration in register0 ~ chunked : false S . ballots ( fun ctxt ( ) ( ) -> Vote . get_ballots ctxt ) ; register0 ~ chunked : true S . ballot_list ( fun ctxt ( ) ( ) -> Vote . get_ballot_list ctxt >|= ok ) ; register0 ~ chunked : false S . current_period ( fun ctxt ( ) ( ) -> Voting_period . get_rpc_current_info ctxt ) ; register0 ~ chunked : false S . successor_period ( fun ctxt ( ) ( ) -> Voting_period . get_rpc_succ_info ctxt ) ; register0 ~ chunked : false S . current_quorum ( fun ctxt ( ) ( ) -> Vote . get_current_quorum ctxt ) ; register0 ~ chunked : true S . proposals ( fun ctxt ( ) ( ) -> Vote . get_proposals ctxt ) ; register0 ~ chunked : true S . listings ( fun ctxt ( ) ( ) -> Vote . get_listings ctxt >|= ok ) ; register0 ~ chunked : false S . current_proposal ( fun ctxt ( ) ( ) -> Vote . find_current_proposal ctxt ) ; register0 ~ chunked : false S . total_voting_power ( fun ctxt ( ) ( ) -> Vote . get_total_voting_power_free ctxt ) [ @@ coq_axiom_with_reason " disabled because we would need to re - create the error e in order to have \ different polymorphic variables " ] |
let ballots ctxt block = RPC_context . make_call0 S . ballots ctxt block ( ) ( ) |
let ballot_list ctxt block = RPC_context . make_call0 S . ballot_list ctxt block ( ) ( ) |
let current_period ctxt block = RPC_context . make_call0 S . current_period ctxt block ( ) ( ) |
let successor_period ctxt block = RPC_context . make_call0 S . successor_period ctxt block ( ) ( ) |
let current_quorum ctxt block = RPC_context . make_call0 S . current_quorum ctxt block ( ) ( ) |
let listings ctxt block = RPC_context . make_call0 S . listings ctxt block ( ) ( ) |
let proposals ctxt block = RPC_context . make_call0 S . proposals ctxt block ( ) ( ) |
let current_proposal ctxt block = RPC_context . make_call0 S . current_proposal ctxt block ( ) ( ) |
let total_voting_power ctxt block = RPC_context . make_call0 S . total_voting_power ctxt block ( ) ( ) |
module Block_producer_keys = struct [ %% versioned module Stable = struct [ @@@ no_toplevel_latest_type ] no_toplevel_latest_type module V1 = struct type t = ( Keypair . Stable . V1 . t * Public_key . Compressed . Stable . V1 . t ) t list [ @@ deriving sexp ] sexp let to_latest = Fn . id end end ] end type t = Stable . Latest . t [ @@ deriving sexp ] sexp end |
module Evaluator_status = struct [ %% versioned module Stable = struct [ @@@ no_toplevel_latest_type ] no_toplevel_latest_type module V1 = struct type t = At of Global_slot . Stable . V1 . t | Completed let to_latest = Fn . id end end ] end type t = Stable . Latest . t = At of Global_slot . t | Completed [ @@ deriving sexp ] sexp end |
module Vrf_evaluation_result = struct [ %% versioned module Stable = struct [ @@@ no_toplevel_latest_type ] no_toplevel_latest_type module V1 = struct type t = { slots_won : Consensus . Data . Slot_won . Stable . V1 . t list ; evaluator_status : Evaluator_status . Stable . V1 . t } let to_latest = Fn . id end end ] end type t = Stable . Latest . t = { slots_won : Consensus . Data . Slot_won . t list ; evaluator_status : Evaluator_status . t } end |
module Worker_state = struct type init_arg = { constraint_constants : Genesis_constants . Constraint_constants . t ; consensus_constants : Consensus . Constants . Stable . Latest . t ; conf_dir : string ; logger : Logger . Stable . Latest . t } [ @@ deriving bin_io_unversioned ] bin_io_unversioned type t = { config : init_arg ; mutable last_checked_slot_and_epoch : ( Epoch . t * Slot . t ) t Public_key . Compressed . Table . t ; slots_won : Consensus . Data . Slot_won . t Queue . t ; mutable current_slot : Global_slot . t option ; mutable epoch_data : unit Ivar . t * Consensus . Data . Epoch_data_for_vrf . t option ; mutable block_producer_keys : Block_producer_keys . t } let make_last_checked_slot_and_epoch_table old_table new_keys ~ default = let module Set = Public_key . Compressed . Set in let module Table = Public_key . Compressed . Table in let last_checked_slot_and_epoch = Table . create ( ) in List . iter new_keys ~ f ( : fun ( _ , pk ) pk -> let data = Option . value ( Table . find old_table pk ) pk ~ default in Table . add_exn last_checked_slot_and_epoch ~ key : pk ~ data ) ; last_checked_slot_and_epoch let seen_slot last_checked_slot_and_epoch epoch slot = let module Table = Public_key . Compressed . Table in let unseens = Table . to_alist last_checked_slot_and_epoch |> List . filter_map ~ f ( : fun ( pk , last_checked_epoch_and_slot ) last_checked_epoch_and_slot -> let i = Tuple2 . compare ~ cmp1 : Epoch . compare ~ cmp2 : Slot . compare last_checked_epoch_and_slot ( epoch , slot ) slot in if i > 0 then None else if i = 0 then Some pk else ( Table . set last_checked_slot_and_epoch ~ key : pk ~ data ( : epoch , slot ) slot ; Some pk ) ) in match unseens with | [ ] -> ` All_seen | nel -> ` Unseen ( Public_key . Compressed . Set . of_list nel ) nel let evaluate ( { config ; slots_won ; block_producer_keys ; epoch_data = interrupt_ivar , epoch_data ; _ } as t ) : ( unit , unit ) unit Interruptible . t = match epoch_data with | None -> Interruptible . return ( ) | Some epoch_data -> let open Interruptible . Let_syntax in let % bind ( ) = Interruptible . lift Deferred . unit ( Ivar . read interrupt_ivar ) interrupt_ivar in let module Slot = Mina_numbers . Global_slot in let logger = config . logger in let epoch = epoch_data . epoch in [ % log info ] info " Starting VRF evaluation for epoch : $ epoch " ~ metadata [ : ( " epoch " , Epoch . to_yojson epoch ) epoch ] ; let keypairs = block_producer_keys in let logger = config . logger in let start_global_slot = epoch_data . global_slot in let start_global_slot_since_genesis = epoch_data . global_slot_since_genesis in let constants = config . consensus_constants in let delegatee_table = epoch_data . delegatee_table in let start_consensus_time = Consensus . Data . Consensus_time ( . of_global_slot ~ constants start_global_slot ) start_global_slot in let total_stake = epoch_data . epoch_ledger . total_currency in let evaluate_vrf ~ consensus_time = let slot = Consensus_time . slot consensus_time in let global_slot = Consensus_time . to_global_slot consensus_time in [ % log info ] info " Checking VRF evaluations for epoch : $ epoch , slot : $ slot " ~ metadata : [ ( " epoch " , ` Int ( Epoch . to_int epoch ) epoch ) epoch ; ( " slot " , ` Int ( Slot . to_int slot ) slot ) slot ] ; let rec go = function | [ ] -> Interruptible . return None | ( ( keypair : Keypair . t ) t , public_key_compressed ) public_key_compressed :: keypairs -> ( let global_slot_since_genesis = let slot_diff = match Global_slot . sub global_slot start_global_slot with | None -> failwith " Checking slot - winner for a slot which is older than \ the slot in the latest consensus state . System time \ might be out - of - sync " | Some diff -> diff in Global_slot . add start_global_slot_since_genesis slot_diff in [ % log info ] info " Checking VRF evaluations at epoch : $ epoch , slot : $ slot " ~ metadata : [ ( " epoch " , ` Int ( Epoch . to_int epoch ) epoch ) epoch ; ( " slot " , ` Int ( Slot . to_int slot ) slot ) slot ] ; match % bind Consensus . Data . Vrf . check ~ constraint_constants : config . constraint_constants ~ global_slot ~ seed : epoch_data . epoch_seed ~ get_delegators : ( Public_key . Compressed . Table . find delegatee_table ) delegatee_table ~ producer_private_key : keypair . private_key ~ producer_public_key : public_key_compressed ~ total_stake ~ logger with | None -> go keypairs | Some ( ` Vrf_eval _vrf_string , ` Vrf_output vrf_result , ` Delegator delegator ) -> [ % log info ] info " Won slot % d in epoch % d " ( Slot . to_int slot ) slot ( Epoch . to_int epoch ) epoch ; let slot_won = Consensus . Data . Slot_won . { delegator ; producer = keypair ; global_slot ; global_slot_since_genesis ; vrf_result } in Interruptible . return ( Some slot_won ) slot_won ) in go keypairs in let rec find_winning_slot ( consensus_time : Consensus_time . t ) t = let slot = Consensus_time . slot consensus_time in let global_slot = Consensus_time . to_global_slot consensus_time in t . current_slot <- Some global_slot ; let epoch ' = Consensus_time . epoch consensus_time in if Epoch ( . epoch ' > epoch ) epoch then ( t . current_slot <- None ; Interruptible . return ( ) ) else let start = Time . now ( ) in match % bind evaluate_vrf ~ consensus_time with | None -> [ % log info ] info " Did not win slot $ slot , took $ time ms " ~ metadata : [ ( " time " , ` Float Time ( . Span . to_ms ( diff ( now ( ) ) start ) start ) start ) start ; ( " slot " , Slot . to_yojson slot ) slot ] ; find_winning_slot ( Consensus_time . succ consensus_time ) consensus_time | Some slot_won -> [ % log info ] info " Won a slot $ slot , took $ time ms " ~ metadata : [ ( " time " , ` Float Time ( . Span . to_ms ( diff ( now ( ) ) start ) start ) start ) start ; ( " slot " , Slot . to_yojson slot ) slot ] ; Queue . enqueue slots_won slot_won ; find_winning_slot ( Consensus_time . succ consensus_time ) consensus_time in find_winning_slot start_consensus_time let create config = { config ; last_checked_slot_and_epoch = Public_key . Compressed . Table . create ( ) ; slots_won = Queue . create ~ capacity : ( Global_slot . to_int config . consensus_constants . slots_per_epoch ) slots_per_epoch ( ) ; current_slot = None ; epoch_data = ( Ivar . create ( ) , None ) None ; block_producer_keys = [ ] } end |
module Functions = struct type ( ' i , ' o ) ' o t = ' i Bin_prot . Type_class . t * ' o Bin_prot . Type_class . t * ( Worker_state . t -> ' i -> ' o Deferred . t ) t let create input output f : ( ' i , ' o ) ' o t = ( input , output , f ) f let set_new_epoch_state = create Consensus . Data . Epoch_data_for_vrf . Stable . Latest . bin_t Unit . bin_t ( fun w e -> let logger = w . config . logger in let update ( ) = [ % log info ] info " Updating epoch data for the VRF evaluation for epoch $ epoch " ~ metadata [ : ( " epoch " , Epoch . to_yojson e . epoch ) epoch ] ; let interrupt_ivar , _ = w . epoch_data in Ivar . fill_if_empty interrupt_ivar ( ) ; Queue . clear w . slots_won ; w . current_slot <- None ; w . epoch_data <- ( Ivar . create ( ) , Some e ) e ; Interruptible . don ' t_wait_for ( Worker_state . evaluate w ) w ; Deferred . unit in match w . epoch_data with | _ , None -> update ( ) | _ , Some current -> if Epoch ( . succ e . epoch > current . epoch ) epoch then update ( ) else ( [ % log info ] info " Received epoch data for current epoch $ epoch . Skipping " ~ metadata [ : ( " epoch " , Epoch . to_yojson e . epoch ) epoch ] ; Deferred . unit ) ) let slots_won_so_far = create Unit . bin_t Vrf_evaluation_result . Stable . Latest . bin_t ( fun w ( ) -> let slots_won = Queue . to_list w . slots_won in [ % log ' info w . config . logger ] logger " ! Slots won evaluator : { % sexp : Consensus . Data . Slot_won . t list } list " slots_won ; Queue . clear w . slots_won ; let evaluator_status = match w . current_slot with | Some slot -> Evaluator_status . At slot | None -> Completed in return Vrf_evaluation_result { . slots_won ; evaluator_status } ) let update_block_producer_keys = create Block_producer_keys . Stable . Latest . bin_t Unit . bin_t ( fun w e -> let logger = w . config . logger in [ % log info ] info " Updating block producer keys " ; w . block_producer_keys <- e ; Deferred . unit ) end |
module Worker = struct module T = struct type ' worker functions = { set_new_epoch_state : ( ' worker , Consensus . Data . Epoch_data_for_vrf . t , unit ) Rpc_parallel . Function . t ; slots_won_so_far : ( ' worker , unit , Vrf_evaluation_result . t ) t Rpc_parallel . Function . t ; update_block_producer_keys : ( ' worker , Block_producer_keys . t , unit ) unit Rpc_parallel . Function . t } module Worker_state = Worker_state module Connection_state = struct type init_arg = unit [ @@ deriving bin_io_unversioned ] bin_io_unversioned type t = unit end module Functions ( C : Rpc_parallel . Creator with type worker_state := Worker_state . t and type connection_state := Connection_state . t ) t = struct let functions = let f ( i , o , f ) f = C . create_rpc ~ f ( : fun ~ worker_state ~ conn_state : _ i -> f worker_state i ) i ~ bin_input : i ~ bin_output : o ( ) in let open Functions in { set_new_epoch_state = f set_new_epoch_state ; slots_won_so_far = f slots_won_so_far ; update_block_producer_keys = f update_block_producer_keys } let init_worker_state ( init_arg : Worker_state . init_arg ) init_arg = let logger = init_arg . logger in let max_size = 200 * 1024 * 1024 in let num_rotate = 1 in Logger . Consumer_registry . register ~ id " : default " ~ processor ( : Logger . Processor . raw ( ) ) ~ transport : ( Logger_file_system . dumb_logrotate ~ directory : init_arg . conf_dir ~ log_filename " : mina - vrf - evaluator . log " ~ max_size ~ num_rotate ) ; [ % log info ] info " Vrf_evaluator started " ; return ( Worker_state . create init_arg ) init_arg let init_connection_state ~ connection : _ ~ worker_state : _ = return end end include Rpc_parallel . Make ( T ) T end |
type t = { connection : Worker . Connection . t ; process : Process . t } |
let update_block_producer_keys { connection ; process = _ } ~ keypairs = Worker . Connection . run connection ~ f : Worker . functions . update_block_producer_keys ~ arg ( : Keypair . And_compressed_pk . Set . to_list keypairs ) keypairs |
let create ~ constraint_constants ~ pids ~ consensus_constants ~ conf_dir ~ logger ~ keypairs = let on_failure err = [ % log error ] error " VRF evaluator process failed with error $ err " ~ metadata [ : ( " err " , Error_json . error_to_yojson err ) err ] ; Error . raise err in [ % log info ] info " Starting a new vrf - evaluator process " ; let % bind connection , process = Worker . spawn_in_foreground_exn ~ connection_timeout ( : Time . Span . of_min 1 ) . ~ on_failure ~ shutdown_on : Connection_closed ~ connection_state_init_arg ( ) : { constraint_constants ; consensus_constants ; conf_dir ; logger } in [ % log info ] info " Daemon started process of kind $ process_kind with pid $ vrf_evaluator_pid " ~ metadata : [ ( " vrf_evaluator_pid " , ` Int ( Process . pid process |> Pid . to_int ) to_int ) to_int ; ( " process_kind " , ` String Child_processes . Termination ( . show_process_kind Vrf_evaluator ) Vrf_evaluator ) ] ; Child_processes . Termination . register_process pids process Child_processes . Termination . Vrf_evaluator ; don ' t_wait_for @@ Pipe . iter ( Process . stdout process |> Reader . pipe ) pipe ~ f ( : fun stdout -> return @@ [ % log debug ] debug " Vrf_evaluator stdout : $ stdout " ~ metadata [ : ( " stdout " , ` String stdout ) stdout ] ) ; don ' t_wait_for @@ Pipe . iter ( Process . stderr process |> Reader . pipe ) pipe ~ f ( : fun stderr -> return @@ [ % log error ] error " Vrf_evaluator stderr : $ stderr " ~ metadata [ : ( " stderr " , ` String stderr ) stderr ] ) ; let t = { connection ; process } in let % map _ = update_block_producer_keys ~ keypairs t in t |
let set_new_epoch_state { connection ; process = _ } ~ epoch_data_for_vrf = Worker . Connection . run connection ~ f : Worker . functions . set_new_epoch_state ~ arg : epoch_data_for_vrf |
let slots_won_so_far { connection ; process = _ } = Worker . Connection . run connection ~ f : Worker . functions . slots_won_so_far ~ arg ( ) : |
module Disposable = struct include Class . Make ( ) include [ % js : val from : ( t list [ @ js . variadic ] ) -> t [ @@ js . global " vscode . Disposable . from " ] val make : dispose ( : unit -> unit ) -> t [ @@ js . new " vscode . Disposable " ] val dispose : t -> unit [ @@ js . call ] ] end |
module Command = struct include Interface . Make ( ) include [ % js : val title : t -> string [ @@ js . get ] val command : t -> string [ @@ js . get ] val tooltip : t -> string or_undefined [ @@ js . get ] val arguments : t -> Js . Any . t maybe_list [ @@ js . get ] val create : title : string -> command : string -> ? tooltip : string -> ? arguments : Js . Any . t list -> unit -> t [ @@ js . builder ] ] end |
module Position = struct include Class . Make ( ) include [ % js : val line : t -> int [ @@ js . get ] val character : t -> int [ @@ js . get ] val make : line : int -> character : int -> t [ @@ js . new " vscode . Position " ] val isBefore : t -> other : t -> bool [ @@ js . call ] val isBeforeOrEqual : t -> other : t -> bool [ @@ js . call ] val isAfter : t -> other : t -> bool [ @@ js . call ] val isAfterOrEqual : t -> other : t -> bool [ @@ js . call ] val isEqual : t -> other : t -> bool [ @@ js . call ] val compareTo : t -> other : t -> int [ @@ js . call ] val translate : t -> ? lineDelta : int -> ? characterDelta : int -> unit -> t [ @@ js . call ] val with_ : t -> ? line : int -> ? character : int -> unit -> t [ @@ js . call ] ] end |
module Range = struct include Class . Make ( ) include [ % js : val start : t -> Position . t [ @@ js . get ] val end_ : t -> Position . t [ @@ js . get ] val makePositions : start : Position . t -> end_ : Position . t -> t [ @@ js . new " vscode . Range " ] val makeCoordinates : startLine : int -> startCharacter : int -> endLine : int -> endCharacter : int -> t [ @@ js . new " vscode . Range " ] val isEmpty : t -> bool [ @@ js . get ] val isSingleLine : t -> bool [ @@ js . get ] val contains : t -> positionOrRange ( [ : ` Position of Position . t | ` Range of t ] [ @ js . union ] ) -> bool [ @@ js . call ] val isEqual : t -> other : t -> bool [ @@ js . call ] val intersection : t -> range : t -> t or_undefined [ @@ js . call ] val union : t -> other : t -> t [ @@ js . call ] val with_ : t -> ? start : Position . t -> ? end_ : Position . t -> unit -> t [ @@ js . call ] ] end |
module TextLine = struct include Interface . Make ( ) include [ % js : val lineNumber : t -> int [ @@ js . get ] val text : t -> string [ @@ js . get ] val range : t -> Range . t [ @@ js . get ] val rangeIncludingLineBreak : t -> Range . t [ @@ js . get ] val firstNonWhitespaceCharacterIndex : t -> int [ @@ js . get ] val isEmptyOrWhitespace : t -> bool [ @@ js . get ] val create : lineNumber : int -> text : string -> range : Range . t -> rangeIncludingLineBreak : Range . t -> firstNonWhitespaceCharacterIndex : int -> isEmptyOrWhitespace : bool -> t [ @@ js . builder ] ] end |
module EndOfLine = struct type t = | CRLF [ @ js 2 ] | LF [ @ js 1 ] [ @@ js . enum ] [ @@ js ] end |
module TextEdit = struct include Class . Make ( ) include [ % js : val replace : range : Range . t -> newText : string -> t [ @@ js . global " vscode . TextEdit . replace " ] val insert : position : Position . t -> newText : string -> t [ @@ js . global " vscode . TextEdit . insert " ] val delete : Range . t -> t [ @@ js . global " vscode . TextEdit . delete " ] val setEndOfLine : EndOfLine . t -> t [ @@ js . global " vscode . TextEdit . setEndOfLine " ] val range : t -> Range . t [ @@ js . get ] val newText : t -> string [ @@ js . get ] val newEol : t -> EndOfLine . t or_undefined [ @@ js . get ] val make : range : Range . t -> newText : string -> t [ @@ js . new " vscode . TextEdit " ] ] end |
module Uri = struct include Class . Make ( ) module Scheme = struct type t = [ ` File | ` Untitled ] let to_string = function | ` File -> " file " | ` Untitled -> " untitled " end include [ % js : val parse : string -> ? strict : bool -> unit -> t [ @@ js . global " vscode . Uri . parse " ] val file : string -> t [ @@ js . global " vscode . Uri . file " ] val joinPath : t -> pathSegments ( : string list [ @ js . variadic ] ) -> t [ @@ js . global " vscode . Uri . joinPath " ] val scheme : t -> string [ @@ js . get ] val authority : t -> string [ @@ js . get ] val path : t -> string [ @@ js . get ] val query : t -> string [ @@ js . get ] val fragment : t -> string [ @@ js . get ] val fsPath : t -> string [ @@ js . get ] val with_ : t -> Ojs . t -> t [ @@ js . call ] val toString : t -> ? skipEncoding : bool -> unit -> string [ @@ js . call ] val toJson : t -> Jsonoo . t [ @@ js . call ] ] let with_ this ? scheme ? authority ? path ? query ? fragment ( ) = let change = Ojs . obj [ ] || in iter_set change " scheme " [ % js . of : string ] ( Option . map Scheme . to_string scheme ) ; iter_set change " authority " [ % js . of : string ] authority ; iter_set change " path " [ % js . of : string ] path ; iter_set change " query " [ % js . of : string ] query ; iter_set change " fragment " [ % js . of : string ] fragment ; with_ this change let equal a b = String . equal ( toString a ( ) ) ( toString b ( ) ) end |
module TextDocument = struct include Interface . Make ( ) include [ % js : val uri : t -> Uri . t [ @@ js . get ] val fileName : t -> string [ @@ js . get ] val isUntitled : t -> bool [ @@ js . get ] val languageId : t -> string [ @@ js . get ] val version : t -> int [ @@ js . get ] val isDirty : t -> bool [ @@ js . get ] val isClosed : t -> bool [ @@ js . get ] val save : t -> bool Promise . t [ @@ js . call ] val eol : t -> EndOfLine . t [ @@ js . get ] val lineCount : t -> int [ @@ js . get ] val lineAt : t -> line : int -> TextLine . t [ @@ js . call ] val lineAtPosition : t -> position : Position . t -> TextLine . t [ @@ js . call " lineAt " ] val offsetAt : t -> position : Position . t -> int [ @@ js . call ] val positionAt : t -> offset : int -> Position . t [ @@ js . call ] val getText : t -> ? range : Range . t -> unit -> string [ @@ js . call ] val getWordRangeAtPosition : t -> position : Position . t -> ? regex : Regexp . t -> unit -> Range . t or_undefined [ @@ js . call ] val validateRange : t -> range : Range . t -> Range . t [ @@ js . call ] val validatePosition : t -> position : Position . t -> Position . t [ @@ js . call ] ] end |
module WorkspaceFolder = struct include Interface . Make ( ) include [ % js : val uri : t -> Uri . t [ @@ js . get ] val name : t -> string [ @@ js . get ] val index : t -> int [ @@ js . get ] val create : uri : Uri . t -> name : string -> index : int -> t [ @@ js . builder ] ] end |
module ViewColumn = struct type t = | Active [ @ js - 1 ] | Beside [ @ js - 2 ] | One [ @ js 1 ] | Two [ @ js 2 ] | Three [ @ js 3 ] | Four [ @ js 4 ] | Five [ @ js 5 ] | Six [ @ js 6 ] | Seven [ @ js 7 ] | Eight [ @ js 8 ] | Nine [ @ js 9 ] [ @@ js . enum ] [ @@ js ] end |
module Selection = struct include Class . Extend ( Range ) ( ) include Range include [ % js : val anchor : t -> Position . t [ @@ js . get ] val active : t -> Position . t [ @@ js . get ] val makePositions : anchor : Position . t -> active : Position . t -> t [ @@ js . new " vscode . Selection " ] val makeCoordinates : anchorLine : int -> anchorCharacter : int -> activeLine : int -> activeCharacter : int -> t [ @@ js . new " vscode . Selection " ] val isReversed : t -> bool [ @@ js . get ] ] end |
module TextEditorEdit = struct include Interface . Make ( ) type replaceLocation = ( [ ` Position of Position . t | ` Range of Range . t | ` Selection of Selection . t ] [ @ js . union ] ) [ @@ js ] let replaceLocation_of_js js_val = if Ojs . has_property js_val " anchor " then ` Position ( [ % js . to : Position . t ] js_val ) else if Ojs . has_property js_val " start " then ` Range ( [ % js . to : Range . t ] js_val ) else ` Selection ( [ % js . to : Selection . t ] js_val ) type deleteLocation = ( [ ` Range of Range . t | ` Selection of Selection . t ] [ @ js . union ] ) [ @@ js ] let deleteLocation_of_js js_val = if Ojs . has_property js_val " anchor " then ` Selection ( [ % js . to : Selection . t ] js_val ) else ` Range ( [ % js . to : Range . t ] js_val ) include [ % js : val replace : t -> location : replaceLocation -> value : string -> unit [ @@ js . call ] val insert : t -> location : Position . t -> value : string -> unit [ @@ js . call ] val delete : t -> location : deleteLocation -> unit [ @@ js . call ] val setEndOfLine : t -> endOfLine : EndOfLine . t -> t [ @@ js . call ] val create : replace ( : location : replaceLocation -> value : string -> unit ) -> insert ( : location : Position . t -> value : string -> unit ) -> delete ( : location : deleteLocation -> unit ) -> setEndOfLine ( : endOfLine : EndOfLine . t -> t ) -> t [ @@ js . builder ] ] end |
module TextEditorCursorStyle = struct type t = | Line [ @ js 1 ] | Block [ @ js 2 ] | Underline [ @ js 3 ] | LineThin [ @ js 4 ] | BlockOutline [ @ js 5 ] | UnderlineThin [ @ js 6 ] [ @@ js . enum ] [ @@ js ] end |
module TextEditorLineNumbersStyle = struct type t = | Off [ @ js 0 ] | On [ @ js 1 ] | Relative [ @ js 2 ] [ @@ js . enum ] [ @@ js ] end |
module TextEditorRevealType = struct type t = | Default [ @ js 0 ] | InCenter [ @ js 1 ] | InCenterIfOutsideViewport [ @ js 2 ] | AtTop [ @ js 3 ] [ @@ js . enum ] [ @@ js ] end |
module TextEditorOptions = struct include Interface . Make ( ) type tabSize = ( [ ` Int of int | ` String of string ] [ @ js . union ] ) [ @@ js ] let tabSize_of_js js_val = match Ojs . type_of js_val with | " number " -> ` Int ( [ % js . to : int ] js_val ) | " string " -> ` String ( [ % js . to : string ] js_val ) | _ -> assert false type insertSpaces = ( [ ` Bool of bool | ` String of string ] [ @ js . union ] ) [ @@ js ] let insertSpaces_of_js js_val = match Ojs . type_of js_val with | " boolean " -> ` Bool ( [ % js . to : bool ] js_val ) | " string " -> ` String ( [ % js . to : string ] js_val ) | _ -> assert false include [ % js : val tabSize : t -> tabSize or_undefined [ @@ js . get ] val insertSpaces : t -> insertSpaces or_undefined [ @@ js . get ] val cursorStyle : t -> TextEditorCursorStyle . t or_undefined [ @@ js . get ] val lineNumbers : t -> TextEditorLineNumbersStyle . t or_undefined [ @@ js . get ] val create : ? tabSize : tabSize -> ? insertSpaces : insertSpaces -> ? cursorStyle : TextEditorCursorStyle . t -> ? lineNumbers : TextEditorLineNumbersStyle . t -> unit -> t [ @@ js . builder ] ] end |
module TextEditorDecorationType = struct include Interface . Make ( ) include [ % js : val key : t -> string [ @@ js . get ] val dispose : t -> unit [ @@ js . call ] val create : key : string -> dispose ( : unit -> unit ) -> t [ @@ js . builder ] ] let disposable this = Disposable . make ~ dispose ( : fun ( ) -> dispose this ) end |
module MarkdownString = struct include Class . Make ( ) include [ % js : val value : t -> string [ @@ js . get ] val isTrusted : t -> bool or_undefined [ @@ js . get ] val supportThemeIcons : t -> bool or_undefined [ @@ js . get ] val make : ? value : string -> ? supportThemeIcons : bool -> unit -> t [ @@ js . new " vscode . MarkdownString " ] val appendText : t -> value : string -> t [ @@ js . call ] val appendMarkdown : t -> value : string -> t [ @@ js . call ] val appendCodeblock : t -> value : string -> ? language : string -> unit -> t [ @@ js . call ] ] end |
module ThemeColor = struct include Class . Make ( ) include [ % js : val make : id : string -> t [ @@ js . new " vscode . ThemeColor " ] ] end |
module ThemableDecorationAttachmentRenderOptions = struct include Interface . Make ( ) type contentIconPath = ( [ ` String of string | ` Uri of Uri . t ] [ @ js . union ] ) [ @@ js ] let contentIconPath_of_js js_val = match Ojs . type_of js_val with | " string " -> ` String ( [ % js . to : string ] js_val ) | _ -> ` Uri ( [ % js . to : Uri . t ] js_val ) type color = ( [ ` String of string | ` ThemeColor of ThemeColor . t ] [ @ js . union ] ) [ @@ js ] let color_of_js js_val = match Ojs . type_of js_val with | " string " -> ` String ( [ % js . to : string ] js_val ) | _ -> ` ThemeColor ( [ % js . to : ThemeColor . t ] js_val ) include [ % js : val contentText : t -> string or_undefined [ @@ js . get ] val contentIconPath : t -> contentIconPath or_undefined [ @@ js . get ] val border : t -> string or_undefined [ @@ js . get ] val borderColor : t -> color or_undefined [ @@ js . get ] val fontStyle : t -> string or_undefined [ @@ js . get ] val fontWeight : t -> string or_undefined [ @@ js . get ] val textDecoration : t -> string or_undefined [ @@ js . get ] val color : t -> color or_undefined [ @@ js . get ] val backgroundColor : t -> color or_undefined [ @@ js . get ] val margin : t -> string or_undefined [ @@ js . get ] val width : t -> string or_undefined [ @@ js . get ] val height : t -> string or_undefined [ @@ js . get ] val create : ? contentText : string -> ? contentIconPath : contentIconPath -> ? border : string -> ? borderColor : color -> ? fontStyle : string -> ? fontWeight : string -> ? textDecoration : string -> ? color : color -> ? backgroundColor : color -> ? margin : string -> ? width : string -> ? height : string -> unit -> t [ @@ js . builder ] ] end |
module ThemableDecorationInstanceRenderOptions = struct include Interface . Make ( ) include [ % js : val before : t -> ThemableDecorationAttachmentRenderOptions . t or_undefined [ @@ js . get ] val after : t -> ThemableDecorationAttachmentRenderOptions . t or_undefined [ @@ js . get ] val create : ? before : ThemableDecorationAttachmentRenderOptions . t -> ? after : ThemableDecorationAttachmentRenderOptions . t -> unit -> t [ @@ js . builder ] ] end |
module DecorationInstanceRenderOptions = struct include Interface . Make ( ) include [ % js : val light : t -> ThemableDecorationInstanceRenderOptions . t or_undefined [ @@ js . get ] val dark : t -> ThemableDecorationInstanceRenderOptions . t or_undefined [ @@ js . get ] val create : ? light : ThemableDecorationInstanceRenderOptions . t -> ? dark : ThemableDecorationInstanceRenderOptions . t -> unit -> t [ @@ js . builder ] ] end |
module DecorationOptions = struct include Interface . Make ( ) type hoverMessage = ( [ ` MarkdownString of MarkdownString . t | ` MarkdownStrings of MarkdownString . t list ] [ @ js . union ] ) [ @@ js ] let hoverMessage_of_js js_val = if Ojs . has_property js_val " value " then ` MarkdownString ( [ % js . to : MarkdownString . t ] js_val ) else ` MarkdownStrings ( [ % js . to : MarkdownString . t list ] js_val ) include [ % js : val range : t -> Range . t [ @@ js . get ] val hoverMessage : t -> hoverMessage or_undefined [ @@ js . get ] val renderOptions : t -> DecorationInstanceRenderOptions . t or_undefined [ @@ js . get ] val create : range : Range . t -> ? hoverMessage : hoverMessage -> ? renderOptions : DecorationInstanceRenderOptions . t or_undefined -> unit -> t [ @@ js . builder ] ] end |
module SnippetString = struct include Class . Make ( ) include [ % js : val value : t -> string [ @@ js . get ] val make : ? value : string -> unit -> t [ @@ js . new " vscode . SnippetString " ] val appendText : t -> string : string -> t [ @@ js . call ] val appendTabStop : t -> number : int -> t [ @@ js . call ] val appendPlaceHolder : t -> value ( [ : ` String of string | ` Function of t -> unit ] [ @ js . union ] ) -> ? number : int -> unit -> t [ @@ js . call ] val appendChoice : t -> values : string list -> ? number : int -> unit -> t [ @@ js . call ] val appendVariable : t -> name : string -> defaultValue : ( [ ` String of string | ` Function of t -> unit ] [ @ js . union ] ) -> t [ @@ js . call ] ] end |
module TextEditor = struct include Interface . Make ( ) type insertSnippetLocation = ( [ ` Position of Position . t | ` Range of Range . t | ` Positions of Position . t list | ` Ranges of Range . t list ] [ @ js . union ] ) [ @@ js ] include [ % js : val document : t -> TextDocument . t [ @@ js . get ] val selection : t -> Selection . t [ @@ js . get ] val set_selection : t -> Selection . t -> unit [ @@ js . set " selection " ] val selections : t -> Selection . t list [ @@ js . get ] val visibleRanges : t -> Range . t list [ @@ js . get ] val options : t -> TextEditorOptions . t [ @@ js . get ] val viewColumn : t -> ViewColumn . t or_undefined [ @@ js . get ] val edit : t -> callback ( : editBuilder : TextEditorEdit . t -> unit ) -> Ojs . t -> unit -> bool Promise . t [ @@ js . call ] val insertSnippet : t -> snippet : SnippetString . t -> ? location : insertSnippetLocation -> Ojs . t -> bool Promise . t [ @@ js . call ] val setDecorations : t -> decorationType : TextEditorDecorationType . t -> rangesOrOptions : ( [ ` Ranges of Range . t list | ` Options of DecorationOptions . t list ] [ @ js . union ] ) -> unit [ @@ js . call ] val revealRange : t -> range : Range . t -> ? revealType : TextEditorRevealType . t -> unit -> unit [ @@ js . call ] ] let edit this ~ callback ? undoStopBefore ? undoStopAfter ( ) = let options = Ojs . obj [ ] || in iter_set options " undoStopBefore " [ % js . of : bool ] undoStopBefore ; iter_set options " undoStopAfter " [ % js . of : bool ] undoStopAfter ; edit this ~ callback options ( ) let insertSnippet this ~ snippet ? location ? undoStopBefore ? undoStopAfter ( ) = let options = Ojs . obj [ ] || in iter_set options " undoStopBefore " [ % js . of : bool ] undoStopBefore ; iter_set options " undoStopAfter " [ % js . of : bool ] undoStopAfter ; insertSnippet this ~ snippet ? location options end |
module ConfigurationTarget = struct type t = | Global [ @ js 1 ] | Workspace [ @ js 2 ] | WorkspaceFolder [ @ js 3 ] [ @@ js . enum ] [ @@ js ] end |
module WorkspaceConfiguration = struct include Interface . Make ( ) type ' a inspectResult = { key : string ; defaultValue : ' a or_undefined ; globalValue : ' a or_undefined ; workspaceValue : ' a or_undefined ; workspaceFolderValue : ' a or_undefined ; defaultLanguageValue : ' a or_undefined ; globalLanguageValue : ' a or_undefined ; workspaceLanguageValue : ' a or_undefined ; workspaceFolderLanguageValue : ' a or_undefined ; languageIds : string list or_undefined } let inspectResult_of_js ( type t ) t_of_js js_val : t inspectResult = let field = Ojs . get_prop_ascii js_val in { key = [ % js . to : string ] ( field " key " ) ; defaultValue = [ % js . to : t or_undefined ] ( field " defaultValue " ) ; globalValue = [ % js . to : t or_undefined ] ( field " globalValue " ) ; workspaceValue = [ % js . to : t or_undefined ] ( field " workspaceValue " ) ; workspaceFolderValue = [ % js . to : t or_undefined ] ( field " workspaceFolderValue " ) ; defaultLanguageValue = [ % js . to : t or_undefined ] ( field " defaultLanguageValue " ) ; globalLanguageValue = [ % js . to : t or_undefined ] ( field " globalLanguageValue " ) ; workspaceLanguageValue = [ % js . to : t or_undefined ] ( field " workspaceLanguageValue " ) ; workspaceFolderLanguageValue = [ % js . to : t or_undefined ] ( field " workspaceFolderLanguageValue " ) ; languageIds = [ % js . to : string list or_undefined ] ( field " languageIds " ) } include [ % js : val get : t -> section : string -> Js . Any . t or_undefined [ @@ js . call ] val get_default : t -> section : string -> defaultValue : Ojs . t -> Ojs . t [ @@ js . call ] val has : t -> section : string -> bool [ @@ js . call ] val inspect : t -> section : string -> Ojs . t [ @@ js . call ] val update : t -> section : string -> value : Js . Any . t -> ? configurationTarget : ( [ ` ConfigurationTarget of ConfigurationTarget . t | ` Bool of bool ] [ @ js . union ] ) -> ? overrideInLanguage : bool -> unit -> Promise . void [ @@ js . call ] ] let inspect ( type a ) ( module T : Js . T with type t = a ) this ~ section : a inspectResult or_undefined = [ % js . to : T . t inspectResult or_undefined ] ( inspect this ~ section ) let get_default ( type a ) ( module T : Js . T with type t = a ) this ~ section ( ~ defaultValue : a ) : a = let defaultValue = [ % js . of : T . t ] defaultValue in [ % js . to : T . t ] ( get_default this ~ section ~ defaultValue ) end |
module WorkspaceEdit = struct include Class . Make ( ) include [ % js : val size : t -> int [ @@ js . get ] val replace : t -> uri : Uri . t -> range : Range . t -> newText : string -> unit [ @@ js . call ] val make : unit -> t [ @@ js . new " vscode . WorkspaceEdit " ] ] end |
module StatusBarAlignment = struct type t = | Left [ @ js 1 ] | Right [ @ js 2 ] [ @@ js . enum ] [ @@ js ] end |
module AccessibilityInformation = struct include Interface . Make ( ) include [ % js : val label : t -> string [ @@ js . get ] val role : t -> string or_undefined [ @@ js . get ] val create : label : string -> ? role : string -> unit -> t [ @@ js . builder ] ] end |
module StatusBarItem = struct include Interface . Make ( ) type color = ( [ ` String of string | ` ThemeColor of ThemeColor . t ] [ @ js . union ] ) [ @@ js ] let color_of_js js_val = match Ojs . type_of js_val with | " string " -> ` String ( [ % js . to : string ] js_val ) | _ -> ` ThemeColor ( [ % js . to : ThemeColor . t ] js_val ) type command = ( [ ` String of string | ` Command of Command . t ] [ @ js . union ] ) [ @@ js ] let command_of_js js_val = match Ojs . type_of js_val with | " string " -> ` String ( [ % js . to : string ] js_val ) | _ -> ` Command ( [ % js . to : Command . t ] js_val ) include [ % js : val alignment : t -> StatusBarAlignment . t [ @@ js . get ] val priority : t -> int or_undefined [ @@ js . get ] val text : t -> string [ @@ js . get ] val tooltip : t -> string or_undefined [ @@ js . get ] val color : t -> color or_undefined [ @@ js . get ] val backgroundColor : t -> ThemeColor . t or_undefined [ @@ js . get ] val command : t -> command or_undefined [ @@ js . get ] val accessibilityInformation : t -> AccessibilityInformation . t or_undefined [ @@ js . get ] val set_alignment : t -> StatusBarAlignment . t -> unit [ @@ js . set " alignment " ] val set_priority : t -> int -> unit [ @@ js . set ] val set_text : t -> string -> unit [ @@ js . set ] val set_tooltip : t -> string -> unit [ @@ js . set ] val set_color : t -> color -> unit [ @@ js . set ] val set_backgroundColor : t -> ThemeColor . t -> unit [ @@ js . set ] val set_command : t -> command -> unit [ @@ js . set ] val set_accessibilityInformation : t -> AccessibilityInformation . t -> unit [ @@ js . set ] val show : t -> unit [ @@ js . call ] val hide : t -> unit [ @@ js . call ] val dispose : t -> unit [ @@ js . call ] ] let disposable this = Disposable . make ~ dispose ( : fun ( ) -> dispose this ) end |
module WorkspaceFoldersChangeEvent = struct include Interface . Make ( ) include [ % js : val added : t -> WorkspaceFolder . t list [ @@ js . get ] val removed : t -> WorkspaceFolder . t list [ @@ js . get ] val create : added : WorkspaceFolder . t list -> removed : WorkspaceFolder . t list -> t [ @@ js . builder ] ] end |
module FormattingOptions = struct include Interface . Make ( ) include [ % js : val tabSize : t -> int [ @@ js . get ] val insertSpaces : t -> bool [ @@ js . get ] val create : tabSize : int -> insertSpaces : bool -> t [ @@ js . builder ] ] end |
module Event = struct type ' a t = listener ( ' : a -> unit ) -> ? thisArgs : Js . Any . t -> ? disposables : Disposable . t list -> unit -> Disposable . t module Make ( T : Js . T ) = struct type t = listener ( : T . t -> unit ) -> ? thisArgs : Js . Any . t -> ? disposables : Disposable . t list -> unit -> Disposable . t [ @@ js ] end end |
module EventEmitter = struct include Class . Generic ( Ojs ) ( ) module Make ( T : Js . T ) = struct type t = T . t generic [ @@ js ] module Event = Event . Make ( T ) include [ % js : val make : unit -> t [ @@ js . new " vscode . EventEmitter " ] val event : t -> Event . t [ @@ js . get ] val fire : t -> T . t -> unit [ @@ js . call ] val dispose : t -> unit -> unit [ @@ js . call ] ] end end |
module CancellationToken = struct include Interface . Make ( ) module OnCancellationRequested = Event . Make ( Js . Any ) include [ % js : val isCancellationRequested : t -> bool [ @@ js . get ] val onCancellationRequested : t -> OnCancellationRequested . t [ @@ js . get ] val create : isCancellationRequested : bool -> onCancellationRequested : OnCancellationRequested . t -> t [ @@ js . builder ] ] end |
module QuickPickItem = struct include Interface . Make ( ) include [ % js : val label : t -> string [ @@ js . get ] val description : t -> string or_undefined [ @@ js . get ] val detail : t -> string or_undefined [ @@ js . get ] val picked : t -> bool or_undefined [ @@ js . get ] val alwaysShow : t -> bool or_undefined [ @@ js . get ] val create : label : string -> ? description : string -> ? detail : string -> ? picked : bool -> ? alwaysShow : bool -> unit -> t [ @@ js . builder ] ] end |
module QuickPickOptions = struct include Interface . Make ( ) type onDidSelectItemArgs = ( [ ` QuickPickItem of QuickPickItem . t | ` String of string ] [ @ js . union ] ) [ @@ js ] let onDidSelectItemArgs_of_js js_val = match Ojs . type_of js_val with | " string " -> ` String ( [ % js . to : string ] js_val ) | _ -> ` QuickPickItem ( [ % js . to : QuickPickItem . t ] js_val ) include [ % js : val title : t -> string or_undefined [ @@ js . get ] val matchOnDescription : t -> bool or_undefined [ @@ js . get ] val matchOnDetail : t -> bool or_undefined [ @@ js . get ] val placeHolder : t -> string or_undefined [ @@ js . get ] val ignoreFocusOut : t -> bool or_undefined [ @@ js . get ] val canPickMany : t -> bool or_undefined [ @@ js . get ] val onDidSelectItem : t -> ( onDidSelectItemArgs -> unit ) or_undefined [ @@ js . get ] val create : ? title : string -> ? matchOnDescription : bool -> ? matchOnDetail : bool -> ? placeHolder : string -> ? ignoreFocusOut : bool -> ? canPickMany : bool -> ? onDidSelectItem ( : item : onDidSelectItemArgs -> unit ) -> unit -> t [ @@ js . builder ] ] end |
module ProviderResult = struct type ' a t = [ ` Value of ' a or_undefined | ` Promise of ' a or_undefined Promise . t ] let t_to_js ml_to_js = function | ` Value v -> or_undefined_to_js ml_to_js v | ` Promise p -> Promise . t_to_js ( or_undefined_to_js ml_to_js ) p let t_of_js ml_of_js js_val = if Ojs . has_property js_val " then " then ` Promise ( Promise . t_of_js ( or_undefined_of_js ml_of_js ) js_val ) else ` Value ( or_undefined_of_js ml_of_js js_val ) end |
module InputBoxOptions = struct include Interface . Make ( ) include [ % js : val title : t -> string or_undefined [ @@ js . get ] val value : t -> string or_undefined [ @@ js . get ] val valueSelection : t -> ( int * int ) or_undefined [ @@ js . get ] val prompt : t -> string or_undefined [ @@ js . get ] val placeHolder : t -> string or_undefined [ @@ js . get ] val password : t -> bool or_undefined [ @@ js . get ] val ignoreFocusOut : t -> bool or_undefined [ @@ js . get ] val validateInput : t -> ( string -> string ProviderResult . t ) or_undefined [ @@ js . get ] val create : ? title : string -> ? value : string -> ? valueSelection : int * int -> ? prompt : string -> ? placeHolder : string -> ? password : bool -> ? ignoreFocusOut : bool -> ? validateInput ( : value : string -> string option Promise . t ) -> unit -> t [ @@ js . builder ] ] end |
module MessageItem = struct include Interface . Make ( ) include [ % js : val title : t -> string [ @@ js . get ] val isCloseAffordance : t -> bool or_undefined [ @@ js . get ] val create : title : string -> ? isCloseAffordance : bool -> unit -> t [ @@ js . builder ] ] end |
module Location = struct include Class . Make ( ) include [ % js : val uri : t -> Uri . t [ @@ js . get ] val range : t -> Range . t [ @@ js . get ] val make : uri : Uri . t -> rangeOrPosition : ( [ ` Range of Range . t | ` Position of Position . t ] [ @ js . union ] ) -> t [ @@ js . new " vscode . Location " ] ] end |
module ProgressLocation = struct type t = | SourceControl [ @ js 1 ] | Window [ @ js 10 ] | Notification [ @ js 15 ] [ @@ js . enum ] [ @@ js ] end |
module ProgressOptions = struct include Interface . Make ( ) type viewIdLocation = { viewId : string } [ @@ js ] type location = ( [ ` ProgressLocation of ProgressLocation . t | ` ViewIdLocation of viewIdLocation ] [ @ js . union ] ) [ @@ js ] let location_of_js js_val = match Ojs . type_of js_val with | " number " -> ` ProgressLocation ( [ % js . to : ProgressLocation . t ] js_val ) | _ -> ` ViewIdLocation ( [ % js . to : viewIdLocation ] js_val ) include [ % js : val location : t -> location [ @@ js . get ] val title : t -> string or_undefined [ @@ js . get ] val cancellable : t -> bool or_undefined [ @@ js . get ] val create : location : location -> ? title : string -> ? cancellable : bool -> unit -> t [ @@ js . builder ] ] end |
module DiagnosticSeverity = struct type t = | Error [ @ js 0 ] | Hint [ @ js 1 ] | Information [ @ js 2 ] | Warning [ @ js 3 ] [ @@ js . enum ] [ @@ js ] end |
module DiagnosticRelatedInformation = struct include Class . Make ( ) include [ % js : val location : t -> Location . t [ @@ js . get ] val message : t -> string [ @@ js . get ] val make : location : Location . t -> message : string -> t [ @@ js . new " vscode . DiagnosticRelatedInformation " ] ] end |
module DiagnosticTag = struct type t = | Unnecessary [ @ js 1 ] | Deprecated [ @ js 2 ] [ @@ js . enum ] [ @@ js ] end |
module Diagnostic = struct include Class . Make ( ) type string_or_int = ( [ ` String of string | ` Int of int ] [ @ js . union ] ) [ @@ js ] let string_or_int_of_js js_val = match Ojs . type_of js_val with | " string " -> ` String ( [ % js . to : string ] js_val ) | " number " -> ` Int ( [ % js . to : int ] js_val ) | _ -> assert false type code_target = { value : string_or_int ; target : Uri . t } [ @@ js ] type code = ( [ ` String of string | ` Int of int | ` Targeted of code_target ] [ @ js . union ] ) [ @@ js ] let code_of_js js_val = match Ojs . type_of js_val with | " object " -> ` Targeted ( [ % js . to : code_target ] js_val ) | _ -> string_or_int_of_js js_val include [ % js : val message : t -> string [ @@ js . get ] val range : t -> Range . t [ @@ js . get ] val severity : t -> DiagnosticSeverity . t [ @@ js . get ] val source : t -> string or_undefined [ @@ js . get ] val code : t -> code or_undefined [ @@ js . get ] val relatedInformation : t -> DiagnosticRelatedInformation . t list or_undefined [ @@ js . get ] val tags : t -> DiagnosticTag . t list or_undefined [ @@ js . get ] val make : range : Range . t -> message : string -> ? severity : DiagnosticSeverity . t -> unit -> t [ @@ js . new " vscode . Diagnostic " ] ] let make ? severity ~ message range = make ~ range ~ message ? severity ( ) end |
module TextDocumentShowOptions = struct include Interface . Make ( ) include [ % js : val viewColumn : t -> ViewColumn . t or_undefined [ @@ js . get ] val preserveFocus : t -> bool or_undefined [ @@ js . get ] val preview : t -> bool or_undefined [ @@ js . get ] val selection : t -> Range . t or_undefined [ @@ js . get ] val create : viewColumn : ViewColumn . t -> ? preserveFocus : bool -> ? preview : bool -> ? selection : Range . t -> unit -> t [ @@ js . builder ] ] end |
module TerminalOptions = struct include Interface . Make ( ) type shellArgs = ( [ ` Arg of string | ` Args of string list ] [ @ js . union ] ) [ @@ js ] let shellArgs_of_js js_val = match Ojs . type_of js_val with | " string " -> ` Arg ( [ % js . to : string ] js_val ) | _ -> ` Args ( [ % js . to : string list ] js_val ) type cwd = ( [ ` String of string | ` Uri of Uri . t ] [ @ js . union ] ) [ @@ js ] let cwd_of_js js_val = match Ojs . type_of js_val with | " string " -> ` String ( [ % js . to : string ] js_val ) | _ -> ` Uri ( [ % js . to : Uri . t ] js_val ) include [ % js : val name : t -> string or_undefined [ @@ js . get ] val shellPath : t -> string or_undefined [ @@ js . get ] val shellArgs : t -> shellArgs or_undefined [ @@ js . get ] val cwd : t -> cwd or_undefined [ @@ js . get ] val env : t -> string or_undefined Dict . t or_undefined [ @@ js . get ] val strictEnv : t -> bool [ @@ js . get ] val hideFromUser : t -> bool [ @@ js . get ] ] end |
module TerminalDimensions = struct include Interface . Make ( ) include [ % js : val columns : t -> int [ @@ js . get ] val rows : t -> int [ @@ js . get ] val create : columns : int -> rows : int -> t [ @@ js . builder ] ] end |
module Pseudoterminal = struct include Interface . Make ( ) module OnDidWrite = Event . Make ( Js . String ) module OnDidOverrideDimensions = Event . Make ( Js . Or_undefined ( TerminalDimensions ) ) module OnDidClose = Event . Make ( Js . Or_undefined ( Js . Int ) ) include [ % js : val onDidWrite : t -> OnDidWrite . t [ @@ js . get ] val onDidOverrideDimensions : t -> OnDidOverrideDimensions . t or_undefined [ @@ js . get ] val onDidClose : t -> OnDidClose . t or_undefined [ @@ js . get ] val open_ : t -> ? initialDimensions : TerminalDimensions . t -> unit -> unit [ @@ js . call ] val close : t -> unit [ @@ js . call ] val handleInput : t -> ( data : string -> unit ) or_undefined [ @@ js . get ] val setDimensions : t -> ( dimensions : TerminalDimensions . t -> unit ) or_undefined [ @@ js . get ] val create : onDidWrite : OnDidWrite . t -> ? onDidOverrideDimensions : OnDidOverrideDimensions . t -> ? onDidClose : OnDidClose . t -> open_ ( :? initialDimensions : TerminalDimensions . t -> unit -> unit ) -> close ( : unit -> unit ) -> ? handleInput ( : data : string -> unit ) -> ? setDimensions ( : dimensions : TerminalDimensions . t -> unit ) -> unit -> t [ @@ js . builder ] ] end |
module ExtensionTerminalOptions = struct include Interface . Make ( ) include [ % js : val name : t -> string [ @@ js . get ] val pty : t -> Pseudoterminal . t [ @@ js . get ] val create : name : string -> pty : Pseudoterminal . t -> t [ @@ js . builder ] ] end |
module Extension = struct include Interface . Make ( ) end |
module Extensions = struct include [ % js : val getExtension : string -> Extension . t or_undefined [ @@ js . global " vscode . extensions . getExtension " ] ] end |
module TerminalExitStatus = struct include Interface . Make ( ) include [ % js : val code : t -> int [ @@ js . get ] val create : code : int -> t [ @@ js . builder ] ] end |
module Terminal = struct include Interface . Make ( ) type creationOptions = ( [ ` TerminalOptions of TerminalOptions . t | ` ExtensionTerminalOptions of ExtensionTerminalOptions . t ] [ @ js . union ] ) [ @@ js ] let creationOptions_of_js js_val = if Ojs . has_property js_val " pty " then ` ExtensionTerminalOptions ( [ % js . to : ExtensionTerminalOptions . t ] js_val ) else ` TerminalOptions ( [ % js . to : TerminalOptions . t ] js_val ) include [ % js : val name : t -> string [ @@ js . get ] val processId : t -> int or_undefined Promise . t [ @@ js . get ] val creationOptions : t -> creationOptions [ @@ js . get ] val exitStatus : t -> TerminalExitStatus . t or_undefined [ @@ js . get ] val sendText : t -> text : string -> ? addNewLine : bool -> unit -> unit [ @@ js . call ] val show : t -> ? preserveFocus : bool -> unit -> unit [ @@ js . call ] val hide : t -> unit [ @@ js . call ] val dispose : t -> unit [ @@ js . call ] ] let disposable this = Disposable . make ~ dispose ( : fun ( ) -> dispose this ) end |
module OutputChannel = struct include Interface . Make ( ) include [ % js : val name : t -> string [ @@ js . get ] val append : t -> value : string -> unit [ @@ js . call ] val appendLine : t -> value : string -> unit [ @@ js . call ] val clear : t -> unit [ @@ js . call ] val show : t -> ? preserveFocus : bool -> unit -> unit [ @@ js . call ] val hide : t -> unit [ @@ js . call ] val dispose : t -> unit [ @@ js . call ] ] let disposable this = Disposable . make ~ dispose ( : fun ( ) -> dispose this ) end |
module Memento = struct include Interface . Make ( ) include [ % js : val get : t -> key : string -> Js . Any . t or_undefined [ @@ js . call ] val get_default : t -> key : string -> defaultValue : Ojs . t -> Ojs . t [ @@ js . call ] val update : t -> key : string -> value : Js . Any . t -> Promise . void [ @@ js . call ] ] let get_default ( type a ) ( module T : Js . T with type t = a ) this ~ key ( ~ defaultValue : a ) : a = let defaultValue = [ % js . of : T . t ] defaultValue in [ % js . to : T . t ] ( get_default this ~ key ~ defaultValue ) end |
module EnvironmentVariableMutatorType = struct type t = | Replace [ @ js 1 ] | Append [ @ js 2 ] | Prepend [ @ js 3 ] [ @@ js . enum ] [ @@ js ] end |
module EnvironmentVariableMutator = struct include Interface . Make ( ) include [ % js : val type_ : t -> EnvironmentVariableMutatorType . t [ @@ js . get " type " ] val value : t -> string [ @@ js . get ] ] end |
module EnvironmentVariableCollection = struct include Interface . Make ( ) include [ % js : val persistent : t -> bool [ @@ js . get ] val replace : t -> variable : string -> value : string -> unit [ @@ js . call ] val append : t -> variable : string -> value : string -> unit [ @@ js . call ] val prepend : t -> variable : string -> value : string -> unit [ @@ js . call ] val get : t -> variable : string -> EnvironmentVariableMutator . t or_undefined [ @@ js . call ] val forEach : t -> callback : ( variable : string -> mutator : EnvironmentVariableMutator . t -> collection : t -> unit ) -> unit [ @@ js . call ] val delete : t -> variable : string -> unit [ @@ js . call ] val clear : t -> unit [ @@ js . call ] ] end |
module ExtensionMode = struct type t = | Production [ @ js 1 ] | Development [ @ js 2 ] | Test [ @ js 3 ] [ @@ js . enum ] [ @@ js ] end |
module SecretStorageChangeEvent = struct include Interface . Make ( ) include [ % js : val key : t -> string [ @@ js . get ] ] end |
module SecretStorage = struct include Interface . Make ( ) module OnDidChange = Event . Make ( SecretStorageChangeEvent ) include [ % js : val get : t -> key : string -> string or_undefined Promise . t [ @@ js . call ] val store : t -> key : string -> value : string -> Promise . void [ @@ js . call ] val delete : t -> key : string -> Promise . void [ @@ js . call ] val onDidChange : t -> OnDidChange . t [ @@ js . get ] ] end |
module ExtensionContext = struct include Interface . Make ( ) include [ % js : val subscriptions : t -> Disposable . t list [ @@ js . get ] val workspaceState : t -> Memento . t [ @@ js . get ] val globalState : t -> Memento . t [ @@ js . get ] val secrets : t -> SecretStorage . t [ @@ js . get ] val extensionUri : t -> Uri . t [ @@ js . get ] val extensionPath : t -> string [ @@ js . get ] val environmentVariableCollection : t -> EnvironmentVariableCollection . t [ @@ js . get ] val asAbsolutePath : t -> relativePath : string -> string [ @@ js . call ] val storageUri : t -> Uri . t or_undefined [ @@ js . get ] val globalStorageUri : t -> Uri . t [ @@ js . get ] val logUri : t -> Uri . t [ @@ js . get ] val extensionMode : t -> ExtensionMode . t [ @@ js . get ] ] let subscribe this ~ disposable = let subscriptions = Ojs . get_prop_ascii ( [ % js . of : t ] this ) " subscriptions " in let ( _ : Ojs . t ) = Ojs . call subscriptions " push " [ | [ % js . of : Disposable . t ] disposable ] | in ( ) end |
module ShellQuotingOptions = struct include Interface . Make ( ) type escapeLiteral = { escapeChar : string ; charsToEscape : string } [ @@ js ] type escape = ( [ ` String of string | ` Literal of escapeLiteral ] [ @ js . union ] ) [ @@ js ] let escape_of_js js_val = match Ojs . type_of js_val with | " string " -> ` String ( [ % js . to : string ] js_val ) | _ -> ` Literal ( [ % js . to : escapeLiteral ] js_val ) include [ % js : val escape : t -> escape or_undefined [ @@ js . get ] val strong : t -> string or_undefined [ @@ js . get ] val weak : t -> string or_undefined [ @@ js . get ] val create : ? escape : escape -> ? strong : string -> ? weak : string -> unit -> t [ @@ js . builder ] ] end |
module ShellExecutionOptions = struct include Interface . Make ( ) include [ % js : val executable : t -> string or_undefined [ @@ js . get ] val shellArgs : t -> string maybe_list [ @@ js . get ] val shellQuoting : t -> ShellQuotingOptions . t or_undefined [ @@ js . get ] val cwd : t -> string or_undefined [ @@ js . get ] val env : t -> string Dict . t or_undefined [ @@ js . get ] val create : ? executable : string -> ? shellArgs : string list -> ? shellQuoting : ShellQuotingOptions . t -> ? cwd : string -> ? env : string Dict . t -> unit -> t [ @@ js . builder ] ] end |
module ShellQuoting = struct type t = | Escape [ @ js 1 ] | Strong [ @ js 2 ] | Weak [ @ js 3 ] [ @@ js . enum ] [ @@ js ] end |
module ShellQuotedString = struct include Interface . Make ( ) include [ % js : val value : t -> string [ @@ js . get ] val quoting : t -> ShellQuoting . t [ @@ js . get ] val create : value : string -> quoting : ShellQuoting . t -> t [ @@ js . builder ] ] end |
module ShellExecution = struct include Class . Make ( ) type shellString = ( [ ` String of string | ` ShellQuotedString of ShellQuotedString . t ] [ @ js . union ] ) [ @@ js ] let shellString_of_js js_val = match Ojs . type_of js_val with | " string " -> ` String ( [ % js . to : string ] js_val ) | _ -> ` ShellQuotedString ( [ % js . to : ShellQuotedString . t ] js_val ) include [ % js : val makeCommandLine : commandLine : string -> ? options : ShellExecutionOptions . t -> unit -> t [ @@ js . new " vscode . ShellExecution " ] val makeCommandArgs : command : shellString -> args : shellString list -> ? options : ShellExecutionOptions . t -> unit -> t [ @@ js . new " vscode . ShellExecution " ] val commandLine : t -> string or_undefined [ @@ js . get ] val command : t -> shellString [ @@ js . get ] val args : t -> shellString list [ @@ js . get ] val options : t -> ShellExecutionOptions . t or_undefined [ @@ js . get ] ] end |
module ProcessExecutionOptions = struct include Interface . Make ( ) include [ % js : val cwd : t -> string or_undefined [ @@ js . get ] val env : t -> string Dict . t or_undefined [ @@ js . get ] val create : ? cwd : string -> ? env : string Dict . t -> unit -> t [ @@ js . builder ] ] end |
module ProcessExecution = struct include Class . Make ( ) include [ % js : val makeProcess : process : string -> ? options : ProcessExecutionOptions . t -> unit -> t [ @@ js . new " vscode . ProcessExecution " ] val makeProcessArgs : process : string -> args : string list -> ? options : ProcessExecutionOptions . t -> unit -> t [ @@ js . new " vscode . ProcessExecution " ] val process : t -> string [ @@ js . get ] val args : t -> string list [ @@ js . get ] val options : t -> ProcessExecutionOptions . t or_undefined [ @@ js . get ] ] end |
module TaskDefinition = struct include Interface . Make ( ) include [ % js : val type_ : t -> string [ @@ js . get ] ] let get_attribute t = Ojs . get_prop_ascii ( [ % js . of : t ] t ) let set_attribute t = Ojs . set_prop_ascii ( [ % js . of : t ] t ) let create ~ type_ ( ? attributes = [ ] ) ( ) = let obj = Ojs . obj [ | ( " type " , [ % js . of : string ] type_ ) ] | in let set ( key , value ) = Ojs . set_prop_ascii obj key value in List . iter set attributes ; [ % js . to : t ] obj end |
module CustomExecution = struct include Class . Make ( ) include [ % js : val make : callback : ( resolvedDefinition : TaskDefinition . t -> Pseudoterminal . t Promise . t ) -> t [ @@ js . new " vscode . CustomExecution " ] ] end |
module RelativePattern = struct include Class . Make ( ) include [ % js : val base : t -> string [ @@ js . get ] val pattern : t -> string [ @@ js . get ] val make : base : ( [ ` WorkspaceFolder of WorkspaceFolder . t | ` Uri of Uri . t | ` String of string ] [ @ js . union ] ) -> pattern : string -> t [ @@ js . new " vscode . RelativePattern " ] ] end |
module GlobPattern = struct type t = ( [ ` String of string | ` RelativePattern of RelativePattern . t ] [ @ js . union ] ) [ @@ js ] let t_of_js js_val = match Ojs . type_of js_val with | " string " -> ` String ( [ % js . to : string ] js_val ) | _ -> ` RelativePattern ( [ % js . to : RelativePattern . t ] js_val ) end |
module DocumentFilter = struct include Interface . Make ( ) include [ % js : val language : t -> string or_undefined [ @@ js . get ] val scheme : t -> string or_undefined [ @@ js . get ] val pattern : t -> GlobPattern . t or_undefined [ @@ js . get ] val create : ? language : string -> ? scheme : string -> ? pattern : GlobPattern . t -> unit -> t [ @@ js . builder ] ] end |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.