text
stringlengths 0
601k
|
---|
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 |
module DocumentSelector = struct type selector = ( [ ` Filter of DocumentFilter . t | ` String of string ] [ @ js . union ] ) [ @@ js ] let selector_of_js js_val = match Ojs . type_of js_val with | " string " -> ` String ( [ % js . to : string ] js_val ) | _ -> ` Filter ( [ % js . to : DocumentFilter . t ] js_val ) type t = ( [ ` Filter of DocumentFilter . t | ` String of string | ` List of selector list ] [ @ js . union ] ) [ @@ js ] let t_of_js js_val = if Ojs . type_of js_val = " string " then ` String ( [ % js . to : string ] js_val ) else if Ojs . has_property js_val " length " then ` List ( [ % js . to : selector list ] js_val ) else ` Filter ( [ % js . to : DocumentFilter . t ] js_val ) end |
module DocumentFormattingEditProvider = struct include Interface . Make ( ) include [ % js : val provideDocumentFormattingEdits : t -> document : TextDocument . t -> options : FormattingOptions . t -> token : CancellationToken . t -> TextEdit . t list ProviderResult . t [ @@ js . call ] val create : provideDocumentFormattingEdits : ( document : TextDocument . t -> options : FormattingOptions . t -> token : CancellationToken . t -> TextEdit . t list ProviderResult . t ) -> t [ @@ js . builder ] ] end |
module Hover = struct include Interface . Make ( ) include [ % js : val contents : t -> MarkdownString . t [ @@ js . get ] val range : t -> Range . t or_undefined [ @@ js . get ] val make : contents : ( [ ` MarkdownString of MarkdownString . t | ` MarkdownStringArray of MarkdownString . t list ] [ @ js . union ] ) -> t [ @@ js . new " vscode . Hover " ] ] end |
module HoverProvider = struct include Interface . Make ( ) include [ % js : val provideHover : t -> document : TextDocument . t -> position : Position . t -> token : CancellationToken . t -> Hover . t ProviderResult . t [ @@ js . call ] val create : provideHover : ( document : TextDocument . t -> position : Position . t -> token : CancellationToken . t -> Hover . t ProviderResult . t ) -> t [ @@ js . builder ] ] end |
module TaskGroup = struct include Class . Make ( ) include [ % js : val clean : t [ @@ js . global " vscode . TaskGroup . Clean " ] val build : t [ @@ js . global " vscode . TaskGroup . Build " ] val rebuild : t [ @@ js . global " vscode . TaskGroup . Rebuild " ] val test : t [ @@ js . global " vscode . TaskGroup . Test " ] ] end |
module TaskScope = struct type t = | Folder of WorkspaceFolder . t | Global | Workspace let t_to_js = function | Folder f -> [ % js . of : WorkspaceFolder . t ] f | Global -> [ % js . of : int ] 1 | Workspace -> [ % js . of : int ] 2 let t_of_js js_val = match Ojs . type_of js_val with | " number " when [ % js . to : int ] js_val = 1 -> Global | " number " when [ % js . to : int ] js_val = 2 -> Workspace | _ -> Folder ( [ % js . to : WorkspaceFolder . t ] js_val ) end |
module RunOptions = struct include Interface . Make ( ) include [ % js : val reevaluateOnRerun : t -> bool or_undefined [ @@ js . get ] val create : ? reevaluateOnRerun : bool -> unit -> t [ @@ js . builder ] ] end |
module TaskRevealKind = struct type t = | Always [ @ js 1 ] | Silent [ @ js 2 ] | Never [ @ js 3 ] [ @@ js . enum ] [ @@ js ] end |
module TaskPanelKind = struct type t = | Shared [ @ js 1 ] | Dedicated [ @ js 2 ] | New [ @ js 3 ] [ @@ js . enum ] [ @@ js ] end |
module TaskPresentationOptions = struct include Interface . Make ( ) include [ % js : val reveal : t -> TaskRevealKind . t or_undefined [ @@ js . get ] val echo : t -> bool or_undefined [ @@ js . get ] val focus : t -> bool or_undefined [ @@ js . get ] val panel : t -> TaskPanelKind . t or_undefined [ @@ js . get ] val showReuseMessage : t -> bool or_undefined [ @@ js . get ] val clear : t -> bool or_undefined [ @@ js . get ] val create : ? reveal : TaskRevealKind . t -> ? echo : bool -> ? focus : bool -> ? panel : TaskPanelKind . t -> ? showReuseMessage : bool -> ? clear : bool -> unit -> t [ @@ js . builder ] ] end |
module Task = struct include Class . Make ( ) type execution = ( [ ` ProcessExecution of ProcessExecution . t | ` ShellExecution of ShellExecution . t | ` CustomExecution of CustomExecution . t ] [ @ js . union ] ) [ @@ js ] let execution_of_js js_val = if Ojs . has_property js_val " process " then ` ProcessExecution ( [ % js . to : ProcessExecution . t ] js_val ) else if Ojs . has_property js_val " command " then ` ShellExecution ( [ % js . to : ShellExecution . t ] js_val ) else ` CustomExecution ( [ % js . to : CustomExecution . t ] js_val ) include [ % js : val make : definition : TaskDefinition . t -> scope : TaskScope . t -> name : string -> source : string -> ? execution : execution -> ? problemMatchers : string list -> unit -> t [ @@ js . new " vscode . Task " ] val definition : t -> TaskDefinition . t [ @@ js . get ] val scope : t -> TaskScope . t or_undefined [ @@ js . get ] val name : t -> string [ @@ js . get ] val detail : t -> string or_undefined [ @@ js . get ] val execution : t -> execution or_undefined [ @@ js . get ] val isBackground : t -> bool [ @@ js . get ] val source : t -> string [ @@ js . get ] val group : t -> TaskGroup . t or_undefined [ @@ js . get ] val presentationOptions : t -> TaskPresentationOptions . t [ @@ js . get ] val runOptions : t -> RunOptions . t [ @@ js . get ] val set_group : t -> TaskGroup . t -> unit [ @@ js . set ] ] end |
module TaskProvider = struct include Interface . Generic ( Ojs ) ( ) module Make ( T : Js . T ) = struct type t = T . t generic [ @@ js ] include [ % js : val provideTasks : t -> token : CancellationToken . t -> T . t list ProviderResult . t [ @@ js . call ] val resolveTask : t -> task : T . t -> token : CancellationToken . t -> T . t ProviderResult . t [ @@ js . call ] val create : provideTasks ( : token : CancellationToken . t -> T . t list ProviderResult . t ) -> resolveTask : ( task : T . t -> token : CancellationToken . t -> T . t ProviderResult . t ) -> t [ @@ js . builder ] ] end module Default = Make ( Task ) end |
module ConfigurationScope = struct type t = ( [ ` Uri of Uri . t | ` TextDocument of TextDocument . t | ` WorkspaceFolder of WorkspaceFolder . t ] [ @ js . union ] ) [ @@ js ] let t_of_js js_val = if Ojs . has_property js_val " path " then ` Uri ( [ % js . to : Uri . t ] js_val ) else if Ojs . has_property js_val " index " then ` WorkspaceFolder ( [ % js . to : WorkspaceFolder . t ] js_val ) else ` TextDocument ( [ % js . to : TextDocument . t ] js_val ) end |
module MessageOptions = struct include Interface . Make ( ) include [ % js : val modal : t -> bool or_undefined [ @@ js . get ] val create : ? modal : bool -> unit -> t [ @@ js . builder ] ] end |
module Progress = struct include Interface . Make ( ) type value = { message : string or_undefined ; increment : int or_undefined } [ @@ js ] include [ % js : val report : t -> value : value -> unit [ @@ js . call ] ] end |
module TextDocumentContentChangeEvent = struct include Interface . Make ( ) include [ % js : val range : t -> Range . t [ @@ js . get ] val rangeLength : t -> int [ @@ js . get ] val rangeOffset : t -> int [ @@ js . get ] val text : t -> string [ @@ js . get ] ] end |
module TextDocumentChangeEvent = struct include Interface . Make ( ) include [ % js : val contentChanges : t -> TextDocumentContentChangeEvent . t list [ @@ js . get ] val document : t -> TextDocument . t [ @@ js . get ] ] end |
module TextDocumentContentProvider = struct include Interface . Make ( ) module OnDidChange = Event . Make ( Uri ) include [ % js : val onDidChange : t -> OnDidChange . t or_undefined [ @@ js . get ] val provideTextDocumentContent : t -> uri : Uri . t -> token : CancellationToken . t -> string ProviderResult . t [ @@ js . call ] val create : ? onDidChange : OnDidChange . t -> provideTextDocumentContent : ( uri : Uri . t -> token : CancellationToken . t -> string ProviderResult . t ) -> unit -> t [ @@ js . builder ] ] end |
module FileSystemWatcher = struct include Interface . Make ( ) module OnDidChange = Event . Make ( Uri ) include [ % js : val onDidChange : t -> OnDidChange . t [ @@ js . get ] ] end |
module Workspace = struct module OnDidChangeWorkspaceFolders = Event . Make ( WorkspaceFolder ) module OnDidOpenTextDocument = Event . Make ( TextDocument ) module OnDidCloseTextDocument = Event . Make ( TextDocument ) module OnDidSaveTextDocument = Event . Make ( TextDocument ) module OnDidChangeTextDocument = Event . Make ( TextDocumentChangeEvent ) type textDocumentOptions = { language : string ; content : string } [ @@ js ] type workspaceFolderToAdd = { name : string ; uri : Uri . t } [ @@ js ] include [ % js : val workspaceFolders : unit -> WorkspaceFolder . t maybe_list [ @@ js . get " vscode . workspace . workspaceFolders " ] val name : unit -> string or_undefined [ @@ js . get " vscode . workspace . name " ] val createFileSystemWatcher : GlobPattern . t -> ? ignoreCreateEvents ( : bool [ @ js . default false ] ) -> ? ignoreChangeEvents ( : bool [ @ js . default false ] ) -> ? ignoreDeleteEvents ( : bool [ @ js . default false ] ) -> unit -> FileSystemWatcher . t [ @@ js . global " vscode . workspace . createFileSystemWatcher " ] val workspaceFile : unit -> Uri . t or_undefined [ @@ js . get " vscode . workspace . workspaceFile " ] val rootPath : unit -> string or_undefined [ @@ js . get " vscode . workspace . rootPath " ] val textDocuments : unit -> TextDocument . t list [ @@ js . get " vscode . workspace . textDocuments " ] val onDidChangeWorkspaceFolders : OnDidChangeWorkspaceFolders . t [ @@ js . global " vscode . workspace . onDidChangeWorkspaceFolders " ] val getWorkspaceFolder : uri : Uri . t -> WorkspaceFolder . t or_undefined [ @@ js . global " vscode . workspace . getWorkspaceFolder " ] val onDidOpenTextDocument : OnDidOpenTextDocument . t [ @@ js . global " vscode . workspace . onDidOpenTextDocument " ] val onDidSaveTextDocument : OnDidSaveTextDocument . t [ @@ js . global " vscode . workspace . onDidSaveTextDocument " ] val onDidCloseTextDocument : OnDidCloseTextDocument . t [ @@ js . global " vscode . workspace . onDidCloseTextDocument " ] val onDidChangeTextDocument : OnDidChangeTextDocument . t [ @@ js . global " vscode . workspace . onDidChangeTextDocument " ] val applyEdit : edit : WorkspaceEdit . t -> bool Promise . t [ @@ js . global " vscode . workspace . applyEdit " ] val registerTextDocumentContentProvider : scheme : string -> provider : TextDocumentContentProvider . t -> Disposable . t [ @@ js . global " vscode . workspace . registerTextDocumentContentProvider " ] val asRelativePath : pathOrUri ( [ : ` String of string | ` Uri of Uri . t ] [ @ js . union ] ) -> ? includeWorkspaceFolder : bool -> unit -> string [ @@ js . global " vscode . workspace . asRelativePath " ] val getConfiguration : ? section : string -> ? scope : ConfigurationScope . t -> unit -> WorkspaceConfiguration . t [ @@ js . global " vscode . workspace . getConfiguration " ] val findFiles : includes : GlobPattern . t -> ? excludes : GlobPattern . t -> ? maxResults : int -> ? token : CancellationToken . t -> unit -> Uri . t list Promise . t [ @@ js . global " vscode . workspace . findFiles " ] val openTextDocument : ( [ ` Uri of Uri . t | ` Filename of string | ` Interactive of textDocumentOptions or_undefined ] [ @ js . union ] ) -> TextDocument . t Promise . t [ @@ js . global " vscode . workspace . openTextDocument " ] val updateWorkspaceFolders : start : int -> deleteCount : int or_undefined -> workspaceFoldersToAdd ( : workspaceFolderToAdd list [ @ js . variadic ] ) -> bool [ @@ js . global " vscode . workspace . updateWorkspaceFolders " ] ] end |
module TreeItemCollapsibleState = struct type t = | None [ @ js 0 ] | Collapsed [ @ js 1 ] | Expanded [ @ js 2 ] [ @@ js . enum ] [ @@ js ] end |
module CustomDocument = struct module type T = sig include Js . T val uri : t -> Uri . t val dispose : t -> unit end include Interface . Make ( ) include [ % js : val uri : t -> Uri . t [ @@ js . get ] val dispose : t -> unit [ @@ js . call ] val create : uri : Uri . t -> dispose ( : unit -> unit ) -> t [ @@ js . builder ] ] end |
module TreeItemLabel = struct include Interface . Make ( ) include [ % js : val label : t -> string [ @@ js . get ] val highlights : t -> ( int * int ) list or_undefined [ @@ js . get ] val create : label : string -> ? highlights ( : int * int ) list -> unit -> t [ @@ js . builder ] ] end |
module ThemeIcon = struct include Class . Make ( ) include [ % js : val make : id : string -> ? color : ThemeColor . t -> unit -> t [ @@ js . new " vscode . ThemeIcon " ] val file : t [ @@ js . global " vscode . ThemeIcon . File " ] val folder : t [ @@ js . global " vscode . ThemeIcon . Folder " ] val id : t -> string [ @@ js . get ] val color : t -> ThemeColor . t or_undefined [ @@ js . get ] ] end |
module TreeItem = struct include Class . Make ( ) type label = ( [ ` String of string | ` TreeItemLabel of TreeItemLabel . t ] [ @ js . union ] ) [ @@ js ] let label_of_js js_val = if Ojs . type_of js_val = " string " then ` String ( [ % js . to : string ] js_val ) else if Ojs . has_property js_val " label " then ` TreeItemLabel ( [ % js . to : TreeItemLabel . t ] js_val ) else assert false module LightDarkIcon = struct type t = { light : ( [ ` String of string | ` Uri of Uri . t ] [ @ js . union ] ) ; dark : ( [ ` String of string | ` Uri of Uri . t ] [ @ js . union ] ) } [ @@ js ] let t_of_js js_val = let light_js = Ojs . get_prop_ascii js_val " light " in let dark_js = Ojs . get_prop_ascii js_val " dark " in let light = if Ojs . has_property light_js " parse " then ` Uri ( [ % js . to : Uri . t ] light_js ) else ` String ( [ % js . to : string ] light_js ) in let dark = if Ojs . has_property dark_js " parse " then ` Uri ( [ % js . to : Uri . t ] dark_js ) else ` String ( [ % js . to : string ] dark_js ) in { light ; dark } end type iconPath = ( [ ` String of string | ` Uri of Uri . t | ` LightDark of LightDarkIcon . t | ` ThemeIcon of ThemeIcon . t ] [ @ js . union ] ) [ @@ js ] let iconPath_of_js js_val = if Ojs . has_property js_val " path " then ` Uri ( [ % js . to : Uri . t ] js_val ) else if Ojs . has_property js_val " id " then ` ThemeIcon ( [ % js . to : ThemeIcon . t ] js_val ) else if Ojs . type_of js_val = " string " then ` String ( [ % js . to : string ] js_val ) else if Ojs . has_property js_val " light " then ` LightDark ( [ % js . to : LightDarkIcon . t ] js_val ) else assert false type description = ( [ ` String of string | ` Bool of bool ] [ @ js . union ] ) [ @@ js ] let description_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 type tooltip = ( [ ` String of string | ` MarkdownString of MarkdownString . t | ` Undefined ] [ @ js . union ] ) [ @@ js ] let tooltip_of_js js_val = if Ojs . type_of js_val = " string " then ` String ( [ % js . to : string ] js_val ) else if Ojs . type_of js_val = " undefined " then ` Undefined else if Ojs . has_property js_val " value " then ` MarkdownString ( [ % js . to : MarkdownString . t ] js_val ) else assert false include [ % js : val make_label : label : label -> ? collapsibleState : TreeItemCollapsibleState . t -> unit -> t [ @@ js . new " vscode . TreeItem " ] val make_resource : resourceUri : Uri . t -> ? collapsibleState : TreeItemCollapsibleState . t -> unit -> t [ @@ js . new " vscode . TreeItem " ] val label : t -> label or_undefined [ @@ js . get ] val set_label : t -> label -> unit [ @@ js . set ] val id : t -> string or_undefined [ @@ js . get ] val set_id : t -> string -> unit [ @@ js . set ] val iconPath : t -> iconPath or_undefined [ @@ js . get ] val set_iconPath : t -> iconPath -> unit [ @@ js . set ] val description : t -> description or_undefined [ @@ js . get ] val set_description : t -> description -> unit [ @@ js . set ] val resourceUri : t -> Uri . t or_undefined [ @@ js . get ] val set_resourceUri : t -> Uri . t -> unit [ @@ js . set ] val tooltip : t -> tooltip or_undefined [ @@ js . get ] val set_tooltip : t -> tooltip -> unit [ @@ js . set ] val collapsibleState : t -> TreeItemCollapsibleState . t or_undefined [ @@ js . get ] val set_collapsibleState : t -> TreeItemCollapsibleState . t -> unit [ @@ js . set ] val command : t -> Command . t or_undefined [ @@ js . get ] val set_command : t -> Command . t -> unit [ @@ js . set ] val contextValue : t -> string or_undefined [ @@ js . get ] val set_contextValue : t -> string -> unit [ @@ js . set ] val accessibilityInformation : t -> AccessibilityInformation . t or_undefined [ @@ js . get ] val set_accessibilityInformation : t -> AccessibilityInformation . t -> unit [ @@ js . set ] ] end |
module TreeDataProvider = struct include Interface . Generic ( Ojs ) ( ) module Make ( T : Js . T ) = struct type t = T . t generic [ @@ js ] module OnDidChangeTreeData = Event . Make ( struct type t = T . t or_undefined [ @@ js ] end ) type getTreeItemResult = ( [ ` Value of TreeItem . t | ` Promise of TreeItem . t Promise . t ] [ @ js . union ] ) [ @@ js ] let getTreeItemResult_of_js js_val = if Ojs . has_property js_val " then " then ` Promise ( [ % js . to : TreeItem . t Promise . t ] js_val ) else ` Value ( [ % js . to : TreeItem . t ] js_val ) include [ % js : val onDidChangeTreeData : t -> OnDidChangeTreeData . t or_undefined [ @@ js . get ] val getTreeItem : t -> element : T . t -> getTreeItemResult [ @@ js . call ] val getChildren : t -> ? element : T . t -> unit -> T . t list ProviderResult . t [ @@ js . call ] val getParent : t -> ( element : T . t -> T . t ProviderResult . t ) or_undefined [ @@ js . call ] val resolveTreeItem : t -> ( item : TreeItem . t -> element : T . t -> token : CancellationToken . t -> TreeItem . t ProviderResult . t ) or_undefined [ @@ js . call ] val create : ? onDidChangeTreeData : OnDidChangeTreeData . t -> getTreeItem ( : element : T . t -> getTreeItemResult ) -> getChildren ( :? element : T . t -> unit -> T . t list ProviderResult . t ) -> ? getParent ( : element : T . t -> T . t ProviderResult . t ) -> ? resolveTreeItem : ( item : TreeItem . t -> element : T . t -> token : CancellationToken . t -> TreeItem . t ProviderResult . t ) -> unit -> t [ @@ js . builder ] ] end end |
module TreeViewOptions = struct include Class . Generic ( Ojs ) ( ) module Make ( T : Js . T ) = struct type t = T . t generic [ @@ js ] module TreeDataProvider = TreeDataProvider . Make ( T ) include [ % js : val treeDataProvider : t -> TreeDataProvider . t [ @@ js . get ] val showCollapseAll : t -> bool or_undefined [ @@ js . get ] val canSelectMany : t -> bool or_undefined [ @@ js . get ] ] end end |
module TreeViewExpansionEvent = struct include Interface . Generic ( Ojs ) ( ) module Make ( T : Js . T ) = struct type t = T . t generic [ @@ js ] include [ % js : val element : t -> T . t [ @@ js . get ] val create : element : T . t -> t [ @@ js . builder ] ] end end |
module TreeViewSelectionChangeEvent = struct include Interface . Generic ( Ojs ) ( ) module Make ( T : Js . T ) = struct type t = T . t generic [ @@ js ] include [ % js : val selection : t -> T . t list [ @@ js . get ] val create : selection : T . t list -> t [ @@ js . builder ] ] end end |
module TreeViewVisibilityChangeEvent = struct include Interface . Make ( ) include [ % js : val visible : t -> bool [ @@ js . get ] val create : visible : bool -> t [ @@ js . builder ] ] end |
module TreeView = struct include Class . Generic ( Disposable ) ( ) module Make ( T : Js . T ) = struct type t = T . t generic [ @@ js ] module OnDidExpandElement = Event . Make ( TreeViewExpansionEvent . Make ( T ) ) module OnDidCollapseElement = Event . Make ( TreeViewExpansionEvent . Make ( T ) ) module OnDidChangeSelection = Event . Make ( TreeViewSelectionChangeEvent . Make ( T ) ) module OnDidChangeVisibility = Event . Make ( TreeViewVisibilityChangeEvent ) include [ % js : val onDidExpandElement : t -> OnDidExpandElement . t [ @@ js . get ] val onDidCollapseElement : t -> OnDidCollapseElement . t [ @@ js . get ] val selection : t -> T . t list [ @@ js . get ] val onDidChangeSelection : t -> OnDidChangeSelection . t [ @@ js . get ] val visible : t -> bool [ @@ js . get ] val onDidChangeVisibility : t -> OnDidChangeVisibility . t [ @@ js . get ] val message : t -> string or_undefined [ @@ js . get ] val title : t -> string or_undefined [ @@ js . get ] val description : t -> string or_undefined [ @@ js . get ] val reveal : t -> element : T . t -> Ojs . t -> Promise . void [ @@ js . call ] ] let reveal this ~ element ? select ? focus ? expand ( ) = let options = Ojs . obj [ ] || in iter_set options " select " [ % js . of : bool ] select ; iter_set options " focus " [ % js . of : bool ] focus ; iter_set options " expand " [ % js . of : ( [ ` Bool of bool | ` Int of int ] [ @ js . union ] ) ] expand ; reveal this ~ element options end end |
module WebviewPanelOptions = struct include Interface . Make ( ) include [ % js : val enableFindWidget : t -> bool or_undefined [ @@ js . get ] val retainContextWhenHidden : t -> bool or_undefined [ @@ js . get ] ] end |
module WebviewPortMapping = struct include Interface . Make ( ) include [ % js : val extensionHostPort : t -> int [ @@ js . get ] val webviewPort : t -> int [ @@ js . get ] ] end |
module WebviewOptions = struct include Interface . Make ( ) include [ % js : val enableCommandUris : t -> bool [ @@ js . get ] val enableScripts : t -> bool [ @@ js . get ] val set_enableScripts : t -> bool -> unit [ @@ js . set ] val localResourceRoots : t -> Uri . t list [ @@ js . get ] val portMapping : t -> WebviewPortMapping . t list [ @@ js . get ] val create : enableCommandUris : bool -> enableScripts : bool -> localResourceRoots : Uri . t list -> portMapping : WebviewPortMapping . t list -> t [ @@ js . builder ] ] end |
module WebView = struct include Interface . Make ( ) module OnDidReceiveMessage = Event . Make ( Js . Any ) include [ % js : val onDidReceiveMessage : t -> OnDidReceiveMessage . t [ @@ js . get ] val cspSource : t -> string [ @@ js . get ] val html : t -> string [ @@ js . get ] val set_html : t -> string -> unit [ @@ js . set ] val options : t -> WebviewOptions . t [ @@ js . get ] val set_options : t -> WebviewOptions . t -> unit [ @@ js . set ] val asWebviewUri : t -> localResource : Uri . t -> Uri . t [ @@ js . call ] val postMessage : t -> Js . Any . t -> bool Promise . t [ @@ js . call ] val create : onDidReceiveMessage : OnDidReceiveMessage . t -> cspSource : string -> html : string -> options : WebviewOptions . t -> close ( : unit -> unit ) -> asWebviewUri ( : Uri . t -> Uri . t ) -> postMessage ( : Js . Any . t -> bool Promise . t ) -> t [ @@ js . builder ] ] end |
module WebviewPanel = struct include Interface . Make ( ) module WebviewPanelOnDidChangeViewStateEvent = struct type webviewPanel = t [ @@ js ] include Interface . Make ( ) include [ % js : val webviewPanel : t -> webviewPanel [ @@ js . get ] ] end module LightDarkIcon = struct type t = { light : Uri . t ; dark : Uri . t } [ @@ js ] end type iconPath = ( [ ` Uri of Uri . t | ` LightDark of LightDarkIcon . t ] [ @ js . union ] ) [ @@ js ] module OnDidChangeViewState = Event . Make ( WebviewPanelOnDidChangeViewStateEvent ) module OnDidDispose = Event . Make ( Js . Unit ) include [ % js : val onDidChangeViewState : t -> OnDidChangeViewState . t [ @@ js . get ] val onDidDispose : t -> OnDidDispose . t [ @@ js . get ] val active : t -> bool [ @@ js . get ] val options : t -> WebviewPanelOptions . t [ @@ js . get ] val title : t -> string [ @@ js . get ] val viewColumn : t -> ViewColumn . t or_undefined [ @@ js . get ] val viewType : t -> string [ @@ js . get ] val visible : t -> bool [ @@ js . get ] val webview : t -> WebView . t [ @@ js . get ] val set_webview : t -> WebView . t -> unit [ @@ js . set ] val dispose : t -> Js . Any . t [ @@ js . call ] val reveal : t -> ? preserveFocus : bool -> ? viewColumn : ViewColumn . t -> unit -> unit [ @@ js . call ] val create : onDidChangeViewState : OnDidChangeViewState . t -> onDidDispose : OnDidDispose . t -> active : bool -> options : WebviewPanelOptions . t -> title : string -> viewColumn : ViewColumn . t -> viewType : string -> visible : bool -> webview : WebView . t -> dispose : Js . Any . t -> reveal : ( ? preserveFocus : bool -> ? viewColumn : ViewColumn . t -> unit -> unit ) -> t [ @@ js . builder ] ] end |
module CustomTextEditorProvider = struct include Interface . Make ( ) module ResolvedEditor = struct type t = ( [ ` Promise of Promise . void | ` Unit of Js . Unit . t ] [ @ js . union ] ) [ @@ js ] let t_of_js js_val = if Ojs . is_null js_val then ` Unit ( [ % js . to : Js . Unit . t ] js_val ) else ` Promise ( [ % js . to : Promise . void ] js_val ) let t_to_js = function | ` Unit v -> Js . Unit . t_to_js v | ` Promise p -> Promise . void_to_js p end include [ % js : val resolveCustomTextEditor : t -> document : TextDocument . t -> webviewPanel : WebviewPanel . t -> token : CancellationToken . t -> ResolvedEditor . t [ @@ js . call ] val create : resolveCustomTextEditor : ( document : TextDocument . t -> webviewPanel : WebviewPanel . t -> token : CancellationToken . t -> ResolvedEditor . t ) -> t [ @@ js . builder ] ] end |
module CustomDocumentOpenContext = struct include Interface . Make ( ) include [ % js : val backupId : t -> string or_undefined [ @@ js . get ] ] end |
module CustomReadonlyEditorProvider = struct include Interface . Generic ( Ojs ) ( ) module Make ( T : CustomDocument . T ) = struct type t = T . t generic [ @@ js ] include [ % js : val openCustomDocument : t -> uri : Uri . t -> openContext : CustomDocumentOpenContext . t -> token : CancellationToken . t -> T . t Promise . t [ @@ js . call ] val resolveCustomEditor : t -> document : T . t -> webviewPanel : WebviewPanel . t -> token : CancellationToken . t -> unit Promise . t [ @@ js . call ] val create : resolveCustomEditor : ( document : T . t -> webviewPanel : WebviewPanel . t -> token : CancellationToken . t -> unit Promise . t ) -> openCustomDocument : ( uri : Uri . t -> openContext : CustomDocumentOpenContext . t -> token : CancellationToken . t -> T . t Promise . t ) -> t [ @@ js . builder ] ] end end |
module RegisterCustomEditorProviderOptions = struct include Interface . Make ( ) include [ % js : val supportsMultipleEditorsPerDocument : t -> bool or_undefined [ @@ js . get ] val create : ? supportsMultipleEditorsPerDocument : bool -> unit -> t [ @@ js . builder ] ] end |
module Window = struct module OnDidChangeActiveTextEditor = Event . Make ( TextEditor ) module OnDidChangeVisibleTextEditors = Event . Make ( Js . List ( TextEditor ) ) module OnDidChangeActiveTerminal = Event . Make ( Js . Or_undefined ( Terminal ) ) module OnDidOpenTerminal = Event . Make ( Terminal ) module OnDidCloseTerminal = Event . Make ( Terminal ) include [ % js : val activeTextEditor : unit -> TextEditor . t or_undefined [ @@ js . get " vscode . window . activeTextEditor " ] val visibleTextEditors : unit -> TextEditor . t list [ @@ js . get " vscode . window . visibleTextEditors " ] val onDidChangeActiveTextEditor : unit -> OnDidChangeActiveTextEditor . t [ @@ js . get " vscode . window . onDidChangeActiveTextEditor " ] val onDidChangeVisibleTextEditors : unit -> OnDidChangeVisibleTextEditors . t [ @@ js . get " vscode . window . onDidChangeVisibleTextEditors " ] val terminals : unit -> Terminal . t list [ @@ js . get " vscode . window . terminals " ] val activeTerminal : unit -> Terminal . t or_undefined [ @@ js . get " vscode . window . activeTerminal " ] val onDidChangeActiveTerminal : unit -> OnDidChangeActiveTerminal . t [ @@ js . get " vscode . window . onDidChangeActiveTerminal " ] val onDidOpenTerminal : unit -> OnDidOpenTerminal . t [ @@ js . get " vscode . window . onDidOpenTerminal " ] val onDidCloseTerminal : unit -> OnDidCloseTerminal . t [ @@ js . get " vscode . window . onDidCloseTerminal " ] val showTextDocument : document : ( [ ` TextDocument of TextDocument . t | ` Uri of Uri . t ] [ @ js . union ] ) -> ? column : ViewColumn . t -> ? preserveFocus : bool -> unit -> TextEditor . t Promise . t [ @@ js . global " vscode . window . showTextDocument " ] val showInformationMessage : message : string -> ? options : MessageOptions . t -> items ( : MessageItem . t list [ @ js . variadic ] ) -> unit -> MessageItem . t or_undefined Promise . t [ @@ js . global " vscode . window . showInformationMessage " ] val showWarningMessage : message : string -> ? options : MessageOptions . t -> items ( : MessageItem . t list [ @ js . variadic ] ) -> unit -> MessageItem . t or_undefined Promise . t [ @@ js . global " vscode . window . showWarningMessage " ] val showErrorMessage : message : string -> ? options : MessageOptions . t -> items ( : MessageItem . t list [ @ js . variadic ] ) -> unit -> MessageItem . t or_undefined Promise . t [ @@ js . global " vscode . window . showErrorMessage " ] val showQuickPickItems : choices : QuickPickItem . t list -> ? options : QuickPickOptions . t -> ? token : CancellationToken . t -> unit -> QuickPickItem . t or_undefined Promise . t [ @@ js . global " vscode . window . showQuickPick " ] val showQuickPick : items : string list -> ? options : QuickPickOptions . t -> ? token : CancellationToken . t -> unit -> string or_undefined Promise . t [ @@ js . global " vscode . window . showQuickPick " ] val showInputBox : ? options : InputBoxOptions . t -> ? token : CancellationToken . t -> unit -> string or_undefined Promise . t [ @@ js . global " vscode . window . showInputBox " ] val createOutputChannel : name : string -> OutputChannel . t [ @@ js . global " vscode . window . createOutputChannel " ] val setStatusBarMessage : text : string -> ? hide ( [ : ` AfterTimeout of int ] [ @ js . union ] ) -> unit -> Disposable . t [ @@ js . global " vscode . window . setStatusBarMessage " ] val withProgress : options : ProgressOptions . t -> task : Ojs . t -> Ojs . t [ @@ js . global " vscode . window . withProgress " ] val createStatusBarItem : ? alignment : StatusBarAlignment . t -> ? priority : int -> unit -> StatusBarItem . t [ @@ js . global " vscode . window . createStatusBarItem " ] val createTerminal : ? name : string -> ? shellPath : string -> ? shellArgs ( [ : ` String of string | ` Strings of string list ] [ @ js . union ] ) -> unit -> Terminal . t [ @@ js . global " vscode . window . createTerminal " ] val createTerminalFromOptions : options : ( [ ` TerminalOptions of TerminalOptions . t | ` ExtensionTerminalOptions of ExtensionTerminalOptions . t ] [ @ js . union ] ) -> Terminal . t [ @@ js . global " vscode . window . createTerminal " ] val registerTreeDataProvider : viewId : string -> treeDataProvider : Ojs . t -> Disposable . t [ @@ js . global " vscode . window . registerTreeDataProvider " ] val createTreeView : viewId : string -> options : Ojs . t -> Ojs . t [ @@ js . global " vscode . window . createTreeView " ] val createWebviewPanel : viewType : string -> title : string -> showOptions : ViewColumn . t -> WebviewPanel . t [ @@ js . global " vscode . window . createWebviewPanel " ] val registerCustomTextEditorProvider : viewType : string -> provider : CustomTextEditorProvider . t -> ? options : RegisterCustomEditorProviderOptions . t -> unit -> Disposable . t [ @@ js . global " vscode . window . registerCustomEditorProvider " ] val registerCustomReadonlyEditorProvider : viewType : string -> provider : Ojs . t -> ? options : RegisterCustomEditorProviderOptions . t -> unit -> Disposable . t [ @@ js . global " vscode . window . registerCustomEditorProvider " ] ] let getChoices choices = choices |> List . map ( fun ( title , choice ) -> ( MessageItem . create ~ title ( ) , choice ) ) let showInformationMessage ~ message ? options ( ? choices = [ ] ) ( ) = let choices = getChoices choices in let open Promise . Option . Syntax in let + item = showInformationMessage ~ message ? options ~ items ( : List . map fst choices ) ( ) in List . assoc item choices let showWarningMessage ~ message ? options ( ? choices = [ ] ) ( ) = let choices = getChoices choices in let open Promise . Option . Syntax in let + item = showWarningMessage ~ message ? options ~ items ( : List . map fst choices ) ( ) in List . assoc item choices let showErrorMessage ~ message ? options ( ? choices = [ ] ) ( ) = let choices = getChoices choices in let open Promise . Option . Syntax in let + item = showErrorMessage ~ message ? options ~ items ( : List . map fst choices ) ( ) in List . assoc item choices let showQuickPickItems ~ choices ? options ? token ( ) = let open Promise . Option . Syntax in let + item = showQuickPickItems ~ choices ( : List . map fst choices ) ? options ? token ( ) in List . assoc item choices let withProgress ( type a ) ( module T : Js . T with type t = a ) ~ options ~ task : a Promise . t = let task = [ % js . of : progress : Progress . t -> token : CancellationToken . t -> T . t Promise . t ] task in [ % js . to : T . t Promise . t ] ( withProgress ~ options ~ task ) let registerTreeDataProvider ( type a ) ( module T : Js . T with type t = a ) ( ~ viewId : string ) ( ~ treeDataProvider : a TreeDataProvider . t ) : Disposable . t = let module TreeDataProvider = TreeDataProvider . Make ( T ) in let treeDataProvider = [ % js . of : TreeDataProvider . t ] treeDataProvider in registerTreeDataProvider ~ viewId ~ treeDataProvider let createTreeView ( type a ) ( module T : Js . T with type t = a ) ( ~ viewId : string ) ( ~ options : a TreeViewOptions . t ) : a TreeView . t = let module TreeViewOptions = TreeViewOptions . Make ( T ) in let module TreeView = TreeView . Make ( T ) in let options = [ % js . of : TreeViewOptions . t ] options in [ % js . to : TreeView . t ] ( createTreeView ~ viewId ~ options ) let registerCustomReadonlyEditorProvider ( type a ) ( module T : CustomDocument . T with type t = a ) ( ~ viewType : string ) ( ~ provider : a CustomReadonlyEditorProvider . t ) ( ? options : RegisterCustomEditorProviderOptions . t or_undefined ) ( ) : Disposable . t = let module CustomReadonlyEditorProvider = CustomReadonlyEditorProvider . Make ( T ) in let provider = [ % js . of : CustomReadonlyEditorProvider . t ] provider in registerCustomReadonlyEditorProvider ~ viewType ~ provider ? options ( ) end |
module Commands = struct include [ % js : val registerCommand : command : string -> callback ( : args ( : Js . Any . t list [ @ js . variadic ] ) -> unit ) -> Disposable . t [ @@ js . global " vscode . commands . registerCommand " ] val registerTextEditorCommand : command : string -> callback : ( textEditor : TextEditor . t -> edit : TextEditorEdit . t -> args ( : Js . Any . t list [ @ js . variadic ] ) -> unit ) -> Disposable . t [ @@ js . global " vscode . commands . registerTextEditorCommand " ] val executeCommand : command : string -> args ( : Js . Any . t list [ @ js . variadic ] ) -> Js . Any . t or_undefined Promise . t [ @@ js . global " vscode . commands . executeCommand " ] val getCommands : ? filterInternal : bool -> unit -> string list Promise . t [ @@ js . global " vscode . commands . getCommands " ] ] end |
module Languages = struct include [ % js : val registerDocumentFormattingEditProvider : selector : DocumentSelector . t -> provider : DocumentFormattingEditProvider . t -> Disposable . t [ @@ js . global " vscode . languages . registerDocumentFormattingEditProvider " ] val registerHoverProvider : selector : DocumentSelector . t -> provider : HoverProvider . t -> Disposable . t [ @@ js . global " vscode . languages . registerHoverProvider " ] val getDiagnostics : Uri . t -> Diagnostic . t list [ @@ js . global " vscode . languages . getDiagnostics " ] val getDiagnostics_all : unit -> ( Uri . t * Diagnostic . t list ) list [ @@ js . global " vscode . languages . getDiagnostics " ] ] end |
module Tasks = struct include [ % js : val registerTaskProvider : type_ : string -> provider : TaskProvider . Default . t -> Disposable . t [ @@ js . global " vscode . tasks . registerTaskProvider " ] ] end |
module Env = struct include [ % js : val shell : unit -> string [ @@ js . get " vscode . env . shell " ] ] end |
module RevealOutputChannelOn = struct type t = | Info [ @ js 1 ] | Warn [ @ js 2 ] | Error [ @ js 3 ] | Never [ @ js 4 ] [ @@ js . enum ] [ @@ js ] end |
module ServerCapabilities = struct include Interface . Make ( ) include [ % js : val experimental : t -> Jsonoo . t or_undefined [ @@ js . get ] val create : ? experimental : Jsonoo . t -> unit -> t [ @@ js . builder ] ] end |
module InitializeResult = struct include Interface . Make ( ) type serverInfo = { name : string ; version : string or_undefined } [ @@ js ] include [ % js : val capabilities : t -> ServerCapabilities . t [ @@ js . get ] val serverInfo : t -> serverInfo or_undefined [ @@ js . get ] ] 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 -> string or_undefined [ @@ js . get ] val createLanguage : language : string -> ? scheme : string -> ? pattern : string -> unit -> t [ @@ js . builder ] val createScheme : ? language : string -> scheme : string -> ? pattern : string -> unit -> t [ @@ js . builder ] val createPattern : ? language : string -> ? scheme : string -> pattern : string -> unit -> t [ @@ js . builder ] ] end |
module DocumentSelector = struct type selector = ( [ ` Filter of DocumentFilter . t | ` String of string ] [ @ js . union ] ) [ @@ js ] let selector_of_js js_val = match Ojs . type_of js_val with | " string " -> ` String ( [ % js . to : string ] js_val ) | _ -> ` Filter ( [ % js . to : DocumentFilter . t ] js_val ) type t = selector array [ @@ js ] let language ( ? scheme = " file " ) ? pattern l = ` Filter ( DocumentFilter . createLanguage ~ language : l ~ scheme ? pattern ( ) ) end |
module ClientOptions = struct include Interface . Make ( ) include [ % js : val documentSelector : t -> DocumentSelector . t or_undefined [ @@ js . get ] val outputChannel : t -> Vscode . OutputChannel . t or_undefined [ @@ js . get ] val revealOutputChannelOn : t -> RevealOutputChannelOn . t [ @@ js . get ] val create : ? documentSelector : DocumentSelector . t -> ? outputChannel : Vscode . OutputChannel . t -> ? revealOutputChannelOn : RevealOutputChannelOn . t -> unit -> t [ @@ js . builder ] ] end |
module ExecutableOptions = 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 detached : t -> bool or_undefined [ @@ js . get ] val shell : t -> bool or_undefined [ @@ js . get ] val create : ? cwd : string -> ? env : string Dict . t -> ? detached : bool -> ? shell : bool -> unit -> t [ @@ js . builder ] ] end |
module Executable = struct include Interface . Make ( ) include [ % js : val command : t -> string [ @@ js . get ] val args : t -> string list or_undefined [ @@ js . get ] val options : t -> ExecutableOptions . t or_undefined [ @@ js . get ] val create : command : string -> ? args : string list -> ? options : ExecutableOptions . t -> unit -> t [ @@ js . builder ] ] end |
module ClientCapabilities = struct include Interface . Make ( ) include [ % js : val experimental : t -> Jsonoo . t or_undefined [ @@ js . get ] val set_experimental : t -> Jsonoo . t or_undefined -> unit [ @@ js . set ] ] end |
module InitializeParams = struct include Interface . Make ( ) end |
module StaticFeature = struct include Interface . Make ( ) include [ % js : val make : ? fillInitializeParams ( : params : InitializeParams . t -> unit ) -> fillClientCapabilities ( : capabilities : ClientCapabilities . t -> unit ) -> initialize : ( capabilities : ServerCapabilities . t -> documentSelector : DocumentSelector . t or_undefined -> unit ) -> dispose ( : unit -> unit ) -> unit -> t [ @@ js . builder ] ] end |
module LanguageClient = struct include Class . Make ( ) include [ % js : val make : id : string -> name : string -> serverOptions : ServerOptions . t -> clientOptions : ClientOptions . t -> ? forceDebug : bool -> unit -> t [ @@ js . new " vscode_languageclient . LanguageClient " ] val start : t -> unit [ @@ js . call ] val stop : t -> unit [ @@ js . call ] val onReady : t -> Promise . void [ @@ js . call ] val initializeResult : t -> InitializeResult . t [ @@ js . get ] val sendRequest : t -> meth : string -> data : Jsonoo . t -> ? token : Vscode . CancellationToken . t -> unit -> Jsonoo . t Promise . t [ @@ js . call ] val registerFeature : t -> feature : StaticFeature . t -> unit [ @@ js . call ] ] let ready_initialize_result t = let open Promise . Syntax in let + ( ) = onReady t in initializeResult t end |
let suggest_to_pick_sandbox ( ) = let open Promise . Syntax in let select_pm_button_text = " Select package manager and sandbox " in let + selection = Window . showInformationMessage ~ message : " OCaml Platform is using the package manager and sandbox available in \ the environment . Pick a particular package manager and sandbox by \ clicking the button below " ~ choices [ : ( select_pm_button_text , ( ) ) ] ( ) in Option . iter selection ~ f ( : fun ( ) -> let ( _ : Ojs . t option Promise . t ) = Vscode . Commands . executeCommand ~ command : Extension_consts . Commands . select_sandbox ~ args [ ] : in ( ) ) |
let activate ( extension : ExtensionContext . t ) = Process . Env . set " OCAML_LSP_SERVER_LOG " " " ; - let open Promise . Syntax in let instance = Extension_instance . make ( ) in ExtensionContext . subscribe extension ~ disposable ( : Extension_instance . disposable instance ) ; Dune_formatter . register extension instance ; Dune_task_provider . register extension instance ; Extension_commands . register_all_commands extension instance ; Treeview_switches . register extension instance ; Treeview_sandbox . register extension instance ; Treeview_commands . register extension ; Treeview_help . register extension ; Ast_editor . register extension instance ; Cm_editor . register extension instance ; Repl . register extension instance ; let sandbox_opt = Sandbox . of_settings_or_detect ( ) in let ( _ : unit Promise . t ) = let * sandbox_opt in let is_fallback = Option . is_none sandbox_opt in if is_fallback then suggest_to_pick_sandbox ( ) else Promise . return ( ) in let ( _ : unit Promise . t ) = let * sandbox_opt in let sandbox = Option . value sandbox_opt ~ default : Sandbox . Global in Extension_instance . set_sandbox instance sandbox ; let * ( ) = Extension_instance . update_ocaml_info instance in let + ( ) = Extension_instance . start_language_server instance in ( ) in Promise . return ( ) |
let ( ) = let open Js_of_ocaml . Js in export " activate " ( wrap_callback activate ) |
module T = Uterm open struct let get_id_of_lb_arg = function | Uast . Lunit -> assert false | Uast . Lnone id | Loptional id | Lnamed id | Lghost ( id , _ ) -> id end let loc_of_lb_arg = function | Uast . Lunit -> T . dummy_loc | lb -> T . location ( get_id_of_lb_arg lb ) . pid_loc let ident_of_lb_arg = function | Uast . Lunit -> T . mk_id " ( ) " | lb -> T . preid ( get_id_of_lb_arg lb ) end |
let sp_post sp_hd_ret sp_post = let term_loc = T . location sp_post . Uast . term_loc in let mk_pvar lb = let pat_loc = loc_of_lb_arg lb in T . mk_pattern ( Pvar ( ident_of_lb_arg lb ) ) ~ pat_loc in let pvar_of_lb_arg_list lb_arg_list = List . map mk_pvar lb_arg_list in let pat = match pvar_of_lb_arg_list sp_hd_ret with | [ p ] -> p | pl -> T . mk_pattern ( Ptuple pl ) ~ pat_loc : term_loc in ( term_loc , [ ( pat , T . term true sp_post ) ] ) |
let sp_post_no_ret sp_post = let term_loc = T . location sp_post . Uast . term_loc in let id_result = T . mk_id " result " in ( term_loc , [ ( T . mk_pattern ( Pvar id_result ) , T . term true sp_post ) ] ) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.