Skip to content
This repository was archived by the owner on Feb 27, 2023. It is now read-only.

Commit 09f626f

Browse files
fsoikinalfonsogarciacaro
authored andcommitted
Fill in missing parts in VSCode import.
Related to #12.
1 parent 612204a commit 09f626f

File tree

1 file changed

+40
-2
lines changed

1 file changed

+40
-2
lines changed

VSCode/Fable.Import.VSCode.fs

+40-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ open Fable.Core
66
open Fable.Import.JS
77

88
module vscode =
9+
let [<Import("version","vscode")>] version: string = jsNative
10+
911
type Command =
1012
abstract title: string with get, set
1113
abstract command: string with get, set
@@ -237,6 +239,16 @@ module vscode =
237239
[<Emit("$0($1...)")>] abstract Invoke: listener: Func<'T, obj> * ?thisArgs: obj * ?disposables: ResizeArray<Disposable> -> Disposable
238240

239241
and [<Import("EventEmitter","vscode")>] EventEmitter<'T>() =
242+
member __.addListener(``event``: string, listener: Function): NodeJS.EventEmitter = jsNative
243+
member __.on(``event``: string, listener: Function): NodeJS.EventEmitter = jsNative
244+
member __.once(``event``: string, listener: Function): NodeJS.EventEmitter = jsNative
245+
member __.removeListener(``event``: string, listener: Function): NodeJS.EventEmitter = jsNative
246+
member __.removeAllListeners(?``event``: string): NodeJS.EventEmitter = jsNative
247+
member __.setMaxListeners(n: int): unit = jsNative
248+
member __.getMaxListeners(): int = jsNative
249+
member __.listeners(``event``: string): ResizeArray<Function> = jsNative
250+
member __.listenerCount(``type``: string): int = jsNative
251+
member __.emit(``event``: string, [<ParamArray>] args: obj[]): bool = jsNative
240252
member __.``event`` with get(): Event<'T> = jsNative and set(v: Event<'T>): unit = jsNative
241253
member __.fire(?data: 'T): unit = jsNative
242254
member __.dispose(): unit = jsNative
@@ -293,7 +305,7 @@ module vscode =
293305
U3<string, DocumentFilter, ResizeArray<U2<string, DocumentFilter>>>
294306

295307
and ProviderResult<'T> =
296-
U3<'T, unit, obj>
308+
U3<'T, unit, PromiseLike<U2<'T, unit>>>
297309

298310
and CodeActionContext =
299311
abstract diagnostics: ResizeArray<Diagnostic> with get, set
@@ -509,6 +521,26 @@ module vscode =
509521
abstract provideDocumentLinks: document: TextDocument * token: CancellationToken -> ProviderResult<ResizeArray<DocumentLink>>
510522
abstract resolveDocumentLink: link: DocumentLink * token: CancellationToken -> ProviderResult<DocumentLink>
511523

524+
and TreeDataProvider<'T> =
525+
abstract onDidChangeTreeData: Event<'T> with get
526+
abstract getTreeItem: element:'T -> U2<TreeItem, PromiseLike<TreeItem>>
527+
abstract getChildren: ?element:'T -> ProviderResult<ResizeArray<'T>>
528+
529+
and TreeIconPath =
530+
abstract light: U2<string, Uri> with get, set
531+
abstract dark: U2<string, Uri> with get, set
532+
533+
and TreeItemCollapsibleState =
534+
| None = 0
535+
| Collapsed = 1
536+
| Expanded = 2
537+
538+
and [<Import("TreeItem","vscode")>] TreeItem(label: string, ?collapsibleState: TreeItemCollapsibleState) =
539+
abstract label: string with get, set
540+
abstract iconPath: U2<string, Uri, TreeIconPath> option with get, set
541+
abstract contextValue: string option with get, set
542+
abstract collapsibleState: TreeItemCollapsibleState option with get, set
543+
512544
and CharacterPair =
513545
string * string
514546

@@ -658,6 +690,10 @@ module vscode =
658690
abstract location: ProgressLocation with get, set
659691
abstract title: string option with get, set
660692

693+
and ProgressMessage =
694+
abstract message: string option with get,set
695+
abstract percentage: int option with get, set
696+
661697
and TextDocumentContentChangeEvent =
662698
abstract range: Range with get, set
663699
abstract rangeLength: float with get, set
@@ -727,6 +763,8 @@ module vscode =
727763

728764
type [<Import("commands","vscode")>] commands =
729765
static member registerCommand(command: string, callback: Func<obj, obj>, ?thisArg: obj): Disposable = jsNative
766+
static member registerCommand(command: string, callback: Func<obj, obj, obj>, ?thisArg: obj): Disposable = jsNative
767+
static member registerCommand(command: string, callback: Func<obj, obj, obj, obj>, ?thisArg: obj): Disposable = jsNative
730768
static member registerTextEditorCommand(command: string, callback: Func<TextEditor, TextEditorEdit, obj, unit>, ?thisArg: obj): Disposable = jsNative
731769
static member executeCommand(command: string, [<ParamArray>] rest: obj[]): PromiseLike<'T option> = jsNative
732770
static member getCommands(?filterInternal: bool): PromiseLike<ResizeArray<string>> = jsNative
@@ -763,7 +801,7 @@ module vscode =
763801
static member setStatusBarMessage(text: string, hideWhenDone: PromiseLike<obj>): Disposable = jsNative
764802
static member setStatusBarMessage(text: string): Disposable = jsNative
765803
static member withScmProgress(task: Func<Progress<float>, PromiseLike<'R>>): PromiseLike<'R> = jsNative
766-
static member withProgress(options: ProgressOptions, task: Func<Progress<obj>, PromiseLike<'R>>): PromiseLike<'R> = jsNative
804+
static member withProgress(options: ProgressOptions, task: Func<Progress<ProgressMessage>, PromiseLike<'R>>): PromiseLike<'R> = jsNative
767805
static member createStatusBarItem(?alignment: StatusBarAlignment, ?priority: float): StatusBarItem = jsNative
768806
static member createTerminal(?name: string, ?shellPath: string, ?shellArgs: ResizeArray<string>): Terminal = jsNative
769807
static member createTerminal(options: TerminalOptions): Terminal = jsNative

0 commit comments

Comments
 (0)