├── .gitignore ├── rescript.json ├── README.md ├── package.json ├── LICENSE └── src ├── VSCode.bs.js └── VSCode.res /.gitignore: -------------------------------------------------------------------------------- 1 | lib/ 2 | node_modules/ 3 | .merlin 4 | .bsb.lock -------------------------------------------------------------------------------- /rescript.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rescript-vscode", 3 | "package-specs": [ 4 | { 5 | "module": "commonjs", 6 | "in-source": true 7 | } 8 | ], 9 | "sources": { 10 | "dir": "src", 11 | "subdirs": true 12 | }, 13 | "suffix": ".bs.js", 14 | "namespace": false, 15 | "bs-dependencies": [ 16 | "@rescript/core" 17 | ], 18 | "bsc-flags": [ 19 | "-open RescriptCore", 20 | "-bs-g" 21 | ] 22 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # rescript-vscode 2 | 3 | [ReScript](https://rescript-lang.org/) bindings for the [VS Code API](https://code.visualstudio.com/api/references/vscode-api) 4 | 5 | ## Installation 6 | 7 | Simplty list it as a dependency in your `package.json`: 8 | ``` json 9 | "dependencies": { 10 | "rescript-vscode": "github:banacorn/rescript-vscode" 11 | } 12 | ``` 13 | 14 | And in your `bsconfig.json`: 15 | ``` json 16 | "bs-dependencies": [ 17 | "rescript-vscode" 18 | ], 19 | ``` 20 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rescript-vscode", 3 | "version": "0.0.38", 4 | "description": "VS Code bindings for BuckleScript", 5 | "main": "index.js", 6 | "scripts": { 7 | "build": "npx rescript build -with-deps", 8 | "dev": "npx rescript build -w" 9 | }, 10 | "repository": { 11 | "type": "git", 12 | "url": "git+https://github.com/banacorn/rescript-vscode.git" 13 | }, 14 | "keywords": [ 15 | "reason", 16 | "bucklescript", 17 | "vscode", 18 | "package", 19 | "bindings" 20 | ], 21 | "author": "Ting-Gian LUA (banacorn)", 22 | "license": "MIT", 23 | "bugs": { 24 | "url": "https://github.com/banacorn/rescript-vscode/issues" 25 | }, 26 | "homepage": "https://github.com/banacorn/rescript-vscode#readme", 27 | "dependencies": { 28 | "rescript": "^11.1.4", 29 | "@rescript/core": "^1.3.0" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/VSCode.bs.js: -------------------------------------------------------------------------------- 1 | // Generated by ReScript, PLEASE EDIT WITH CARE 2 | 'use strict'; 3 | 4 | var Js_array = require("rescript/lib/js/js_array.js"); 5 | var Belt_Option = require("rescript/lib/js/belt_Option.js"); 6 | 7 | function map(x, f) { 8 | return Belt_Option.map(x, (async function (result) { 9 | var result$p = await result; 10 | return f(result$p); 11 | })); 12 | } 13 | 14 | var ProviderResult = { 15 | map: map 16 | }; 17 | 18 | var ThemeColor = {}; 19 | 20 | var ThemeIcon = {}; 21 | 22 | function make(value) { 23 | return value._0; 24 | } 25 | 26 | function classify(v) { 27 | if (typeof v === "string") { 28 | return { 29 | TAG: "String", 30 | _0: v, 31 | [Symbol.for("name")]: "String" 32 | }; 33 | } else { 34 | return { 35 | TAG: "Others", 36 | _0: v, 37 | [Symbol.for("name")]: "Others" 38 | }; 39 | } 40 | } 41 | 42 | function map$1(xs, f) { 43 | var s = classify(xs); 44 | if (s.TAG === "String") { 45 | return s._0; 46 | } else { 47 | return ({ 48 | TAG: "Others", 49 | _0: f(s._0), 50 | [Symbol.for("name")]: "Others" 51 | })._0; 52 | } 53 | } 54 | 55 | var StringOr = { 56 | make: make, 57 | classify: classify, 58 | map: map$1 59 | }; 60 | 61 | function make$1(value) { 62 | return value._0; 63 | } 64 | 65 | function classify$1(v) { 66 | if (v.then && typeof v.then === "function") { 67 | return { 68 | TAG: "Promise", 69 | _0: v, 70 | [Symbol.for("name")]: "Promise" 71 | }; 72 | } else { 73 | return { 74 | TAG: "Others", 75 | _0: v, 76 | [Symbol.for("name")]: "Others" 77 | }; 78 | } 79 | } 80 | 81 | var PromiseOr = { 82 | make: make$1, 83 | classify: classify$1 84 | }; 85 | 86 | function array(v) { 87 | return v; 88 | } 89 | 90 | function single(v) { 91 | return v; 92 | } 93 | 94 | function classify$2(v) { 95 | if (Array.isArray(v)) { 96 | return { 97 | TAG: "Array", 98 | _0: v, 99 | [Symbol.for("name")]: "Array" 100 | }; 101 | } else { 102 | return { 103 | TAG: "Single", 104 | _0: v, 105 | [Symbol.for("name")]: "Single" 106 | }; 107 | } 108 | } 109 | 110 | function map$2(f, xs) { 111 | var s = classify$2(xs); 112 | if (s.TAG === "Array") { 113 | return Js_array.map(f, s._0); 114 | } else { 115 | return f(s._0); 116 | } 117 | } 118 | 119 | var ArrayOr = { 120 | array: array, 121 | single: single, 122 | classify: classify$2, 123 | map: map$2 124 | }; 125 | 126 | function onMessage(callback) { 127 | var onMessage$1 = (callback => window.addEventListener('message', event => callback(event.data))); 128 | onMessage$1(callback); 129 | } 130 | 131 | var Api = { 132 | onMessage: onMessage 133 | }; 134 | 135 | var Disposable = {}; 136 | 137 | var Memento = {}; 138 | 139 | var Uri = {}; 140 | 141 | var EnvironmentVariableMutatorType = {}; 142 | 143 | var Command = {}; 144 | 145 | var EnvironmentVariableMutator = {}; 146 | 147 | var EnvironmentVariableCollection = {}; 148 | 149 | var LanguageModelAccessInformation = {}; 150 | 151 | var SecretStorageChangeEvent = {}; 152 | 153 | var SecretStorage = {}; 154 | 155 | var ExtensionMode = {}; 156 | 157 | var ExtensionKind = {}; 158 | 159 | var Extension = {}; 160 | 161 | var ExtensionContext = {}; 162 | 163 | var simple = {}; 164 | 165 | function sized(v) { 166 | return v; 167 | } 168 | 169 | var Layout = { 170 | simple: simple, 171 | sized: sized 172 | }; 173 | 174 | var Commands = { 175 | Layout: Layout 176 | }; 177 | 178 | var DebugConsole = {}; 179 | 180 | var DebugConfiguration = {}; 181 | 182 | var WorkspaceFolder = {}; 183 | 184 | var Breakpoint = {}; 185 | 186 | var DebugProtocolBreakpoint = {}; 187 | 188 | var DebugSession = {}; 189 | 190 | var BreakpointsChangeEvent = {}; 191 | 192 | var DebugSessionCustomEvent = {}; 193 | 194 | var DebugProtocolSource = {}; 195 | 196 | var DebugAdapterExecutableOptions = {}; 197 | 198 | var DebugAdapterExecutable = {}; 199 | 200 | var DebugAdapterDescriptorFactory = {}; 201 | 202 | var Debug = {}; 203 | 204 | var Clipboard = {}; 205 | 206 | var UIKind = {}; 207 | 208 | var Env = {}; 209 | 210 | var ViewColumn = {}; 211 | 212 | var WebviewPortMapping = {}; 213 | 214 | var WebviewOptions = {}; 215 | 216 | var Webview = {}; 217 | 218 | var WebviewPanelOnDidChangeViewStateEvent = {}; 219 | 220 | var WebviewPanel = {}; 221 | 222 | var Position = {}; 223 | 224 | var $$Range = {}; 225 | 226 | var TextLine = {}; 227 | 228 | var EndOfLine = {}; 229 | 230 | var TextDocument = {}; 231 | 232 | var TextEditorCursorStyle = {}; 233 | 234 | var TextEditorLineNumbersStyle = {}; 235 | 236 | var TextEditorOptions = {}; 237 | 238 | var $$Selection = {}; 239 | 240 | var TextEditorEdit = {}; 241 | 242 | var SnippetString = {}; 243 | 244 | var SnippetTextEdit = {}; 245 | 246 | var TextEditorRevealType = {}; 247 | 248 | var TextEditorDecorationType = {}; 249 | 250 | var MarkdownString = {}; 251 | 252 | var ThemableDecorationAttachmentRenderOptions = {}; 253 | 254 | var ThemableDecorationInstanceRenderOptions = {}; 255 | 256 | var DecorationInstanceRenderOptions = {}; 257 | 258 | var DecorationOptions = {}; 259 | 260 | var TextEditor = {}; 261 | 262 | var TerminalOptions = {}; 263 | 264 | var TerminalDimensions = {}; 265 | 266 | var Pseudoterminal = {}; 267 | 268 | var ExtensionTerminalOptions = {}; 269 | 270 | function terminalOptions(v) { 271 | return v; 272 | } 273 | 274 | function extensionTerminalOptions(v) { 275 | return v; 276 | } 277 | 278 | function classify$3(v) { 279 | if ((v.hasOwnProperty('pty'))) { 280 | return { 281 | TAG: "ExtensionTerminalOptions", 282 | _0: v, 283 | [Symbol.for("name")]: "ExtensionTerminalOptions" 284 | }; 285 | } else { 286 | return { 287 | TAG: "TerminalOptions", 288 | _0: v, 289 | [Symbol.for("name")]: "TerminalOptions" 290 | }; 291 | } 292 | } 293 | 294 | var TerminalOptionsOrExtensionTerminalOptions = { 295 | terminalOptions: terminalOptions, 296 | extensionTerminalOptions: extensionTerminalOptions, 297 | classify: classify$3 298 | }; 299 | 300 | var Terminal = {}; 301 | 302 | var WindowState = {}; 303 | 304 | var TextEditorOptionsChangeEvent = {}; 305 | 306 | var TextEditorSelectionChangeKind = {}; 307 | 308 | var TextEditorSelectionChangeEvent = {}; 309 | 310 | var TextEditorViewColumnChangeEvent = {}; 311 | 312 | var TextEditorVisibleRangesChangeEvent = {}; 313 | 314 | var InputBox = {}; 315 | 316 | var OutputChannel = {}; 317 | 318 | function $$case(raw) { 319 | var match = raw["color"]; 320 | if (match !== undefined) { 321 | return { 322 | TAG: "Uri", 323 | _0: raw, 324 | [Symbol.for("name")]: "Uri" 325 | }; 326 | } 327 | var match$1 = raw["dark"]; 328 | if (match$1 !== undefined) { 329 | return { 330 | TAG: "DarkAndLight", 331 | _0: raw, 332 | [Symbol.for("name")]: "DarkAndLight" 333 | }; 334 | } else { 335 | return { 336 | TAG: "ThemeIcon", 337 | _0: raw, 338 | [Symbol.for("name")]: "ThemeIcon" 339 | }; 340 | } 341 | } 342 | 343 | var IconPath = { 344 | $$case: $$case 345 | }; 346 | 347 | var QuickInput = {}; 348 | 349 | var QuickInputButton = {}; 350 | 351 | var QuickInputButtons = {}; 352 | 353 | var QuickPickItemKind = {}; 354 | 355 | var QuickPickItem = {}; 356 | 357 | var QuickPickItemButtonEvent = {}; 358 | 359 | var QuickPickOptions = {}; 360 | 361 | var QuickPick = {}; 362 | 363 | var AccessibilityInformation = {}; 364 | 365 | var StatusBarAlignment = {}; 366 | 367 | var StatusBarItem = {}; 368 | 369 | var OverviewRulerLane = {}; 370 | 371 | var DecorationRangeBehavior = {}; 372 | 373 | var DecorationRenderOptions = {}; 374 | 375 | var TreeViewOptions = {}; 376 | 377 | var TreeView = {}; 378 | 379 | function make$2(enableCommandUris, enableScripts, localResourceRoots, portMapping, enableFindWidget, retainContextWhenHidden, param) { 380 | return { 381 | enableCommandUris: enableCommandUris, 382 | enableScripts: enableScripts, 383 | localResourceRoots: localResourceRoots, 384 | portMapping: portMapping, 385 | enableFindWidget: enableFindWidget, 386 | retainContextWhenHidden: retainContextWhenHidden 387 | }; 388 | } 389 | 390 | var WebviewAndWebviewPanelOptions = { 391 | make: make$2 392 | }; 393 | 394 | var TreeDataProvider = {}; 395 | 396 | var WebviewPanelSerializer = {}; 397 | 398 | var MessageItem = {}; 399 | 400 | var MessageOptions = {}; 401 | 402 | var InputBoxValidationSeverity = {}; 403 | 404 | var InputBoxValidationMessage = {}; 405 | 406 | var InputBoxOptions = {}; 407 | 408 | var CancellationToken = {}; 409 | 410 | var CancellationTokenSource = {}; 411 | 412 | var QuickDiffProvider = {}; 413 | 414 | var ReferenceContext = {}; 415 | 416 | var OpenDialogOptions = {}; 417 | 418 | var SaveDialogOptions = {}; 419 | 420 | var WorkspaceFolderPickOptions = {}; 421 | 422 | var Progress = {}; 423 | 424 | var ProgressLocation = {}; 425 | 426 | var ProgressOptions = {}; 427 | 428 | var ProcessOptionsWithViewIdAsLocation = {}; 429 | 430 | function make$3(preserveFocus, preview, selection, viewColumn, param) { 431 | return { 432 | preserveFocus: preserveFocus, 433 | preview: preview, 434 | selection: selection, 435 | viewColumn: viewColumn 436 | }; 437 | } 438 | 439 | var TextDocumentShowOptions = { 440 | make: make$3 441 | }; 442 | 443 | var ColorThemeKind = {}; 444 | 445 | var ColorTheme = {}; 446 | 447 | var CustomDocumentOpenContext = {}; 448 | 449 | var CustomReadonlyEditorProvider = {}; 450 | 451 | var CustomTextEditorProvider = {}; 452 | 453 | var CustomEditorProvider = {}; 454 | 455 | var TerminalLinkProvider = {}; 456 | 457 | var WebviewView = {}; 458 | 459 | var WebviewViewResolveContext = {}; 460 | 461 | var WebviewViewProvider = {}; 462 | 463 | var UriHandler = {}; 464 | 465 | var FileDecoration = {}; 466 | 467 | var FileDecorationProvider = {}; 468 | 469 | var $$Window = {}; 470 | 471 | var FileType = {}; 472 | 473 | var FilePermission = {}; 474 | 475 | var FileRenameEvent = {}; 476 | 477 | var FileDeleteEvent = {}; 478 | 479 | var FileStat = {}; 480 | 481 | var FoldingRangeKind = {}; 482 | 483 | var FoldingRange = {}; 484 | 485 | var FoldingContext = {}; 486 | 487 | var FoldingRangeProvider = {}; 488 | 489 | var FormattingOptions = {}; 490 | 491 | var FunctionBreakpoint = {}; 492 | 493 | var TelemetrySender = {}; 494 | 495 | var TelemetryTrustedValue = {}; 496 | 497 | var LogLevel = {}; 498 | 499 | var LogOutputChannel = {}; 500 | 501 | var FileSystemError = {}; 502 | 503 | var FileSystem = {}; 504 | 505 | var ConfigurationChangeEvent = {}; 506 | 507 | var TextDocumentContentChangeEvent = {}; 508 | 509 | var TextDocumentChangeReason = {}; 510 | 511 | var TextDocumentChangeEvent = {}; 512 | 513 | var WorkspaceFoldersChangeEvent = {}; 514 | 515 | var FileCreateEvent = {}; 516 | 517 | var FileChangeType = {}; 518 | 519 | var FileChangeEvent = {}; 520 | 521 | var WorkspaceEditEntryMetadata = {}; 522 | 523 | var TextEdit = {}; 524 | 525 | function entries(self) { 526 | return self.entries().map(function (shit) { 527 | var toUri = (function (shit) { return shit[0] }); 528 | var toTextEdits = (function (shit) { return shit[1] }); 529 | return [ 530 | toUri(shit), 531 | toTextEdits(shit) 532 | ]; 533 | }); 534 | } 535 | 536 | var WorkspaceEdit = { 537 | entries: entries 538 | }; 539 | 540 | var RenameProvider = {}; 541 | 542 | var FileWillCreateEvent = {}; 543 | 544 | var FileWillDeleteEvent = {}; 545 | 546 | var FileWillRenameEvent = {}; 547 | 548 | var TextDocumentSaveReason = {}; 549 | 550 | var TextDocumentWillSaveEvent = {}; 551 | 552 | var RelativePattern = {}; 553 | 554 | var GlobPattern = {}; 555 | 556 | var FileSystemWatcher = {}; 557 | 558 | var WorkspaceConfiguration = {}; 559 | 560 | var TextDocumentContentProvider = {}; 561 | 562 | var TaskProvider = {}; 563 | 564 | var FileSystemProvider = {}; 565 | 566 | var Workspace = {}; 567 | 568 | var Extensions = {}; 569 | 570 | var DiagnosticChangeEvent = {}; 571 | 572 | var $$Location = {}; 573 | 574 | var SourceBreakpoint = {}; 575 | 576 | var ReferenceProvider = {}; 577 | 578 | var RunOptions = {}; 579 | 580 | var TaskDefinition = {}; 581 | 582 | var TaskFilter = {}; 583 | 584 | var TaskGroup = {}; 585 | 586 | var TaskPanelKind = {}; 587 | 588 | var TaskRevealKind = {}; 589 | 590 | var TaskPresentationOptions = {}; 591 | 592 | var TaskScope = {}; 593 | 594 | var TaskExecution = {}; 595 | 596 | var TaskStartEvent = {}; 597 | 598 | var TaskProcessEndEvent = {}; 599 | 600 | var TaskProcessStartEvent = {}; 601 | 602 | var ProcessExecutionOptions = {}; 603 | 604 | var ProcessExecution = {}; 605 | 606 | var LocationLink = {}; 607 | 608 | var DiagnosticRelatedInformation = {}; 609 | 610 | var DiagnosticSeverity = {}; 611 | 612 | var DiagnosticTag = {}; 613 | 614 | var Diagnostic = {}; 615 | 616 | var DocumentFilter = {}; 617 | 618 | var DocumentSelector = {}; 619 | 620 | var DiagnosticCollection = {}; 621 | 622 | var CallHierarchyItem = {}; 623 | 624 | var CallHierarchyOutgoingCall = {}; 625 | 626 | var CallHierarchyIncomingCall = {}; 627 | 628 | var CallHierarchyProvider = {}; 629 | 630 | var CodeActionProvider = {}; 631 | 632 | var CodeActionProviderMetadata = {}; 633 | 634 | var CodeLens = {}; 635 | 636 | var CodeLensProvider = {}; 637 | 638 | var DocumentColorProvider = {}; 639 | 640 | var CompletionItemProvider = {}; 641 | 642 | var DeclarationProvider = {}; 643 | 644 | var Hover = {}; 645 | 646 | var HoverProvider = {}; 647 | 648 | function locations(v) { 649 | return v; 650 | } 651 | 652 | function locationLinks(v) { 653 | return v; 654 | } 655 | 656 | function classify$4(v) { 657 | if ((function (a) { return a.targetRange === undefined})(v)) { 658 | return { 659 | TAG: "Location", 660 | _0: v, 661 | [Symbol.for("name")]: "Location" 662 | }; 663 | } else { 664 | return { 665 | TAG: "LocationLink", 666 | _0: v, 667 | [Symbol.for("name")]: "LocationLink" 668 | }; 669 | } 670 | } 671 | 672 | var LocationLinkOrLocation = { 673 | locations: locations, 674 | locationLinks: locationLinks, 675 | classify: classify$4 676 | }; 677 | 678 | var DefinitionProvider = {}; 679 | 680 | var SemanticsTokens = {}; 681 | 682 | var SemanticTokensLegend = {}; 683 | 684 | var SemanticTokensBuilder = {}; 685 | 686 | var DocumentSemanticTokensProvider = {}; 687 | 688 | var Languages = {}; 689 | 690 | exports.ProviderResult = ProviderResult; 691 | exports.ThemeColor = ThemeColor; 692 | exports.ThemeIcon = ThemeIcon; 693 | exports.StringOr = StringOr; 694 | exports.PromiseOr = PromiseOr; 695 | exports.ArrayOr = ArrayOr; 696 | exports.Api = Api; 697 | exports.Disposable = Disposable; 698 | exports.Memento = Memento; 699 | exports.Uri = Uri; 700 | exports.EnvironmentVariableMutatorType = EnvironmentVariableMutatorType; 701 | exports.Command = Command; 702 | exports.EnvironmentVariableMutator = EnvironmentVariableMutator; 703 | exports.EnvironmentVariableCollection = EnvironmentVariableCollection; 704 | exports.LanguageModelAccessInformation = LanguageModelAccessInformation; 705 | exports.SecretStorageChangeEvent = SecretStorageChangeEvent; 706 | exports.SecretStorage = SecretStorage; 707 | exports.ExtensionMode = ExtensionMode; 708 | exports.ExtensionKind = ExtensionKind; 709 | exports.Extension = Extension; 710 | exports.ExtensionContext = ExtensionContext; 711 | exports.Commands = Commands; 712 | exports.DebugConsole = DebugConsole; 713 | exports.DebugConfiguration = DebugConfiguration; 714 | exports.WorkspaceFolder = WorkspaceFolder; 715 | exports.Breakpoint = Breakpoint; 716 | exports.DebugProtocolBreakpoint = DebugProtocolBreakpoint; 717 | exports.DebugSession = DebugSession; 718 | exports.BreakpointsChangeEvent = BreakpointsChangeEvent; 719 | exports.DebugSessionCustomEvent = DebugSessionCustomEvent; 720 | exports.DebugProtocolSource = DebugProtocolSource; 721 | exports.DebugAdapterExecutableOptions = DebugAdapterExecutableOptions; 722 | exports.DebugAdapterExecutable = DebugAdapterExecutable; 723 | exports.DebugAdapterDescriptorFactory = DebugAdapterDescriptorFactory; 724 | exports.Debug = Debug; 725 | exports.Clipboard = Clipboard; 726 | exports.UIKind = UIKind; 727 | exports.Env = Env; 728 | exports.ViewColumn = ViewColumn; 729 | exports.WebviewPortMapping = WebviewPortMapping; 730 | exports.WebviewOptions = WebviewOptions; 731 | exports.Webview = Webview; 732 | exports.WebviewPanelOnDidChangeViewStateEvent = WebviewPanelOnDidChangeViewStateEvent; 733 | exports.WebviewPanel = WebviewPanel; 734 | exports.Position = Position; 735 | exports.$$Range = $$Range; 736 | exports.TextLine = TextLine; 737 | exports.EndOfLine = EndOfLine; 738 | exports.TextDocument = TextDocument; 739 | exports.TextEditorCursorStyle = TextEditorCursorStyle; 740 | exports.TextEditorLineNumbersStyle = TextEditorLineNumbersStyle; 741 | exports.TextEditorOptions = TextEditorOptions; 742 | exports.$$Selection = $$Selection; 743 | exports.TextEditorEdit = TextEditorEdit; 744 | exports.SnippetString = SnippetString; 745 | exports.SnippetTextEdit = SnippetTextEdit; 746 | exports.TextEditorRevealType = TextEditorRevealType; 747 | exports.TextEditorDecorationType = TextEditorDecorationType; 748 | exports.MarkdownString = MarkdownString; 749 | exports.ThemableDecorationAttachmentRenderOptions = ThemableDecorationAttachmentRenderOptions; 750 | exports.ThemableDecorationInstanceRenderOptions = ThemableDecorationInstanceRenderOptions; 751 | exports.DecorationInstanceRenderOptions = DecorationInstanceRenderOptions; 752 | exports.DecorationOptions = DecorationOptions; 753 | exports.TextEditor = TextEditor; 754 | exports.TerminalOptions = TerminalOptions; 755 | exports.TerminalDimensions = TerminalDimensions; 756 | exports.Pseudoterminal = Pseudoterminal; 757 | exports.ExtensionTerminalOptions = ExtensionTerminalOptions; 758 | exports.TerminalOptionsOrExtensionTerminalOptions = TerminalOptionsOrExtensionTerminalOptions; 759 | exports.Terminal = Terminal; 760 | exports.WindowState = WindowState; 761 | exports.TextEditorOptionsChangeEvent = TextEditorOptionsChangeEvent; 762 | exports.TextEditorSelectionChangeKind = TextEditorSelectionChangeKind; 763 | exports.TextEditorSelectionChangeEvent = TextEditorSelectionChangeEvent; 764 | exports.TextEditorViewColumnChangeEvent = TextEditorViewColumnChangeEvent; 765 | exports.TextEditorVisibleRangesChangeEvent = TextEditorVisibleRangesChangeEvent; 766 | exports.InputBox = InputBox; 767 | exports.OutputChannel = OutputChannel; 768 | exports.IconPath = IconPath; 769 | exports.QuickInput = QuickInput; 770 | exports.QuickInputButton = QuickInputButton; 771 | exports.QuickInputButtons = QuickInputButtons; 772 | exports.QuickPickItemKind = QuickPickItemKind; 773 | exports.QuickPickItem = QuickPickItem; 774 | exports.QuickPickItemButtonEvent = QuickPickItemButtonEvent; 775 | exports.QuickPickOptions = QuickPickOptions; 776 | exports.QuickPick = QuickPick; 777 | exports.AccessibilityInformation = AccessibilityInformation; 778 | exports.StatusBarAlignment = StatusBarAlignment; 779 | exports.StatusBarItem = StatusBarItem; 780 | exports.OverviewRulerLane = OverviewRulerLane; 781 | exports.DecorationRangeBehavior = DecorationRangeBehavior; 782 | exports.DecorationRenderOptions = DecorationRenderOptions; 783 | exports.TreeViewOptions = TreeViewOptions; 784 | exports.TreeView = TreeView; 785 | exports.WebviewAndWebviewPanelOptions = WebviewAndWebviewPanelOptions; 786 | exports.TreeDataProvider = TreeDataProvider; 787 | exports.WebviewPanelSerializer = WebviewPanelSerializer; 788 | exports.MessageItem = MessageItem; 789 | exports.MessageOptions = MessageOptions; 790 | exports.InputBoxValidationSeverity = InputBoxValidationSeverity; 791 | exports.InputBoxValidationMessage = InputBoxValidationMessage; 792 | exports.InputBoxOptions = InputBoxOptions; 793 | exports.CancellationToken = CancellationToken; 794 | exports.CancellationTokenSource = CancellationTokenSource; 795 | exports.QuickDiffProvider = QuickDiffProvider; 796 | exports.ReferenceContext = ReferenceContext; 797 | exports.OpenDialogOptions = OpenDialogOptions; 798 | exports.SaveDialogOptions = SaveDialogOptions; 799 | exports.WorkspaceFolderPickOptions = WorkspaceFolderPickOptions; 800 | exports.Progress = Progress; 801 | exports.ProgressLocation = ProgressLocation; 802 | exports.ProgressOptions = ProgressOptions; 803 | exports.ProcessOptionsWithViewIdAsLocation = ProcessOptionsWithViewIdAsLocation; 804 | exports.TextDocumentShowOptions = TextDocumentShowOptions; 805 | exports.ColorThemeKind = ColorThemeKind; 806 | exports.ColorTheme = ColorTheme; 807 | exports.CustomDocumentOpenContext = CustomDocumentOpenContext; 808 | exports.CustomReadonlyEditorProvider = CustomReadonlyEditorProvider; 809 | exports.CustomTextEditorProvider = CustomTextEditorProvider; 810 | exports.CustomEditorProvider = CustomEditorProvider; 811 | exports.TerminalLinkProvider = TerminalLinkProvider; 812 | exports.WebviewView = WebviewView; 813 | exports.WebviewViewResolveContext = WebviewViewResolveContext; 814 | exports.WebviewViewProvider = WebviewViewProvider; 815 | exports.UriHandler = UriHandler; 816 | exports.FileDecoration = FileDecoration; 817 | exports.FileDecorationProvider = FileDecorationProvider; 818 | exports.$$Window = $$Window; 819 | exports.FileType = FileType; 820 | exports.FilePermission = FilePermission; 821 | exports.FileRenameEvent = FileRenameEvent; 822 | exports.FileDeleteEvent = FileDeleteEvent; 823 | exports.FileStat = FileStat; 824 | exports.FoldingRangeKind = FoldingRangeKind; 825 | exports.FoldingRange = FoldingRange; 826 | exports.FoldingContext = FoldingContext; 827 | exports.FoldingRangeProvider = FoldingRangeProvider; 828 | exports.FormattingOptions = FormattingOptions; 829 | exports.FunctionBreakpoint = FunctionBreakpoint; 830 | exports.TelemetrySender = TelemetrySender; 831 | exports.TelemetryTrustedValue = TelemetryTrustedValue; 832 | exports.LogLevel = LogLevel; 833 | exports.LogOutputChannel = LogOutputChannel; 834 | exports.FileSystemError = FileSystemError; 835 | exports.FileSystem = FileSystem; 836 | exports.ConfigurationChangeEvent = ConfigurationChangeEvent; 837 | exports.TextDocumentContentChangeEvent = TextDocumentContentChangeEvent; 838 | exports.TextDocumentChangeReason = TextDocumentChangeReason; 839 | exports.TextDocumentChangeEvent = TextDocumentChangeEvent; 840 | exports.WorkspaceFoldersChangeEvent = WorkspaceFoldersChangeEvent; 841 | exports.FileCreateEvent = FileCreateEvent; 842 | exports.FileChangeType = FileChangeType; 843 | exports.FileChangeEvent = FileChangeEvent; 844 | exports.WorkspaceEditEntryMetadata = WorkspaceEditEntryMetadata; 845 | exports.TextEdit = TextEdit; 846 | exports.WorkspaceEdit = WorkspaceEdit; 847 | exports.RenameProvider = RenameProvider; 848 | exports.FileWillCreateEvent = FileWillCreateEvent; 849 | exports.FileWillDeleteEvent = FileWillDeleteEvent; 850 | exports.FileWillRenameEvent = FileWillRenameEvent; 851 | exports.TextDocumentSaveReason = TextDocumentSaveReason; 852 | exports.TextDocumentWillSaveEvent = TextDocumentWillSaveEvent; 853 | exports.RelativePattern = RelativePattern; 854 | exports.GlobPattern = GlobPattern; 855 | exports.FileSystemWatcher = FileSystemWatcher; 856 | exports.WorkspaceConfiguration = WorkspaceConfiguration; 857 | exports.TextDocumentContentProvider = TextDocumentContentProvider; 858 | exports.TaskProvider = TaskProvider; 859 | exports.FileSystemProvider = FileSystemProvider; 860 | exports.Workspace = Workspace; 861 | exports.Extensions = Extensions; 862 | exports.DiagnosticChangeEvent = DiagnosticChangeEvent; 863 | exports.$$Location = $$Location; 864 | exports.SourceBreakpoint = SourceBreakpoint; 865 | exports.ReferenceProvider = ReferenceProvider; 866 | exports.RunOptions = RunOptions; 867 | exports.TaskDefinition = TaskDefinition; 868 | exports.TaskFilter = TaskFilter; 869 | exports.TaskGroup = TaskGroup; 870 | exports.TaskPanelKind = TaskPanelKind; 871 | exports.TaskRevealKind = TaskRevealKind; 872 | exports.TaskPresentationOptions = TaskPresentationOptions; 873 | exports.TaskScope = TaskScope; 874 | exports.TaskExecution = TaskExecution; 875 | exports.TaskStartEvent = TaskStartEvent; 876 | exports.TaskProcessEndEvent = TaskProcessEndEvent; 877 | exports.TaskProcessStartEvent = TaskProcessStartEvent; 878 | exports.ProcessExecutionOptions = ProcessExecutionOptions; 879 | exports.ProcessExecution = ProcessExecution; 880 | exports.LocationLink = LocationLink; 881 | exports.DiagnosticRelatedInformation = DiagnosticRelatedInformation; 882 | exports.DiagnosticSeverity = DiagnosticSeverity; 883 | exports.DiagnosticTag = DiagnosticTag; 884 | exports.Diagnostic = Diagnostic; 885 | exports.DocumentFilter = DocumentFilter; 886 | exports.DocumentSelector = DocumentSelector; 887 | exports.DiagnosticCollection = DiagnosticCollection; 888 | exports.CallHierarchyItem = CallHierarchyItem; 889 | exports.CallHierarchyOutgoingCall = CallHierarchyOutgoingCall; 890 | exports.CallHierarchyIncomingCall = CallHierarchyIncomingCall; 891 | exports.CallHierarchyProvider = CallHierarchyProvider; 892 | exports.CodeActionProvider = CodeActionProvider; 893 | exports.CodeActionProviderMetadata = CodeActionProviderMetadata; 894 | exports.CodeLens = CodeLens; 895 | exports.CodeLensProvider = CodeLensProvider; 896 | exports.DocumentColorProvider = DocumentColorProvider; 897 | exports.CompletionItemProvider = CompletionItemProvider; 898 | exports.DeclarationProvider = DeclarationProvider; 899 | exports.Hover = Hover; 900 | exports.HoverProvider = HoverProvider; 901 | exports.LocationLinkOrLocation = LocationLinkOrLocation; 902 | exports.DefinitionProvider = DefinitionProvider; 903 | exports.SemanticsTokens = SemanticsTokens; 904 | exports.SemanticTokensLegend = SemanticTokensLegend; 905 | exports.SemanticTokensBuilder = SemanticTokensBuilder; 906 | exports.DocumentSemanticTokensProvider = DocumentSemanticTokensProvider; 907 | exports.Languages = Languages; 908 | /* No side effect */ 909 | -------------------------------------------------------------------------------- /src/VSCode.res: -------------------------------------------------------------------------------- 1 | // https://code.visualstudio.com/api/references/vscode-api#ProviderResult 2 | // 1.52.0 3 | module ProviderResult = { 4 | type t<'a> = option> 5 | let map = (x, f) => 6 | x->Belt.Option.map(async result => { 7 | let result' = await result 8 | f(result') 9 | }) 10 | } 11 | 12 | // https://code.visualstudio.com/api/references/vscode-api#ThemeColor 13 | module ThemeColor = { 14 | type t 15 | // constructors 16 | @module("vscode") @new external make: string => t = "ThemeColor" 17 | } 18 | 19 | // https://code.visualstudio.com/api/references/vscode-api#ThemeIcon 20 | // 1.95 21 | module ThemeIcon = { 22 | type t 23 | 24 | // constructors 25 | @module("vscode") @new 26 | external make: (string, option) => t = "ThemeIcon" 27 | 28 | // static properties 29 | @module("vscode") @scope("ThemeIcon") 30 | external file: t = "File" 31 | 32 | @module("vscode") @scope("ThemeIcon") 33 | external folder: t = "Folder" 34 | 35 | // properties 36 | @get external color: t => option = "color" 37 | @get external id: t => string = "id" 38 | } 39 | 40 | // "string | xxx", for modeling the union type of String and something else 41 | module StringOr: { 42 | type t<'a> 43 | type case<'a> = 44 | | String(string) 45 | | Others('a) 46 | let make: case<'a> => t<'a> 47 | let classify: t<'a> => case<'a> 48 | let map: (t<'a>, 'a => 'b) => t<'b> 49 | } = { 50 | @unboxed type rec t<'a> = Any('x): t<'a> 51 | type case<'a> = 52 | | String(string) 53 | | Others('a) 54 | let make = (value: case<'a>): t<'a> => 55 | switch value { 56 | | String(string) => Any(string) 57 | | Others(others) => Any(others) 58 | } 59 | let classify = (Any(v): t<'a>): case<'a> => 60 | if Js.typeof(v) == "string" { 61 | String((Obj.magic(v): string)) 62 | } else { 63 | Others((Obj.magic(v): 'a)) 64 | } 65 | let map = (xs: t<'a>, f: 'a => 'b): t<'b> => 66 | switch classify(xs) { 67 | | String(s) => make(String(s)) 68 | | Others(x) => make(Others(f(x))) 69 | } 70 | } 71 | 72 | // "A | promise", for modeling the union type of something and promise of that thing 73 | module PromiseOr: { 74 | type t<'a> 75 | type case<'a> = 76 | | Others('a) 77 | | Promise(promise<'a>) 78 | let make: case<'a> => t<'a> 79 | let classify: t<'a> => case<'a> 80 | } = { 81 | @unboxed type rec t<'a> = Any('x): t<'a> 82 | type case<'a> = 83 | | Others('a) 84 | | Promise(promise<'a>) 85 | let make = (value: case<'a>): t<'a> => 86 | switch value { 87 | | Others(value) => Any(value) 88 | | Promise(promise) => Any(promise) 89 | } 90 | let classify = (Any(v): t<'a>): case<'a> => 91 | if Obj.magic(v)["then"] && Js.typeof(Obj.magic(v)["then"]) == "function" { 92 | Promise((Obj.magic(v): promise<'a>)) 93 | } else { 94 | Others((Obj.magic(v): 'a)) 95 | } 96 | } 97 | 98 | // "A | A[]", for modeling the union type of something or array of that thing 99 | module ArrayOr: { 100 | type t<'a> 101 | type case<'a> = 102 | | Array(array<'a>) 103 | | Single('a) 104 | let array: array<'a> => t<'a> 105 | let single: 'a => t<'a> 106 | let classify: t<'a> => case<'a> 107 | let map: ('a => 'b, t<'a>) => t<'b> 108 | } = { 109 | @unboxed 110 | type rec t<'a> = Any('x): t<'a> 111 | type case<'a> = 112 | | Array(array<'a>) 113 | | Single('a) 114 | let array = (v: array<'a>) => Any(v) 115 | let single = (v: 'a) => Any(v) 116 | let classify = (Any(v): t<'a>): case<'a> => 117 | if Js.Array.isArray(v) { 118 | Array((Obj.magic(v): array<'a>)) 119 | } else { 120 | Single((Obj.magic(v): 'a)) 121 | } 122 | let map = (f: 'a => 'b, xs: t<'a>): t<'b> => 123 | switch classify(xs) { 124 | | Array(s) => array(Js.Array.map(f, s)) 125 | | Single(x) => single(f(x)) 126 | } 127 | } 128 | 129 | module Api = { 130 | type t 131 | 132 | @val external acquireVsCodeApi: unit => t = "acquireVsCodeApi" 133 | 134 | @send external postMessage: (t, 'a) => unit = "postMessage" 135 | 136 | let onMessage = (callback: 'a => unit): unit => { 137 | let onMessage = %raw( 138 | "callback => window.addEventListener('message', event => callback(event.data))" 139 | ) 140 | onMessage(callback) 141 | } 142 | } 143 | 144 | module Disposable = { 145 | type t 146 | // static 147 | @module("vscode") @scope("Disposable") 148 | external from: array<{"dispose": unit => 'a}> => t = "from" 149 | // constructor 150 | @module("vscode") @new 151 | external make: (unit => unit) => t = "Disposable" 152 | // methods 153 | @send external dispose: t => 'a = "dispose" 154 | } 155 | 156 | // https://code.visualstudio.com/api/references/vscode-api#Event 157 | // 158 | // UPDATE: deprecated at the moment, because somehow `('a => unit) => Disposable.t` causes function to be curried while the expaneded `('a => unit) => Disposable.t` does not 159 | // 160 | // module Event = { 161 | // type t<'a> = ('a => unit) => Disposable.t 162 | // } 163 | 164 | // https://code.visualstudio.com/api/references/vscode-api#Memento 165 | // 1.96 166 | module Memento = { 167 | type t 168 | // methods 169 | @send external get: (t, string) => option<'a> = "get" 170 | @send external getWithDefault: (t, string, 'a) => 'a = "get" 171 | @send external keys: t => array = "keys" 172 | @send external update: (t, string, 'a) => promise = "update" 173 | } 174 | 175 | // https://code.visualstudio.com/api/references/vscode-api#Uri 176 | // 1.96 177 | module Uri = { 178 | type t 179 | type components = { 180 | scheme: string, 181 | authority?: string, 182 | path?: string, 183 | query?: string, 184 | fragment?: string, 185 | } 186 | 187 | // static 188 | @module("vscode") @scope("Uri") external file: string => t = "file" 189 | @module("vscode") @scope("Uri") external from: components => t = "from" 190 | @module("vscode") @scope("Uri") @variadic 191 | external joinPath: (t, array) => t = "joinPath" 192 | @module("vscode") @scope("Uri") 193 | external parse: (string, ~strict: bool=?) => t = "parse" 194 | 195 | // constructors 196 | @new 197 | external make: ( 198 | ~scheme: string, 199 | ~authority: string, 200 | ~path: string, 201 | ~query: string, 202 | ~fragment: string, 203 | ) => t = "Uri" 204 | 205 | // properties 206 | @get external authority: t => string = "authority" 207 | @get external fragment: t => string = "fragment" 208 | @get external fsPath: t => string = "fsPath" 209 | @get external path: t => string = "path" 210 | @get external query: t => string = "query" 211 | @get external scheme: t => string = "scheme" 212 | 213 | // methods 214 | @send external toJSON: t => Js.Json.t = "toJSON" 215 | @send external toString: (t, ~skipEncoding: bool=?) => string = "toString" 216 | @send external with_: (t, components) => t = "with" 217 | } 218 | 219 | // https://code.visualstudio.com/api/references/vscode-api#EnvironmentVariableMutatorType 220 | // 1.95.0 221 | module EnvironmentVariableMutatorType = { 222 | type t = 223 | | @as(1) Replace 224 | | @as(2) Append 225 | | @as(3) Prepend 226 | } 227 | 228 | // https://code.visualstudio.com/api/references/vscode-api#Command 229 | // 1.55.0 230 | module Command = { 231 | type t 232 | // properties 233 | @get external arguments: t => option> = "arguments" 234 | @get external command: t => string = "command" 235 | @get external title: t => string = "title" 236 | @get external tooltip: t => option = "tooltip" 237 | } 238 | // module Command = { 239 | // type t<'a> = { 240 | // arguments: option>, 241 | // command: string, 242 | // title: string, 243 | // tooltip: option, 244 | // } 245 | // } 246 | 247 | // https://code.visualstudio.com/api/references/vscode-api#EnvironmentVariableMutator 248 | // 1.52.0 249 | module EnvironmentVariableMutator = { 250 | type t 251 | // properties 252 | @get external type_: EnvironmentVariableMutatorType.t => int = "type" 253 | @get external value: t => bool = "value" 254 | } 255 | 256 | // https://code.visualstudio.com/api/references/vscode-api#EnvironmentVariableCollection 257 | // 1.52.0 258 | module EnvironmentVariableCollection = { 259 | type t 260 | // properties 261 | @get external persistent: t => bool = "persistent" 262 | // methods 263 | @send external append: (t, string, string) => unit = "append" 264 | @send external clear: t => unit = "clear" 265 | @send external delete: (t, string) => unit = "delete" 266 | @send 267 | external forEach: (t, (string, EnvironmentVariableMutator.t, t) => 'a) => unit = "forEach" 268 | @send 269 | external forEachWithThisArg: (t, (string, EnvironmentVariableMutator.t, t) => 'a, 'b) => unit = 270 | "forEach" 271 | @send external get: (t, string) => option = "get" 272 | @send external prepend: (t, string, string) => unit = "prepend" 273 | @send external replace: (t, string, string) => unit = "replace" 274 | } 275 | 276 | // https://code.visualstudio.com/api/references/vscode-api#LanguageModelAccessInformation 277 | // 1.95 278 | module LanguageModelAccessInformation = { 279 | type t 280 | // events 281 | @send external onDidChange: (t, unit => unit) => Disposable.t = "onDidChange" 282 | // methods 283 | // @send external canSendRequests: (t, %todo) => bool = "canSendRequests" 284 | } 285 | 286 | // https://code.visualstudio.com/api/references/vscode-api#SecretStorageChangeEvent 287 | // 1.95 288 | module SecretStorageChangeEvent = { 289 | type t 290 | // properties 291 | @get external key: t => string = "key" 292 | } 293 | 294 | // https://code.visualstudio.com/api/references/vscode-api#SecretStorage 295 | // 1.95 296 | module SecretStorage = { 297 | type t 298 | // events 299 | @send 300 | external onDidChange: (t, SecretStorageChangeEvent.t => unit) => Disposable.t = "onDidChange" 301 | // methods 302 | @send external delete: (t, string) => promise = "delete" 303 | @send external get: (t, string) => promise = "get" 304 | @send external store: (t, string, string) => promise = "store" 305 | } 306 | 307 | // https://code.visualstudio.com/api/references/vscode-api#ExtensionMode 308 | // 1.101 309 | module ExtensionMode = { 310 | type t = 311 | | @as(1) Production 312 | | @as(2) Development 313 | | @as(3) Test 314 | } 315 | 316 | // https://code.visualstudio.com/api/references/vscode-api#ExtensionKind 317 | // 1.101 318 | module ExtensionKind = { 319 | type t = 320 | | @as(1) UI 321 | | @as(2) Workspace 322 | } 323 | 324 | // https://code.visualstudio.com/api/references/vscode-api#Extension 325 | // 1.101 326 | module Extension = { 327 | type t<'a> 328 | 329 | // properties 330 | @get external exports: t<'a> => 'a = "exports" 331 | @get external extensionKind: t<'a> => ExtensionKind.t = "extensionKind" 332 | @get external extensionPath: t<'a> => string = "extensionPath" 333 | @get external extensionUri: t<'a> => Uri.t = "extensionUri" 334 | @get external id: t<'a> => string = "id" 335 | @get external isActive: t<'a> => bool = "isActive" 336 | @get external packageJSON: t<'a> => 'json = "packageJSON" 337 | 338 | // methods 339 | @send external activate: t<'a> => promise<'a> = "activate" 340 | } 341 | 342 | // https://code.visualstudio.com/api/references/vscode-api#ExtensionContext 343 | module ExtensionContext = { 344 | type t 345 | // properties 346 | @get 347 | external environmentVariableCollection: t => EnvironmentVariableCollection.t = 348 | "environmentVariableCollection" 349 | @get external extension: t => Extension.t<'a> = "extension" 350 | @get external extensionMode: t => ExtensionMode.t = "extensionMode" 351 | @get external extensionPath: t => string = "extensionPath" 352 | @get external extensionUri: t => Uri.t = "extensionUri" 353 | @get external globalState: t => Memento.t = "globalState" 354 | @get external globalStorageUri: t => Uri.t = "globalStorageUri" 355 | @get 356 | external languageModelAccessInformation: t => LanguageModelAccessInformation.t = 357 | "languageModelAccessInformation" 358 | @get external logUri: t => Uri.t = "logUri" 359 | @get external secrets: t => SecretStorage.t = "secrets" 360 | @get external storageUri: t => option = "storageUri" 361 | @get 362 | external subscriptions: t => array = "subscriptions" 363 | @get external workspaceState: t => Memento.t = "workspaceState" 364 | // methods 365 | @send external asAbsolutePath: (t, string) => string = "asAbsolutePath" 366 | } 367 | 368 | module Commands = { 369 | module Layout = { 370 | @unboxed 371 | type rec group = Group('a): group 372 | 373 | type sized = { 374 | groups: array, 375 | size: float, 376 | } 377 | 378 | let simple = Group(Js.Dict.empty()) 379 | let sized = (v: sized) => Group(v) 380 | 381 | type t = { 382 | orientation: int, 383 | groups: array, 384 | } 385 | } 386 | 387 | // methods 388 | @module("vscode") @scope("commands") 389 | external executeCommand: @string 390 | [ 391 | | @as("vscode.setEditorLayout") #setEditorLayout(Layout.t) 392 | | @as("setContext") #setContext(string, bool) 393 | ] => promise<'a> = "executeCommand" 394 | @module("vscode") @scope("commands") 395 | external getEditorLayout: (@as("vscode.getEditorLayout") _, unit) => promise = 396 | "executeCommand" 397 | @module("vscode") @scope("commands") 398 | external executeCommand0: string => promise<'a> = "executeCommand" 399 | @module("vscode") @scope("commands") 400 | external executeCommand1: (string, 'arg0) => promise<'a> = "executeCommand" 401 | @module("vscode") @scope("commands") 402 | external setContext: (@as("setContext") _, string, bool) => promise = "executeCommand" 403 | 404 | @module("vscode") @scope("commands") 405 | external getCommands: option => promise> = "getCommands" 406 | @module("vscode") @scope("commands") 407 | external registerCommand: (string, unit => 'a) => Disposable.t = "registerCommand" 408 | } 409 | 410 | // https://code.visualstudio.com/api/references/vscode-api#DebugConsole 411 | // 1.52.0 412 | module DebugConsole = { 413 | type t 414 | // methods 415 | @send external append: (t, string) => unit = "append" 416 | @send external appendLine: (t, string) => unit = "appendLine" 417 | } 418 | 419 | // https://code.visualstudio.com/api/references/vscode-api#DebugConfiguration 420 | // 1.52.0 421 | module DebugConfiguration = { 422 | type t 423 | // properties 424 | @get external name: t => string = "name" 425 | @get external request: t => string = "request" 426 | @get external type_: t => string = "type" 427 | } 428 | 429 | // https://code.visualstudio.com/api/references/vscode-api#WorkspaceFolder 430 | // 1.52.0 431 | module WorkspaceFolder = { 432 | type t 433 | // properties 434 | @get external index: t => int = "index" 435 | @get external name: t => string = "name" 436 | @get external uri: t => Uri.t = "uri" 437 | } 438 | 439 | // https://code.visualstudio.com/api/references/vscode-api#Breakpoint 440 | // 1.52.0 441 | module Breakpoint = { 442 | type t 443 | // constructors 444 | @module("vscode") @new 445 | external make: (option, option, option, option) => t = "Breakpoint" 446 | // properties 447 | @get external condition: t => option = "condition" 448 | @get external enabled: t => bool = "enabled" 449 | @get external hitCondition: t => option = "hitCondition" 450 | @get external id: t => string = "id" 451 | @get external logMessage: t => option = "logMessage" 452 | } 453 | 454 | // https://code.visualstudio.com/api/references/vscode-api#DebugProtocolBreakpoint 455 | // 1.52.0 456 | module DebugProtocolBreakpoint = { 457 | // A DebugProtocolBreakpoint is an opaque stand-in type for the Breakpoint type defined in the Debug Adapter Protocol. 458 | type t 459 | } 460 | 461 | // https://code.visualstudio.com/api/references/vscode-api#DebugSession 462 | // 1.52.0 463 | module DebugSession = { 464 | type t 465 | // properties 466 | @get external configuration: t => DebugConfiguration.t = "configuration" 467 | @get external id: t => string = "id" 468 | @get external name: t => string = "name" 469 | @get external type_: t => string = "type" 470 | @get external workspaceFolder: t => option = "workspaceFolder" 471 | // methods 472 | @send external customRequest: (t, string) => promise<'a> = "customRequest" 473 | @send external customRequestWithArgs: (t, string, 'a) => promise<'b> = "customRequest" 474 | @send 475 | external getDebugProtocolBreakpoint: ( 476 | t, 477 | Breakpoint.t, 478 | ) => promise> = "getDebugProtocolBreakpoint" 479 | } 480 | 481 | // https://code.visualstudio.com/api/references/vscode-api#BreakpointsChangeEvent 482 | // 1.52.0 483 | module BreakpointsChangeEvent = { 484 | type t 485 | // properties 486 | @get external added: t => array = "added" 487 | @get external changed: t => array = "changed" 488 | @get external removed: t => array = "removed" 489 | } 490 | 491 | // https://code.visualstudio.com/api/references/vscode-api#DebugSessionCustomEvent 492 | // 1.52.0 493 | module DebugSessionCustomEvent = { 494 | type t 495 | // properties 496 | @get external body: t => option<'a> = "body" 497 | @get external event: t => string = "event" 498 | @get external session: t => DebugSession.t = "session" 499 | } 500 | 501 | // https://code.visualstudio.com/api/references/vscode-api#DebugProtocolSource 502 | // 1.52.0 503 | module DebugProtocolSource = { 504 | // A DebugProtocolSource is an opaque stand-in type for the Source type defined in the Debug Adapter Protocol. 505 | type t 506 | } 507 | 508 | // https://code.visualstudio.com/api/references/vscode-api#DebugAdapterExecutableOptions 509 | // 1.52.0 510 | module DebugAdapterExecutableOptions = { 511 | type t 512 | // properties 513 | @get external cwd: t => option = "cwd" 514 | @get external env: t => option<'a> = "env" 515 | } 516 | 517 | // https://code.visualstudio.com/api/references/vscode-api#DebugAdapterExecutable 518 | // 1.52.0 519 | module DebugAdapterExecutable = { 520 | type t 521 | // constructor 522 | @module("vscode") @new 523 | external make: (string, array) => t = "DebugAdapterExecutable" 524 | @module("vscode") @new 525 | external makeWithOptions: (string, array, DebugAdapterExecutableOptions.t) => t = 526 | "DebugAdapterExecutable" 527 | } 528 | 529 | // https://code.visualstudio.com/api/references/vscode-api#DebugAdapterDescriptorFactory 530 | // 1.52.0 (WIP) 531 | module DebugAdapterDescriptorFactory = { 532 | type t 533 | // methods 534 | @send 535 | external createDebugAdapterDescriptor: ( 536 | t, 537 | DebugSession.t, 538 | option, 539 | ) => ProviderResult.t<'a> = "createDebugAdapterDescriptor" 540 | } 541 | 542 | // https://code.visualstudio.com/api/references/vscode-api#debug 543 | // 1.52.0 (WIP) 544 | module Debug = { 545 | // variables 546 | @module("vscode") @scope("debug") 547 | external activeDebugConsole: option = "activeDebugConsole" 548 | @module("vscode") @scope("debug") 549 | external activeDebugSession: option = "activeDebugSession" 550 | @module("vscode") @scope("debug") 551 | external breakpoints: array = "breakpoints" 552 | 553 | // events 554 | @module("vscode") @scope("debug") 555 | external onDidChangeActiveDebugSession: (option => unit) => Disposable.t = 556 | "onDidChangeActiveDebugSession" 557 | @module("vscode") @scope("debug") 558 | external onDidChangeBreakpoints: (BreakpointsChangeEvent.t => unit) => Disposable.t = 559 | "onDidChangeBreakpoints" 560 | @module("vscode") @scope("debug") 561 | external onDidReceiveDebugSessionCustomEvent: ( 562 | DebugSessionCustomEvent.t => unit 563 | ) => Disposable.t = "onDidReceiveDebugSessionCustomEvent" 564 | @module("vscode") @scope("debug") 565 | external onDidStartDebugSession: (DebugSession.t => unit) => Disposable.t = 566 | "onDidStartDebugSession" 567 | @module("vscode") @scope("debug") 568 | external onDidTerminateDebugSession: (DebugSession.t => unit) => Disposable.t = 569 | "onDidTerminateDebugSession" 570 | 571 | // functions 572 | @module("vscode") @scope("debug") 573 | external addBreakpoints: array => unit = "addBreakpoints" 574 | @module("vscode") @scope("debug") 575 | external asDebugSourceUri: DebugProtocolSource.t => unit = "asDebugSourceUri" 576 | @module("vscode") @scope("debug") 577 | external asDebugSourceUriWithSession: (DebugProtocolSource.t, DebugSession.t) => unit = 578 | "asDebugSourceUri" 579 | @module("vscode") @scope("debug") 580 | external registerDebugAdapterDescriptorFactory: ( 581 | string, 582 | DebugAdapterDescriptorFactory.t, 583 | Disposable.t, 584 | ) => unit = "registerDebugAdapterDescriptorFactory" 585 | } 586 | 587 | // https://code.visualstudio.com/api/references/vscode-api#Clipboard 588 | module Clipboard = { 589 | type t 590 | // methods 591 | @send external readText: (t, unit) => promise = "readText" 592 | @send external writeText: (t, string) => promise = "writeText" 593 | } 594 | 595 | // https://code.visualstudio.com/api/references/vscode-api#UIKind; 596 | // 1.95 597 | module UIKind = { 598 | type t = 599 | | @as(1) Desktop 600 | | @as(2) Web 601 | } 602 | 603 | // https://code.visualstudio.com/api/references/vscode-api#env 604 | // 1.101 605 | module Env = { 606 | type t 607 | 608 | // variables 609 | @module("vscode") @scope("env") external appHost: string = "appHost" 610 | @module("vscode") @scope("env") external appName: string = "appName" 611 | @module("vscode") @scope("env") external appRoot: string = "appRoot" 612 | @module("vscode") @scope("env") external clipboard: Clipboard.t = "clipboard" 613 | @module("vscode") @scope("env") external isNewAppInstall: bool = "isNewAppInstall" 614 | @module("vscode") @scope("env") external isTelemetryEnabled: bool = "isTelemetryEnabled" 615 | @module("vscode") @scope("env") external language: string = "language" 616 | @module("vscode") @scope("env") external logLevel: 'logLevel = "logLevel" 617 | @module("vscode") @scope("env") external machineId: string = "machineId" 618 | @module("vscode") @scope("env") external remoteName: option = "remoteName" 619 | @module("vscode") @scope("env") external sessionId: string = "sessionId" 620 | @module("vscode") @scope("env") external shell: string = "shell" 621 | @module("vscode") @scope("env") external uiKind: UIKind.t = "uiKind" 622 | @module("vscode") @scope("env") external uriScheme: string = "uriScheme" 623 | 624 | // events 625 | @module("vscode") @scope("env") 626 | external onDidChangeLogLevel: ('logLevel => unit) => Disposable.t = "onDidChangeLogLevel" 627 | @module("vscode") @scope("env") 628 | external onDidChangeShell: (string => unit) => Disposable.t = "onDidChangeShell" 629 | @module("vscode") @scope("env") 630 | external onDidChangeTelemetryEnabled: (bool => unit) => Disposable.t = 631 | "onDidChangeTelemetryEnabled" 632 | 633 | // functions 634 | @module("vscode") @scope("env") 635 | external asExternalUri: Uri.t => promise = "asExternalUri" 636 | @module("vscode") @scope("env") 637 | external createTelemetryLogger: ( 638 | 'telemetrySender, 639 | ~options: 'telemetryLoggerOptions=?, 640 | ) => 'telemetryLogger = "createTelemetryLogger" 641 | @module("vscode") @scope("env") 642 | external openExternal: Uri.t => promise = "openExternal" 643 | } 644 | 645 | // https://code.visualstudio.com/api/references/vscode-api#ViewColumn 646 | // 1.95 647 | module ViewColumn = { 648 | type t = 649 | | @as(-2) Beside 650 | | @as(-1) Active 651 | | @as(1) One 652 | | @as(2) Two 653 | | @as(3) Three 654 | | @as(4) Four 655 | | @as(5) Five 656 | | @as(6) Six 657 | | @as(7) Seven 658 | | @as(8) Eight 659 | | @as(9) Nine 660 | } 661 | // https://code.visualstudio.com/api/references/vscode-api#WebviewPortMapping 662 | // 1.101 663 | module WebviewPortMapping = { 664 | type t = { 665 | extensionHostPort: int, 666 | webviewPort: int, 667 | } 668 | } 669 | 670 | // https://code.visualstudio.com/api/references/vscode-api#WebviewOptions 671 | // 1.101 672 | module WebviewOptions = { 673 | type enableCommandUrisValue = 674 | | @unboxed Bool(bool) 675 | | @unboxed StringArray(array) 676 | 677 | type t = { 678 | enableCommandUris: option, 679 | enableForms: option, 680 | enableScripts: option, 681 | localResourceRoots: option>, 682 | portMapping: option>, 683 | } 684 | } 685 | 686 | // https://code.visualstudio.com/api/references/vscode-api#Webview 687 | // 1.101 688 | module Webview = { 689 | type t 690 | 691 | // events 692 | @send 693 | external onDidReceiveMessage: (t, 'a => unit) => Disposable.t = "onDidReceiveMessage" 694 | 695 | // properties 696 | @get external cspSource: t => string = "cspSource" 697 | @get external html: t => string = "html" 698 | @set external setHtml: (t, string) => unit = "html" 699 | @get external options: t => WebviewOptions.t = "options" 700 | 701 | // methods 702 | @send external asWebviewUri: (t, Uri.t) => Uri.t = "asWebviewUri" 703 | @send external postMessage: (t, 'a) => promise = "postMessage" 704 | } 705 | 706 | // https://code.visualstudio.com/api/references/vscode-api#WebviewPanelOnDidChangeViewStateEvent 707 | // 1.101 708 | module WebviewPanelOnDidChangeViewStateEvent = { 709 | type t 710 | // properties 711 | @get external webviewPanel: t => 'webviewPanel = "webviewPanel" 712 | } 713 | 714 | // https://code.visualstudio.com/api/references/vscode-api#WebviewPanel 715 | // 1.101 716 | module WebviewPanel = { 717 | type t 718 | type iconPathValue = 719 | | @unboxed Uri(Uri.t) 720 | | @unboxed LightAndDark({dark: Uri.t, light: Uri.t}) 721 | 722 | // events 723 | @send 724 | external onDidChangeViewState: ( 725 | t, 726 | WebviewPanelOnDidChangeViewStateEvent.t => unit, 727 | ) => Disposable.t = "onDidChangeViewState" 728 | @send 729 | external onDidDispose: (t, unit => unit) => Disposable.t = "onDidDispose" 730 | 731 | // properties 732 | @get external active: t => bool = "active" 733 | @get external iconPath: t => option = "iconPath" 734 | @get external options: t => 'webviewPanelOptions = "options" 735 | @get external title: t => string = "title" 736 | @get external viewColumn: t => ViewColumn.t = "viewColumn" 737 | @get external viewType: t => string = "viewType" 738 | @get external visible: t => bool = "visible" 739 | @get external webview: t => Webview.t = "webview" 740 | 741 | // methods 742 | @send external dispose: t => 'any = "dispose" 743 | @send 744 | external reveal: (t, ~viewColumn: ViewColumn.t=?, ~preserveFocus: bool=?) => unit = "reveal" 745 | } 746 | 747 | // https://code.visualstudio.com/api/references/vscode-api#Position 748 | module Position = { 749 | type t 750 | // constructor 751 | @module("vscode") @new external make: (int, int) => t = "Position" 752 | // properties 753 | @get external character: t => int = "character" 754 | @get external line: t => int = "line" 755 | // methods 756 | @send external compareTo: (t, t) => int = "compareTo" 757 | @send external isAfter: (t, t) => bool = "isAfter" 758 | @send external isAfterOrEqual: (t, t) => bool = "isAfterOrEqual" 759 | @send external isBefore: (t, t) => bool = "isBefore" 760 | @send external isBeforeOrEqual: (t, t) => bool = "isBeforeOrEqual" 761 | @send external isEqual: (t, t) => bool = "isEqual" 762 | @send external translate: (t, int, int) => t = "translate" 763 | @send external with_: (t, int, int) => t = "with" 764 | } 765 | 766 | // https://code.visualstudio.com/api/references/vscode-api#Range 767 | // 1.101 768 | module Range = { 769 | type t 770 | // constructor 771 | @module("vscode") @new 772 | external make: (Position.t, Position.t) => t = "Range" 773 | @module("vscode") @new 774 | external makeWithNumbers: (int, int, int, int) => t = "Range" 775 | // properties 776 | @get external end_: t => Position.t = "end" 777 | @get external isEmpty: t => bool = "isEmpty" 778 | @get external isSingleLine: t => bool = "isSingleLine" 779 | @get external start: t => Position.t = "start" 780 | // methods 781 | @send external contains: (t, Position.t) => bool = "contains" 782 | @send external containsRange: (t, t) => bool = "contains" 783 | @send external intersection: (t, t) => option = "intersection" 784 | @send external isEqual: (t, t) => bool = "isEqual" 785 | @send external union: (t, t) => t = "union" 786 | @send external with_: (t, Position.t, Position.t) => t = "with" 787 | } 788 | 789 | // https://code.visualstudio.com/api/references/vscode-api#TextLine 790 | module TextLine = { 791 | type t 792 | // properties 793 | @get 794 | external firstNonWhitespaceCharacterIndex: t => int = "firstNonWhitespaceCharacterIndex" 795 | @get external isEmptyOrWhitespace: t => bool = "isEmptyOrWhitespace" 796 | @get external lineNumber: t => int = "lineNumber" 797 | @get external range: t => Range.t = "range" 798 | @get 799 | external rangeIncludingLineBreak: t => Range.t = "rangeIncludingLineBreak" 800 | @get external text: t => string = "text" 801 | } 802 | 803 | // https://code.visualstudio.com/api/references/vscode-api#EndOfLine 804 | // 1.95 805 | module EndOfLine = { 806 | type t = 807 | | @as(1) LF 808 | | @as(2) CRLF 809 | } 810 | 811 | // https://code.visualstudio.com/api/references/vscode-api#TextDocument 812 | // 1.101 813 | module TextDocument = { 814 | type t 815 | // properties 816 | @get external encoding: t => string = "encoding" 817 | @get external eol: t => EndOfLine.t = "eol" 818 | @get external fileName: t => string = "fileName" 819 | @get external isClosed: t => bool = "isClosed" 820 | @get external isDirty: t => bool = "isDirty" 821 | @get external isUntitled: t => bool = "isUntitled" 822 | @get external languageId: t => string = "languageId" 823 | @get external lineCount: t => int = "lineCount" 824 | @get external uri: t => Uri.t = "uri" 825 | @get external version: t => int = "version" 826 | // methods 827 | @send external getText: (t, option) => string = "getText" 828 | @send 829 | external getWordRangeAtPosition: (t, Position.t, option) => Range.t = 830 | "getWordRangeAtPosition" 831 | @send external lineAt: (t, int) => TextLine.t = "lineAt" 832 | @send external lineAtPosition: (t, Position.t) => TextLine.t = "lineAt" 833 | @send external offsetAt: (t, Position.t) => int = "offsetAt" 834 | @send external positionAt: (t, int) => Position.t = "positionAt" 835 | @send external save: t => promise = "save" 836 | @send 837 | external validatePosition: (t, Position.t) => Position.t = "validatePosition" 838 | @send external validateRange: (t, Range.t) => Range.t = "validateRange" 839 | } 840 | 841 | // https://code.visualstudio.com/api/references/vscode-api#TextEditorCursorStyle 842 | // 1.95 843 | module TextEditorCursorStyle = { 844 | type t = 845 | | @as(1) Line 846 | | @as(2) Block 847 | | @as(3) Underline 848 | | @as(4) LineThin 849 | | @as(5) BlockOutline 850 | | @as(6) UnderlineThin 851 | } 852 | 853 | // https://code.visualstudio.com/api/references/vscode-api#TextEditorLineNumbersStyle 854 | // 1.95 855 | module TextEditorLineNumbersStyle = { 856 | type t = 857 | | @as(0) Off 858 | | @as(1) On 859 | | @as(2) Relative 860 | | @as(3) Interval 861 | } 862 | 863 | // https://code.visualstudio.com/api/references/vscode-api#TextEditorOptions 864 | module TextEditorOptions = { 865 | type t 866 | // properties 867 | @get external cursorStyle: t => option = "cursorStyle" 868 | @get 869 | external insertSpaces: t => option> = "insertSpaces" 870 | @get external lineNumbers: t => option = "lineNumbers" 871 | @get external tabSize: t => option> = "tabSize" 872 | } 873 | 874 | // https://code.visualstudio.com/api/references/vscode-api#Selection 875 | module Selection = { 876 | type t 877 | // constructors 878 | @module("vscode") @new 879 | external make: (Position.t, Position.t) => t = "Selection" 880 | @module("vscode") @new 881 | external makeWithNumbers: (int, int, int, int) => t = "Selection" 882 | // properties 883 | @get external active: t => Position.t = "active" 884 | @get external anchor: t => Position.t = "anchor" 885 | @get external end_: t => Position.t = "end" 886 | @get external isEmpty: t => bool = "isEmpty" 887 | @get external isReversed: t => bool = "isReversed" 888 | @get external isSingleLine: t => bool = "isSingleLine" 889 | @get external start: t => Position.t = "start" 890 | // methods 891 | @send external contains: (t, Position.t) => bool = "contains" 892 | @send external containsRange: (t, Range.t) => bool = "contains" 893 | @send 894 | external intersection: (t, Range.t) => option = "intersection" 895 | @send external isEqual: (t, Range.t) => bool = "isEqual" 896 | @send external union: (t, Range.t) => Range.t = "union" 897 | @send external with_: (t, Position.t, Position.t) => Range.t = "with" 898 | } 899 | 900 | // https://code.visualstudio.com/api/references/vscode-api#TextEditorEdit 901 | module TextEditorEdit = { 902 | type t 903 | // methods 904 | @send external delete: (t, Range.t) => unit = "delete" 905 | @send external deleteAtSelection: (t, Selection.t) => unit = "delete" 906 | @send external insert: (t, Position.t, string) => unit = "insert" 907 | @send external replace: (t, Position.t, string) => unit = "replace" 908 | @send external replaceAtRange: (t, Range.t, string) => unit = "replace" 909 | @send 910 | external replaceAtSelection: (t, Selection.t, string) => unit = "replace" 911 | @send external setEndOfLine: (t, EndOfLine.t) => unit = "setEndOfLine" 912 | } 913 | 914 | // https://code.visualstudio.com/api/references/vscode-api#SnippetString 915 | // 1.101 916 | module SnippetString = { 917 | type t 918 | type placeholderValue = 919 | | @unboxed String(string) 920 | | @unboxed Function(t => unit) 921 | type variableDefaultValue = 922 | | @unboxed String(string) 923 | | @unboxed Function(t => unit) 924 | 925 | // constructors 926 | @module("vscode") @new 927 | external make: (~value: string=?) => t = "SnippetString" 928 | 929 | // properties 930 | @get external value: t => string = "value" 931 | 932 | // methods 933 | @send 934 | external appendChoice: (t, array, ~number: int=?) => t = "appendChoice" 935 | @send 936 | external appendPlaceholder: (t, placeholderValue, ~number: int=?) => t = "appendPlaceholder" 937 | @send 938 | external appendTabstop: (t, ~number: int=?) => t = "appendTabstop" 939 | @send 940 | external appendText: (t, string) => t = "appendText" 941 | @send 942 | external appendVariable: (t, string, variableDefaultValue) => t = "appendVariable" 943 | } 944 | 945 | // https://code.visualstudio.com/api/references/vscode-api#SnippetTextEdit 946 | // 1.101 947 | module SnippetTextEdit = { 948 | type t 949 | 950 | // static methods 951 | @module("vscode") @scope("SnippetTextEdit") 952 | external insert: (Position.t, SnippetString.t) => t = "insert" 953 | @module("vscode") @scope("SnippetTextEdit") 954 | external replace: (Range.t, SnippetString.t) => t = "replace" 955 | 956 | // constructors 957 | @module("vscode") @new 958 | external make: (Range.t, SnippetString.t) => t = "SnippetTextEdit" 959 | 960 | // properties 961 | @get external keepWhitespace: t => option = "keepWhitespace" 962 | @get external range: t => Range.t = "range" 963 | @get external snippet: t => SnippetString.t = "snippet" 964 | } 965 | 966 | // https://code.visualstudio.com/api/references/vscode-api#TextEditorRevealType 967 | // 1.95 968 | module TextEditorRevealType = { 969 | type t = 970 | | @as(0) Default 971 | | @as(1) InCenter 972 | | @as(2) InCenterIfOutsideViewport 973 | | @as(3) AtTop 974 | } 975 | 976 | // https://code.visualstudio.com/api/references/vscode-api#TextEditorDecorationType 977 | module TextEditorDecorationType = { 978 | type t 979 | // properties 980 | @get external key: t => string = "key" 981 | // methods 982 | @send external dispose: t => unit = "dispose" 983 | } 984 | 985 | // https://code.visualstudio.com/api/references/vscode-api#MarkdownString 986 | // 1.101 987 | module MarkdownString = { 988 | type t 989 | type trustedOptions = {enabledCommands: array} 990 | type isTrustedValue = 991 | | @unboxed Bool(bool) 992 | | @unboxed TrustedOptions(trustedOptions) 993 | 994 | // constructors 995 | @module("vscode") @new 996 | external make: (~value: string=?, ~supportThemeIcons: bool=?) => t = "MarkdownString" 997 | 998 | // properties 999 | @get external baseUri: t => option = "baseUri" 1000 | @get external isTrusted: t => option = "isTrusted" 1001 | @get external supportHtml: t => option = "supportHtml" 1002 | @get external supportThemeIcons: t => option = "supportThemeIcons" 1003 | @get external value: t => string = "value" 1004 | 1005 | // methods 1006 | @send 1007 | external appendCodeblock: (t, string, ~language: string=?) => t = "appendCodeblock" 1008 | @send external appendMarkdown: (t, string) => t = "appendMarkdown" 1009 | @send external appendText: (t, string) => t = "appendText" 1010 | } 1011 | 1012 | // https://code.visualstudio.com/api/references/vscode-api#ThemableDecorationAttachmentRenderOptions 1013 | module ThemableDecorationAttachmentRenderOptions = { 1014 | @deriving(abstract) 1015 | type t = { 1016 | @optional 1017 | backgroundColor: StringOr.t, 1018 | @optional 1019 | border: string, 1020 | @optional 1021 | borderColor: StringOr.t, 1022 | @optional 1023 | color: StringOr.t, 1024 | @optional 1025 | contentIconPath: StringOr.t, 1026 | @optional 1027 | contentText: string, 1028 | @optional 1029 | fontStyle: string, 1030 | @optional 1031 | fontWeight: string, 1032 | @optional 1033 | height: string, 1034 | @optional 1035 | margin: string, 1036 | @optional 1037 | textDecoration: string, 1038 | @optional 1039 | width: string, 1040 | } 1041 | } 1042 | 1043 | // https://code.visualstudio.com/api/references/vscode-api#ThemableDecorationInstanceRenderOptions 1044 | module ThemableDecorationInstanceRenderOptions = { 1045 | @deriving(abstract) 1046 | type t = { 1047 | @optional 1048 | after: ThemableDecorationAttachmentRenderOptions.t, 1049 | @optional 1050 | before: ThemableDecorationAttachmentRenderOptions.t, 1051 | } 1052 | } 1053 | 1054 | // https://code.visualstudio.com/api/references/vscode-api#DecorationInstanceRenderOptions; 1055 | module DecorationInstanceRenderOptions = { 1056 | @deriving(abstract) 1057 | type t = { 1058 | @optional 1059 | after: ThemableDecorationAttachmentRenderOptions.t, 1060 | @optional 1061 | before: ThemableDecorationAttachmentRenderOptions.t, 1062 | @optional 1063 | dark: ThemableDecorationInstanceRenderOptions.t, 1064 | @optional 1065 | light: ThemableDecorationInstanceRenderOptions.t, 1066 | } 1067 | } 1068 | 1069 | // https://code.visualstudio.com/api/references/vscode-api#DecorationOptions 1070 | module DecorationOptions = { 1071 | type t 1072 | // properties 1073 | @get 1074 | external hoverMessage: t => option = "hoverMessage" 1075 | @get external range: t => Range.t = "range" 1076 | @get 1077 | external renderOptions: t => option = "renderOptions" 1078 | } 1079 | 1080 | module TextEditor = { 1081 | type t 1082 | // properties 1083 | @get external document: t => TextDocument.t = "document" 1084 | @get external options: t => TextEditorOptions.t = "options" 1085 | @get external selection: t => Selection.t = "selection" 1086 | @set external setSelection: (t, Selection.t) => unit = "selection" 1087 | @get external selections: t => array = "selections" 1088 | @set 1089 | external setSelections: (t, array) => unit = "selections" 1090 | @get external viewColumn: t => option = "viewColumn" 1091 | @get external visibleRanges: t => array = "visibleRanges" 1092 | // methods 1093 | @send 1094 | external edit: ( 1095 | t, 1096 | TextEditorEdit.t => unit, 1097 | option<{"undoStopAfter": bool, "undoStopBefore": bool}>, 1098 | ) => promise = "edit" 1099 | @send external hide: (t, unit) => unit = "hide" 1100 | @send 1101 | external insertSnippet: ( 1102 | t, 1103 | SnippetString.t, 1104 | Position.t, 1105 | option<{"undoStopAfter": bool, "undoStopBefore": bool}>, 1106 | ) => promise = "insertSnippet" 1107 | @send 1108 | external insertSnippetAtRange: ( 1109 | t, 1110 | SnippetString.t, 1111 | Range.t, 1112 | option<{"undoStopAfter": bool, "undoStopBefore": bool}>, 1113 | ) => promise = "insertSnippet" 1114 | @send 1115 | external insertSnippetAtPositions: ( 1116 | t, 1117 | SnippetString.t, 1118 | array, 1119 | option<{"undoStopAfter": bool, "undoStopBefore": bool}>, 1120 | ) => promise = "insertSnippet" 1121 | @send 1122 | external insertSnippetAtRanges: ( 1123 | t, 1124 | SnippetString.t, 1125 | array, 1126 | option<{"undoStopAfter": bool, "undoStopBefore": bool}>, 1127 | ) => promise = "insertSnippet" 1128 | @send 1129 | external revealRange: (t, Range.t, option) => unit = "revealRange" 1130 | @send 1131 | external setDecorations: (t, TextEditorDecorationType.t, array) => unit = 1132 | "setDecorations" 1133 | @send 1134 | external setDecorationsWithOptions: ( 1135 | t, 1136 | TextEditorDecorationType.t, 1137 | array, 1138 | ) => unit = "setDecorations" 1139 | @send external show: (t, option) => unit = "show" 1140 | } 1141 | 1142 | // https://code.visualstudio.com/api/references/vscode-api#TerminalOptions 1143 | // 1.51.0 1144 | module TerminalOptions = { 1145 | type t 1146 | // properties 1147 | @get external cwd: t => option = "cwd" 1148 | @get external env: t => option<'a> = "env" 1149 | @get external hideFromUser: t => option = "hideFromUser" 1150 | @get external name: t => option = "name" 1151 | @get external shellArgs: t => StringOr.t> = "shellArgs" 1152 | @get external shellPath: t => option = "shellPath" 1153 | @get external strictEnv: t => option = "strictEnv" 1154 | } 1155 | 1156 | // https://code.visualstudio.com/api/references/vscode-api#TerminalDimensions 1157 | // 1.101 1158 | module TerminalDimensions = { 1159 | type t 1160 | @get external columns: t => int = "columns" 1161 | @get external rows: t => int = "rows" 1162 | } 1163 | 1164 | // https://code.visualstudio.com/api/references/vscode-api#Pseudoterminal 1165 | // 1.101 1166 | module Pseudoterminal = { 1167 | type t 1168 | 1169 | // Events (required) 1170 | @get external onDidWrite: t => (string => unit) => Disposable.t = "onDidWrite" 1171 | 1172 | // Events (optional) 1173 | @get external onDidClose: t => option<(option => unit) => Disposable.t> = "onDidClose" 1174 | @get external onDidChangeName: t => option<(string => unit) => Disposable.t> = "onDidChangeName" 1175 | @get 1176 | external onDidOverrideDimensions: t => option< 1177 | (option => unit) => Disposable.t, 1178 | > = "onDidOverrideDimensions" 1179 | 1180 | // Methods (optional) 1181 | @send external \"open": (t, TerminalDimensions.t) => unit = "open" 1182 | @send external close: t => unit = "close" 1183 | @send external handleInput: (t, string) => unit = "handleInput" 1184 | @send external setDimensions: (t, TerminalDimensions.t) => unit = "setDimensions" 1185 | } 1186 | 1187 | // https://code.visualstudio.com/api/references/vscode-api#ExtensionTerminalOptions 1188 | // 1.101 1189 | module ExtensionTerminalOptions = { 1190 | type t 1191 | // properties 1192 | @get external color: t => option<'a> = "color" 1193 | @get external iconPath: t => option<'b> = "iconPath" 1194 | @get external isTransient: t => option = "isTransient" 1195 | @get external location: t => option<'c> = "location" 1196 | @get external name: t => string = "name" 1197 | @get external pty: t => Pseudoterminal.t = "pty" 1198 | } 1199 | 1200 | // "TerminalOptions | ExtensionTerminalOptions", FUCK UNION TYPE 1201 | // 1.51.0 1202 | module TerminalOptionsOrExtensionTerminalOptions: { 1203 | type t 1204 | type case = 1205 | | TerminalOptions(TerminalOptions.t) 1206 | | ExtensionTerminalOptions(ExtensionTerminalOptions.t) 1207 | let terminalOptions: TerminalOptions.t => t 1208 | let extensionTerminalOptions: ExtensionTerminalOptions.t => t 1209 | let classify: t => case 1210 | } = { 1211 | @unboxed 1212 | type rec t = Any('x): t 1213 | type case = 1214 | | TerminalOptions(TerminalOptions.t) 1215 | | ExtensionTerminalOptions(ExtensionTerminalOptions.t) 1216 | let terminalOptions = (v: TerminalOptions.t) => Any(v) 1217 | let extensionTerminalOptions = (v: ExtensionTerminalOptions.t) => Any(v) 1218 | let classify = (Any(v): t): case => 1219 | if %raw("v.hasOwnProperty('pty')") { 1220 | ExtensionTerminalOptions((Obj.magic(v): ExtensionTerminalOptions.t)) 1221 | } else { 1222 | TerminalOptions((Obj.magic(v): TerminalOptions.t)) 1223 | } 1224 | } 1225 | 1226 | // https://code.visualstudio.com/api/references/vscode-api#Terminal 1227 | // 1.51.0 1228 | module Terminal = { 1229 | type t 1230 | // properties 1231 | @get 1232 | external creationOptions: t => TerminalOptionsOrExtensionTerminalOptions.t = "creationOptions" 1233 | @get external exitStatus: t => option = "exitStatus" 1234 | @get external name: t => string = "name" 1235 | @get external processId: t => option = "processId" 1236 | // methods 1237 | @send external dispose: t => unit = "dispose" 1238 | @send external hide: t => unit = "hide" 1239 | @send external sendText: (t, string) => unit = "sendText" 1240 | @send 1241 | external sendTextWithOptions: (t, string, bool) => unit = "sendText" 1242 | @send external show: t => unit = "show" 1243 | @send external showWithOptions: (t, bool) => unit = "show" 1244 | } 1245 | 1246 | // https://code.visualstudio.com/api/references/vscode-api#WindowState 1247 | // 1.51.0 1248 | module WindowState = { 1249 | type t 1250 | // properties 1251 | @get external focused: t => bool = "focused" 1252 | } 1253 | 1254 | // https://code.visualstudio.com/api/references/vscode-api#TextEditorOptionsChangeEvent 1255 | module TextEditorOptionsChangeEvent = { 1256 | type t 1257 | } 1258 | 1259 | // https://code.visualstudio.com/api/references/vscode-api#TextEditorSelectionChangeKind 1260 | // 1.95 1261 | module TextEditorSelectionChangeKind = { 1262 | type t = 1263 | | @as(1) Keyboard 1264 | | @as(2) Mouse 1265 | | @as(3) Command 1266 | } 1267 | // https://code.visualstudio.com/api/references/vscode-api#TextEditorSelectionChangeEvent 1268 | module TextEditorSelectionChangeEvent = { 1269 | type t 1270 | // properties 1271 | @get 1272 | external kind: t => option = "kind" 1273 | @get external selections: t => array = "selections" 1274 | @get external textEditor: t => TextEditor.t = "textEditor" 1275 | } 1276 | // https://code.visualstudio.com/api/references/vscode-api#TextEditorViewColumnChangeEvent 1277 | module TextEditorViewColumnChangeEvent = { 1278 | type t 1279 | } 1280 | // https://code.visualstudio.com/api/references/vscode-api#TextEditorVisibleRangesChangeEvent 1281 | module TextEditorVisibleRangesChangeEvent = { 1282 | type t 1283 | } 1284 | 1285 | // https://code.visualstudio.com/api/references/vscode-api#InputBox 1286 | module InputBox = { 1287 | type t 1288 | } 1289 | 1290 | // https://code.visualstudio.com/api/references/vscode-api#OutputChannel 1291 | module OutputChannel = { 1292 | type t 1293 | } 1294 | 1295 | // https://github.com/microsoft/vscode/blob/ad42640a78864e43008b8d5b750d04e96dd05218/src/vscode-dts/vscode.d.ts#L953 1296 | // 1.95 1297 | module IconPath = { 1298 | type case = Uri(Uri.t) | ThemeIcon(ThemeIcon.t) | DarkAndLight({"dark": Uri.t, "light": Uri.t}) 1299 | type t 1300 | 1301 | external fromUri: Uri.t => t = "%identity" 1302 | external fromDarkAndLight: {"dark": Uri.t, "light": Uri.t} => t = "%identity" 1303 | external fromThemeIcon: ThemeIcon.t => t = "%identity" 1304 | 1305 | external toUri: 'a => Uri.t = "%identity" 1306 | external toDarkAndLight: 'a => {"dark": Uri.t, "light": Uri.t} = "%identity" 1307 | external toThemeIcon: 'a => ThemeIcon.t = "%identity" 1308 | 1309 | let case = (raw: 'a): case => 1310 | switch raw->Object.get("color") { 1311 | | Some(_) => Uri(toUri(raw)) 1312 | | None => 1313 | switch raw->Object.get("dark") { 1314 | | Some(_) => DarkAndLight(toDarkAndLight(raw)) 1315 | | None => ThemeIcon(toThemeIcon(raw)) 1316 | } 1317 | } 1318 | } 1319 | 1320 | // https://code.visualstudio.com/api/references/vscode-api#QuickInput 1321 | // 1.101 1322 | module QuickInput = { 1323 | type t 1324 | 1325 | // events 1326 | @send external onDidHide: (t, unit => unit) => Disposable.t = "onDidHide" 1327 | 1328 | // properties 1329 | @get external busy: t => bool = "busy" 1330 | @set external setBusy: (t, bool) => unit = "busy" 1331 | 1332 | @get external enabled: t => bool = "enabled" 1333 | @set external setEnabled: (t, bool) => unit = "enabled" 1334 | 1335 | @get external ignoreFocusOut: t => bool = "ignoreFocusOut" 1336 | @set external setIgnoreFocusOut: (t, bool) => unit = "ignoreFocusOut" 1337 | 1338 | @get external step: t => int = "step" 1339 | @set external setStep: (t, int) => unit = "step" 1340 | 1341 | @get external title: t => string = "title" 1342 | @set external setTitle: (t, string) => unit = "title" 1343 | 1344 | @get external totalSteps: t => int = "totalSteps" 1345 | @set external setTotalSteps: (t, int) => unit = "totalSteps" 1346 | 1347 | // methods 1348 | @send external dispose: t => unit = "dispose" 1349 | @send external hide: t => unit = "hide" 1350 | @send external show: t => unit = "show" 1351 | } 1352 | 1353 | // https://code.visualstudio.com/api/references/vscode-api#QuickInputButton 1354 | // 1.95 1355 | module QuickInputButton = { 1356 | type t = { 1357 | iconPath: IconPath.t, 1358 | tooltip: option, 1359 | } 1360 | } 1361 | 1362 | // https://code.visualstudio.com/api/references/vscode-api#QuickInputButtons 1363 | // 1.95 1364 | module QuickInputButtons = { 1365 | type t 1366 | // static 1367 | @module("vscode") @scope("QuickInputButtons") 1368 | external back: t => QuickInputButton.t = "Back" 1369 | } 1370 | 1371 | // https://code.visualstudio.com/api/references/vscode-api#QuickPickItemKind 1372 | // 1.95 1373 | module QuickPickItemKind = { 1374 | type t = 1375 | | @as(-1) Separator 1376 | | @as(0) Default 1377 | } 1378 | 1379 | // https://code.visualstudio.com/api/references/vscode-api#QuickPickItem 1380 | // 1.95 1381 | module QuickPickItem = { 1382 | type t = { 1383 | alwaysShow?: bool, 1384 | buttons?: array, 1385 | description?: string, 1386 | detail?: string, 1387 | iconPath?: IconPath.t, 1388 | kind?: QuickPickItemKind.t, 1389 | label: string, 1390 | picked?: bool, 1391 | } 1392 | } 1393 | 1394 | // https://code.visualstudio.com/api/references/vscode-api#QuickPickItemButtonEvent 1395 | // 1.95 1396 | module QuickPickItemButtonEvent = { 1397 | type t<'a> 1398 | // properties 1399 | @get external button: t<'a> => QuickInputButton.t = "button" 1400 | @get external item: t<'a> => 'a = "item" 1401 | } 1402 | 1403 | // https://code.visualstudio.com/api/references/vscode-api#QuickPickOptions 1404 | // 1.95 1405 | module QuickPickOptions = { 1406 | type t = { 1407 | onDidSelectItem?: StringOr.t => unit, 1408 | canPickMany?: bool, 1409 | ignoreFocusOut?: bool, 1410 | matchOnDescription?: bool, 1411 | matchOnDetail?: bool, 1412 | placeHolder?: string, 1413 | title?: string, 1414 | } 1415 | } 1416 | 1417 | // https://code.visualstudio.com/api/references/vscode-api#QuickPick 1418 | // 1.95 1419 | module QuickPick = { 1420 | type t<'a> 1421 | // events 1422 | @send external onDidAccept: (t<'a>, unit => unit) => Disposable.t = "onDidAccept" 1423 | @send external onDidChangeActive: (t<'a>, array<'a> => unit) => Disposable.t = "onDidChangeActive" 1424 | @send 1425 | external onDidChangeSelection: (t<'a>, array<'a> => unit) => Disposable.t = "onDidChangeSelection" 1426 | @send external onDidChangeValue: (t<'a>, string => unit) => Disposable.t = "onDidChangeValue" 1427 | @send external onDidHide: (t<'a>, unit => unit) => Disposable.t = "onDidHide" 1428 | @send 1429 | external onDidTriggerButton: (t<'a>, QuickInputButton.t => unit) => Disposable.t = 1430 | "onDidTriggerButton" 1431 | @send 1432 | external onDidTriggerItemButton: (t<'a>, QuickPickItemButtonEvent.t<'a> => unit) => Disposable.t = 1433 | "onDidTriggerItemButton" 1434 | // properties 1435 | @get external activeItems: t<'a> => array<'a> = "activeItems" 1436 | 1437 | @get external busy: t<'a> => bool = "busy" 1438 | @set external setBusy: (t<'a>, bool) => unit = "busy" 1439 | 1440 | @get external buttons: t<'a> => array = "buttons" 1441 | 1442 | @get external canSelectMany: t<'a> => bool = "canSelectMany" 1443 | @set external setCanSelectMany: (t<'a>, bool) => unit = "canSelectMany" 1444 | 1445 | @get external enabled: t<'a> => bool = "enabled" 1446 | @set external setEnabled: (t<'a>, bool) => unit = "enabled" 1447 | 1448 | @get external ignoreFocusOut: t<'a> => bool = "ignoreFocusOut" 1449 | @set external setIgnoreFocusOut: (t<'a>, bool) => unit = "ignoreFocusOut" 1450 | 1451 | @get external items: t<'a> => array<'a> = "items" 1452 | @set external setItems: (t<'a>, array<'a>) => unit = "items" 1453 | 1454 | @get external keepScrollPosition: t<'a> => option = "keepScrollPosition" 1455 | @set external setKeepScrollPosition: (t<'a>, option) => unit = "keepScrollPosition" 1456 | 1457 | @get external matchOnDescription: t<'a> => bool = "matchOnDescription" 1458 | @set external setMatchOnDescription: (t<'a>, bool) => unit = "matchOnDescription" 1459 | 1460 | @get external matchOnDetail: t<'a> => bool = "matchOnDetail" 1461 | @set external setMatchOnDetail: (t<'a>, bool) => unit = "matchOnDetail" 1462 | 1463 | @get external placeholder: t<'a> => option = "placeholder" 1464 | @set external setPlaceholder: (t<'a>, string) => unit = "placeholder" 1465 | 1466 | @get external selectedItems: t<'a> => array<'a> = "selectedItems" 1467 | @set external setSelectedItems: (t<'a>, array<'a>) => unit = "selectedItems" 1468 | 1469 | @get external step: t<'a> => int = "step" 1470 | @set external setStep: (t<'a>, int) => unit = "step" 1471 | 1472 | @get external title: t<'a> => string = "title" 1473 | @set external setTitle: (t<'a>, string) => unit = "title" 1474 | 1475 | @get external totalSteps: t<'a> => int = "totalSteps" 1476 | @set external setTotalSteps: (t<'a>, int) => unit = "totalSteps" 1477 | 1478 | @get external value: t<'a> => string = "value" 1479 | @set external setValue: (t<'a>, string) => unit = "value" 1480 | 1481 | // methods 1482 | @send external dispose: t<'a> => unit = "dispose" 1483 | @send external hide: t<'a> => unit = "hide" 1484 | @send external show: t<'a> => unit = "show" 1485 | } 1486 | 1487 | // https://code.visualstudio.com/api/references/vscode-api#AccessibilityInformation 1488 | // 1.55.0 1489 | module AccessibilityInformation = { 1490 | type t 1491 | // properties 1492 | @get external label: t => string = "label" 1493 | @get external role: t => option = "role" 1494 | } 1495 | 1496 | // https://code.visualstudio.com/api/references/vscode-api#StatusBarAlignment 1497 | // 1.95.0 1498 | module StatusBarAlignment = { 1499 | type t = 1500 | | @as(1) Left 1501 | | @as(2) Right 1502 | } 1503 | 1504 | // https://code.visualstudio.com/api/references/vscode-api#StatusBarItem 1505 | module StatusBarItem = { 1506 | type t 1507 | // properties 1508 | @get 1509 | external accessibilityInformation: t => option = 1510 | "accessibilityInformation" 1511 | @set 1512 | external setAccessibilityInformation: (t, AccessibilityInformation.t) => unit = 1513 | "accessibilityInformation" 1514 | @get external alignment: t => StatusBarAlignment.t = "alignment" 1515 | @set 1516 | external setAlignment: (t, StatusBarAlignment.t) => unit = "alignment" 1517 | @get external backgroundColor: t => option = "backgroundColor" 1518 | @set 1519 | external setBackgroundColor: (t, ThemeColor.t) => unit = "backgroundColor" 1520 | @get external color: t => option> = "color" 1521 | @set 1522 | external setColor: (t, ThemeColor.t) => unit = "color" 1523 | @set 1524 | external setColorWithString: (t, string) => unit = "color" 1525 | @get external command: t => option> = "command" 1526 | @set 1527 | external setCommand: (t, Command.t) => unit = "command" 1528 | @set 1529 | external setCommandWithString: (t, string) => unit = "command" 1530 | @get external priority: t => option = "priority" 1531 | @set 1532 | external setPriority: (t, int) => unit = "priority" 1533 | @get external text: t => string = "text" 1534 | @set 1535 | external setText: (t, string) => unit = "text" 1536 | @get external tooltip: t => option = "tooltip" 1537 | @set 1538 | external setTooltip: (t, string) => unit = "tooltip" 1539 | // methods 1540 | @send external dispose: t => unit = "dispose" 1541 | @send external hide: t => unit = "hide" 1542 | @send external show: t => unit = "show" 1543 | } 1544 | 1545 | // https://code.visualstudio.com/api/references/vscode-api#OverviewRulerLane; 1546 | // 1.95 1547 | module OverviewRulerLane = { 1548 | type t = 1549 | | @as(1) Left 1550 | | @as(2) Center 1551 | | @as(4) Right 1552 | | @as(7) Full 1553 | } 1554 | 1555 | // https://code.visualstudio.com/api/references/vscode-api#DecorationRangeBehavior; 1556 | // 1.95 1557 | module DecorationRangeBehavior = { 1558 | type t = 1559 | | @as(0) OpenOpen 1560 | | @as(1) ClosedClosed 1561 | | @as(2) OpenClosed 1562 | | @as(3) ClosedOpen 1563 | } 1564 | 1565 | // https://code.visualstudio.com/api/references/vscode-api#DecorationRenderOptions 1566 | module DecorationRenderOptions = { 1567 | @deriving(abstract) 1568 | type t = { 1569 | @optional 1570 | after: ThemableDecorationAttachmentRenderOptions.t, 1571 | @optional 1572 | backgroundColor: StringOr.t, 1573 | @optional 1574 | before: ThemableDecorationAttachmentRenderOptions.t, 1575 | @optional 1576 | border: string, 1577 | @optional 1578 | borderColor: StringOr.t, 1579 | @optional 1580 | borderRadius: string, 1581 | @optional 1582 | borderSpacing: string, 1583 | @optional 1584 | borderStyle: string, 1585 | @optional 1586 | borderWidth: string, 1587 | @optional 1588 | color: StringOr.t, 1589 | @optional 1590 | cursor: string, 1591 | @optional 1592 | dark: ThemableDecorationInstanceRenderOptions.t, 1593 | @optional 1594 | fontStyle: string, 1595 | @optional 1596 | fontWeight: string, 1597 | @optional 1598 | gutterIconPath: StringOr.t, 1599 | @optional 1600 | gutterIconSize: string, 1601 | @optional 1602 | isWholeLine: bool, 1603 | @optional 1604 | letterSpacing: string, 1605 | @optional 1606 | light: ThemableDecorationInstanceRenderOptions.t, 1607 | @optional 1608 | opacity: string, 1609 | @optional 1610 | outline: string, 1611 | @optional 1612 | outlineColor: StringOr.t, 1613 | @optional 1614 | outlineStyle: string, 1615 | @optional 1616 | outlineWidth: string, 1617 | @optional 1618 | overviewRulerColor: StringOr.t, 1619 | @optional 1620 | overviewRulerLane: OverviewRulerLane.t, 1621 | @optional 1622 | rangeBehavior: DecorationRangeBehavior.t, 1623 | @optional 1624 | textDecoration: string, 1625 | } 1626 | } 1627 | 1628 | // https://code.visualstudio.com/api/references/vscode-api#TreeViewOptions 1629 | module TreeViewOptions = { 1630 | type t 1631 | } 1632 | 1633 | // https://code.visualstudio.com/api/references/vscode-api#TreeView 1634 | module TreeView = { 1635 | type t 1636 | } 1637 | 1638 | // WebviewPanelOptions & WebviewOptions 1639 | module WebviewAndWebviewPanelOptions = { 1640 | type t = { 1641 | enableCommandUris: option, 1642 | enableScripts: option, 1643 | localResourceRoots: option>, 1644 | portMapping: option>, 1645 | enableFindWidget: option, 1646 | retainContextWhenHidden: option, 1647 | } 1648 | 1649 | let make = ( 1650 | ~enableCommandUris=?, 1651 | ~enableScripts=?, 1652 | ~localResourceRoots=?, 1653 | ~portMapping=?, 1654 | ~enableFindWidget=?, 1655 | ~retainContextWhenHidden=?, 1656 | (), 1657 | ): t => { 1658 | enableCommandUris, 1659 | enableScripts, 1660 | localResourceRoots, 1661 | portMapping, 1662 | enableFindWidget, 1663 | retainContextWhenHidden, 1664 | } 1665 | } 1666 | 1667 | // https://code.visualstudio.com/api/references/vscode-api#TreeDataProvider 1668 | module TreeDataProvider = { 1669 | type t 1670 | } 1671 | 1672 | // https://code.visualstudio.com/api/references/vscode-api#WebviewPanelSerializer 1673 | module WebviewPanelSerializer = { 1674 | type t 1675 | } 1676 | 1677 | // https://code.visualstudio.com/api/references/vscode-api#MessageItem 1678 | // 1.96 1679 | module MessageItem = { 1680 | type t = { 1681 | title: string, 1682 | isCloseAffordance?: bool, 1683 | } 1684 | } 1685 | 1686 | // https://code.visualstudio.com/api/references/vscode-api#MessageOptions 1687 | // 1.96 1688 | module MessageOptions = { 1689 | type t = { 1690 | modal?: bool, 1691 | detail?: string, 1692 | } 1693 | } 1694 | 1695 | // https://code.visualstudio.com/api/references/vscode-api#InputBoxValidationSeverity 1696 | // 1.95 1697 | 1698 | module InputBoxValidationSeverity = { 1699 | type t = 1700 | | @as(1) Info 1701 | | @as(2) Warning 1702 | | @as(3) Error 1703 | } 1704 | 1705 | // https://code.visualstudio.com/api/references/vscode-api#InputBoxValidationMessage 1706 | // 1.95 1707 | module InputBoxValidationMessage = { 1708 | type t = { 1709 | message: string, 1710 | severity: InputBoxValidationSeverity.t, 1711 | } 1712 | } 1713 | 1714 | // https://code.visualstudio.com/api/references/vscode-api#InputBoxOptions 1715 | module InputBoxOptions = { 1716 | type t = { 1717 | ignoreFocusOut?: bool, 1718 | password?: bool, 1719 | placeHolder?: string, 1720 | prompt?: string, 1721 | title?: string, 1722 | value?: string, 1723 | valueSelection?: (int, int), 1724 | validateInput?: string => PromiseOr.t>>, 1725 | } 1726 | } 1727 | 1728 | // https://code.visualstudio.com/api/references/vscode-api#CancellationToken 1729 | // 1.96 1730 | module CancellationToken = { 1731 | @unboxed 1732 | type rec any = Any('x): any 1733 | type t = { 1734 | isCancellationRequested: bool, 1735 | onCancellationRequested: (any => unit) => Disposable.t, 1736 | } 1737 | } 1738 | 1739 | // https://code.visualstudio.com/api/references/vscode-api#CancellationTokenSource 1740 | // 1.96 1741 | module CancellationTokenSource = { 1742 | type t 1743 | // properties 1744 | @get external token: t => CancellationToken.t = "token" 1745 | // methods 1746 | @send external cancel: t => unit = "cancel" 1747 | @send external dispose: t => unit = "dispose" 1748 | } 1749 | 1750 | // https://code.visualstudio.com/api/references/vscode-api#QuickDiffProvider 1751 | // 1.101 1752 | module QuickDiffProvider = { 1753 | type t 1754 | 1755 | // methods 1756 | @send 1757 | external provideOriginalResource: (t, Uri.t, CancellationToken.t) => ProviderResult.t = 1758 | "provideOriginalResource" 1759 | } 1760 | 1761 | // https://code.visualstudio.com/api/references/vscode-api#ReferenceContext 1762 | // 1.101 1763 | module ReferenceContext = { 1764 | type t = {includeDeclaration: bool} 1765 | } 1766 | 1767 | // https://code.visualstudio.com/api/references/vscode-api#OpenDialogOptions 1768 | // 1.96 1769 | module OpenDialogOptions = { 1770 | type t = { 1771 | defaultUri?: Uri.t, 1772 | openLabel?: string, 1773 | canSelectFiles?: bool, 1774 | canSelectFolders?: bool, 1775 | canSelectMany?: bool, 1776 | filters?: Dict.t>, 1777 | title?: string, 1778 | } 1779 | } 1780 | 1781 | // https://code.visualstudio.com/api/references/vscode-api#SaveDialogOptions 1782 | // 1.96 1783 | module SaveDialogOptions = { 1784 | type t = { 1785 | defaultUri?: Uri.t, 1786 | saveLabel?: string, 1787 | filters?: Dict.t>, 1788 | title?: string, 1789 | } 1790 | } 1791 | // https://code.visualstudio.com/api/references/vscode-api#WorkspaceFolderPickOptions 1792 | module WorkspaceFolderPickOptions = { 1793 | type t 1794 | // properties 1795 | @get external ignoreFocusOut: t => option = "ignoreFocusOut" 1796 | @get external placeHolder: t => option = "placeHolder" 1797 | } 1798 | 1799 | // https://code.visualstudio.com/api/references/vscode-api#Progress 1800 | // 1.96 1801 | module Progress = { 1802 | type t<'a> 1803 | // methods 1804 | @send external report: (t<'a>, 'a) => unit = "report" 1805 | } 1806 | 1807 | // https://code.visualstudio.com/api/references/vscode-api#ProgressLocation 1808 | // 1.96 1809 | module ProgressLocation = { 1810 | type t = 1811 | | @as(1) SourceControl 1812 | | @as(10) Window 1813 | | @as(15) Notification 1814 | } 1815 | 1816 | // https://code.visualstudio.com/api/references/vscode-api#ProgressOptions 1817 | // 1.96 1818 | module ProgressOptions = { 1819 | type t = { 1820 | cancellable?: bool, 1821 | location: ProgressLocation.t, 1822 | title?: string, 1823 | } 1824 | } 1825 | 1826 | // https://code.visualstudio.com/api/references/vscode-api#ProgressOptions 1827 | // 1.96 1828 | module ProcessOptionsWithViewIdAsLocation = { 1829 | type t = { 1830 | cancellable?: bool, 1831 | location: {"viewId": string}, 1832 | title?: string, 1833 | } 1834 | } 1835 | 1836 | // https://code.visualstudio.com/api/references/vscode-api#TextDocumentShowOptions; 1837 | module TextDocumentShowOptions = { 1838 | type t = { 1839 | preserveFocus: option, 1840 | preview: option, 1841 | selection: option, 1842 | viewColumn: option, 1843 | } 1844 | 1845 | let make = (~preserveFocus=?, ~preview=?, ~selection=?, ~viewColumn=?, ()): t => { 1846 | preserveFocus, 1847 | preview, 1848 | selection, 1849 | viewColumn, 1850 | } 1851 | } 1852 | 1853 | // https://code.visualstudio.com/api/references/vscode-api#ColorThemeKind; 1854 | // 1.95 1855 | module ColorThemeKind = { 1856 | type t = 1857 | | @as(1) Light 1858 | | @as(2) Dark 1859 | | @as(3) HighContrast 1860 | | @as(4) HighContrastLight 1861 | } 1862 | 1863 | // https://code.visualstudio.com/api/references/vscode-api#ColorTheme 1864 | // 1.95.0 1865 | module ColorTheme = { 1866 | type t 1867 | // properties 1868 | @get external kind: t => ColorThemeKind.t = "kind" 1869 | } 1870 | 1871 | // https://code.visualstudio.com/api/references/vscode-api#CustomDocumentOpenContext 1872 | module CustomDocumentOpenContext = { 1873 | type t 1874 | // properties 1875 | @get external backupId: t => option = "backupId" 1876 | } 1877 | 1878 | // https://code.visualstudio.com/api/references/vscode-api#CustomEditorProvider 1879 | // module CustomEditorProvider = { 1880 | // type t('a); 1881 | // // events 1882 | // [@bs.send] 1883 | // external onDidChangeCustomDocument: (t('a), Uri.t => unit) => Disposable.t = 1884 | // "onDidChange"; 1885 | // // methods 1886 | // [@bs.send] 1887 | // external openCustomDocument: 1888 | // (t('a), Uri.t, CustomDocumentOpenContext.t, CancellationToken.t) => 1889 | // option(promise('a)) = 1890 | // "openCustomDocument"; 1891 | // [@bs.send] 1892 | // external resolveCustomEditor: 1893 | // (t('a), 'a, WebviewPanel.t, CancellationToken.t) => 1894 | // option(promise(unit)) = 1895 | // "resolveCustomEditor"; 1896 | // }; 1897 | 1898 | // https://code.visualstudio.com/api/references/vscode-api#CustomReadonlyEditorProvider 1899 | module CustomReadonlyEditorProvider = { 1900 | type t<'a> 1901 | // methods 1902 | @send 1903 | external openCustomDocument: ( 1904 | t<'a>, 1905 | Uri.t, 1906 | CustomDocumentOpenContext.t, 1907 | CancellationToken.t, 1908 | ) => option> = "openCustomDocument" 1909 | @send 1910 | external resolveCustomEditor: ( 1911 | t<'a>, 1912 | 'a, 1913 | WebviewPanel.t, 1914 | CancellationToken.t, 1915 | ) => option> = "resolveCustomEditor" 1916 | } 1917 | 1918 | // https://code.visualstudio.com/api/references/vscode-api#CustomTextEditorProvider 1919 | module CustomTextEditorProvider = { 1920 | type t 1921 | // methods 1922 | @send 1923 | external resolveCustomTextEditor: ( 1924 | t, 1925 | TextDocument.t, 1926 | WebviewPanel.t, 1927 | CancellationToken.t, 1928 | ) => option> = "resolveCustomTextEditor" 1929 | } 1930 | 1931 | // https://code.visualstudio.com/api/references/vscode-api#CustomEditorProvider 1932 | module CustomEditorProvider = { 1933 | type t<'a> 1934 | } 1935 | 1936 | // https://code.visualstudio.com/api/references/vscode-api#TerminalLinkProvider 1937 | module TerminalLinkProvider = { 1938 | type t 1939 | } 1940 | 1941 | // https://code.visualstudio.com/api/references/vscode-api#WebviewView 1942 | // 1.101 1943 | module WebviewView = { 1944 | type t 1945 | 1946 | // events 1947 | @send 1948 | external onDidChangeVisibility: (t, unit => unit) => Disposable.t = "onDidChangeVisibility" 1949 | @send 1950 | external onDidDispose: (t, unit => unit) => Disposable.t = "onDidDispose" 1951 | 1952 | // properties 1953 | @get external badge: t => option<'badge> = "badge" 1954 | @get external description: t => option = "description" 1955 | @get external title: t => option = "title" 1956 | @get external viewType: t => string = "viewType" 1957 | @get external visible: t => bool = "visible" 1958 | @get external webview: t => Webview.t = "webview" 1959 | 1960 | // methods 1961 | @send external show: (t, ~preserveFocus: bool=?) => unit = "show" 1962 | } 1963 | 1964 | // https://code.visualstudio.com/api/references/vscode-api#WebviewViewResolveContext 1965 | // 1.51.0 1966 | module WebviewViewResolveContext = { 1967 | type t<'a> 1968 | // properties 1969 | @get external state: t<'a> => option<'a> = "state" 1970 | } 1971 | 1972 | // https://code.visualstudio.com/api/references/vscode-api#WebviewViewProvider 1973 | // 1.51.0 1974 | module WebviewViewProvider = { 1975 | type t 1976 | // methods 1977 | @send 1978 | external resolveWebviewView: ( 1979 | t, 1980 | WebviewView.t, 1981 | WebviewViewResolveContext.t<'a>, 1982 | CancellationToken.t, 1983 | ) => option> = "resolveWebviewView" 1984 | } 1985 | 1986 | // https://code.visualstudio.com/api/references/vscode-api#UriHandler 1987 | // 1.51.0 1988 | module UriHandler = { 1989 | type t 1990 | // methods 1991 | @send 1992 | external handleUri: (t, Uri.t) => ProviderResult.t = "handleUri" 1993 | } 1994 | 1995 | // https://code.visualstudio.com/api/references/vscode-api#FileDecoration 1996 | // 1.101 1997 | module FileDecoration = { 1998 | type t 1999 | // constructors 2000 | @module("vscode") @new 2001 | external make: ( 2002 | ~badge: option=?, 2003 | ~tooltip: option=?, 2004 | ~color: option=?, 2005 | ) => t = "FileDecoration" 2006 | // properties 2007 | @get external badge: t => option = "badge" 2008 | @get external color: t => option = "color" 2009 | @get external propagate: t => option = "propagate" 2010 | @get external tooltip: t => option = "tooltip" 2011 | } 2012 | 2013 | // https://code.visualstudio.com/api/references/vscode-api#FileDecorationProvider 2014 | // 1.101 2015 | module FileDecorationProvider = { 2016 | type t 2017 | // events 2018 | @send 2019 | external onDidChangeFileDecorations: (t, option> => unit) => Disposable.t = 2020 | "onDidChangeFileDecorations" 2021 | // methods 2022 | @send 2023 | external provideFileDecoration: ( 2024 | t, 2025 | Uri.t, 2026 | CancellationToken.t, 2027 | ) => ProviderResult.t = "provideFileDecoration" 2028 | } 2029 | 2030 | // https://code.visualstudio.com/api/references/vscode-api#window 2031 | // 1.51.0 2032 | module Window = { 2033 | // variables 2034 | @module("vscode") @scope("window") 2035 | external activeColorTheme: ColorTheme.t = "activeColorTheme" 2036 | @module("vscode") @scope("window") 2037 | external activeTerminal: option = "activeTerminal" 2038 | @module("vscode") @scope("window") 2039 | external activeTextEditor: option = "activeTextEditor" 2040 | @module("vscode") @scope("window") 2041 | external state: WindowState.t = "state" 2042 | @module("vscode") @scope("window") 2043 | external terminals: array = "terminals" 2044 | @module("vscode") @scope("window") 2045 | external visibleTextEditors: array = "visibleTextEditors" 2046 | // events 2047 | @module("vscode") @scope("window") 2048 | external onDidChangeActiveColorTheme: (ColorTheme.t => unit) => Disposable.t = 2049 | "onDidChangeActiveColorTheme" 2050 | @module("vscode") @scope("window") 2051 | external onDidChangeActiveTerminal: (option => unit) => Disposable.t = 2052 | "onDidChangeActiveTerminal" 2053 | @module("vscode") @scope("window") 2054 | external onDidChangeActiveTextEditor: (option => unit) => Disposable.t = 2055 | "onDidChangeActiveTextEditor" 2056 | @module("vscode") @scope("window") 2057 | external onDidChangeTextEditorOptions: (TextEditorOptionsChangeEvent.t => unit) => Disposable.t = 2058 | "onDidChangeTextEditorOptions" 2059 | @module("vscode") @scope("window") 2060 | external onDidChangeTextEditorSelection: ( 2061 | TextEditorSelectionChangeEvent.t => unit 2062 | ) => Disposable.t = "onDidChangeTextEditorSelection" 2063 | @module("vscode") @scope("window") 2064 | external onDidChangeTextEditorViewColumn: ( 2065 | TextEditorViewColumnChangeEvent.t => unit 2066 | ) => Disposable.t = "onDidChangeTextEditorViewColumn" 2067 | @module("vscode") @scope("window") 2068 | external onDidChangeTextEditorVisibleRanges: ( 2069 | TextEditorVisibleRangesChangeEvent.t => unit 2070 | ) => Disposable.t = "onDidChangeTextEditorVisibleRanges" 2071 | @module("vscode") @scope("window") 2072 | external onDidChangeVisibleTextEditors: (array => unit) => Disposable.t = 2073 | "onDidChangeVisibleTextEditors" 2074 | @module("vscode") @scope("window") 2075 | external onDidChangeWindowState: (WindowState.t => unit) => Disposable.t = 2076 | "onDidChangeWindowState" 2077 | @module("vscode") @scope("window") 2078 | external onDidCloseTerminal: (Terminal.t => unit) => Disposable.t = "onDidCloseTerminal" 2079 | @module("vscode") @scope("window") 2080 | external onDidOpenTerminal: (Terminal.t => unit) => Disposable.t = "onDidOpenTerminal" 2081 | 2082 | // functions 2083 | @module("vscode") @scope("window") 2084 | external createInputBox: unit => InputBox.t = "createInputBox" 2085 | @module("vscode") @scope("window") 2086 | external createOutputChannel: string => OutputChannel.t = "createOutputChannel" 2087 | @module("vscode") @scope("window") 2088 | external createQuickPick: unit => QuickPick.t<'a> = "createQuickPick" 2089 | @module("vscode") @scope("window") 2090 | external createStatusBarItem: (option, option) => StatusBarItem.t = 2091 | "createStatusBarItem" 2092 | @module("vscode") @scope("window") 2093 | external createTerminal: ( 2094 | ~name: string=?, 2095 | ~shellPath: string=?, 2096 | ~shellArgs: array=?, 2097 | unit, 2098 | ) => Terminal.t = "createTerminal" 2099 | @module("vscode") @scope("window") 2100 | external createTerminalWithTerminalOptions: TerminalOptions.t => Terminal.t = "createTerminal" 2101 | @module("vscode") @scope("window") 2102 | external createTerminalWithExtensionTerminalOptions: ExtensionTerminalOptions.t => Terminal.t = 2103 | "createTerminal" 2104 | @module("vscode") @scope("window") 2105 | external createTextEditorDecorationType: DecorationRenderOptions.t => TextEditorDecorationType.t = 2106 | "createTextEditorDecorationType" 2107 | @module("vscode") @scope("window") 2108 | external createTreeView: (string, TreeViewOptions.t) => TreeView.t = "createTreeView" 2109 | @module("vscode") @scope("window") 2110 | external createWebviewPanel: ( 2111 | string, 2112 | string, 2113 | {"preserveFocus": bool, "viewColumn": int}, 2114 | option, 2115 | ) => WebviewPanel.t = "createWebviewPanel" 2116 | @module("vscode") @scope("window") 2117 | external registerCustomTextEditorProvider: (string, CustomTextEditorProvider.t) => Disposable.t = 2118 | "registerCustomEditorProvider" 2119 | @module("vscode") @scope("window") 2120 | external registerCustomTextEditorProviderWithOptions: ( 2121 | string, 2122 | CustomTextEditorProvider.t, 2123 | {"supportsMultipleEditorsPerDocument": bool, "webviewOption": 'webviewPanelOptions}, 2124 | ) => Disposable.t = "registerCustomEditorProvider" 2125 | 2126 | @module("vscode") @scope("window") 2127 | external registerCustomReadonlyEditorProvider: ( 2128 | string, 2129 | CustomReadonlyEditorProvider.t<'a>, 2130 | ) => Disposable.t = "registerCustomEditorProvider" 2131 | @module("vscode") @scope("window") 2132 | external registerCustomReadonlyEditorProviderWithOptions: ( 2133 | string, 2134 | CustomReadonlyEditorProvider.t<'a>, 2135 | {"supportsMultipleEditorsPerDocument": bool, "webviewOption": 'webviewPanelOptions}, 2136 | ) => Disposable.t = "registerCustomEditorProvider" 2137 | 2138 | @module("vscode") @scope("window") 2139 | external registerCustomEditorProvider: (string, CustomEditorProvider.t<'a>) => Disposable.t = 2140 | "registerCustomEditorProvider" 2141 | @module("vscode") @scope("window") 2142 | external registerCustomEditorProviderWithOptions: ( 2143 | string, 2144 | CustomEditorProvider.t<'a>, 2145 | {"supportsMultipleEditorsPerDocument": bool, "webviewOption": 'webviewPanelOptions}, 2146 | ) => Disposable.t = "registerCustomEditorProvider" 2147 | @module("vscode") @scope("window") 2148 | external registerFileDecorationProvider: FileDecorationProvider.t => Disposable.t = 2149 | "registerFileDecorationProvider" 2150 | @module("vscode") @scope("window") 2151 | external registerTerminalLinkProvider: (string, TerminalLinkProvider.t) => Disposable.t = 2152 | "registerTerminalLinkProvider" 2153 | @module("vscode") @scope("window") 2154 | external registerTreeDataProvider: (string, TreeDataProvider.t) => Disposable.t = 2155 | "registerTreeDataProvider" 2156 | @module("vscode") @scope("window") 2157 | external registerUriHandler: UriHandler.t => Disposable.t = "registerUriHandler" 2158 | @module("vscode") @scope("window") 2159 | external registerWebviewPanelSerializer: (string, WebviewPanelSerializer.t) => Disposable.t = 2160 | "registerWebviewPanelSerializer" 2161 | @module("vscode") @scope("window") 2162 | external registerWebviewViewProvider: (string, WebviewViewProvider.t) => Disposable.t = 2163 | "registerWebviewViewProvider" 2164 | @module("vscode") @scope("window") 2165 | external registerWebviewViewProviderWithOptions: ( 2166 | string, 2167 | WebviewViewProvider.t, 2168 | {"webviewOptions": {"retainContextWhenHidden": bool}}, 2169 | ) => Disposable.t = "registerWebviewViewProvider" 2170 | @module("vscode") @scope("window") 2171 | external setStatusBarMessageAndHideAfterTimeout: (string, int) => Disposable.t = 2172 | "setStatusBarMessage" 2173 | @module("vscode") @scope("window") 2174 | external setStatusBarMessageAndHideWhenDone: (string, promise<'a>) => Disposable.t = 2175 | "setStatusBarMessage" 2176 | @module("vscode") @scope("window") 2177 | external setStatusBarMessage: string => Disposable.t = "setStatusBarMessage" 2178 | @module("vscode") @scope("window") @variadic 2179 | external showErrorMessage: (string, array) => promise> = "showErrorMessage" 2180 | @module("vscode") @scope("window") @variadic 2181 | external showErrorMessageWithOptions: ( 2182 | string, 2183 | MessageOptions.t, 2184 | array, 2185 | ) => promise> = "showErrorMessage" 2186 | @module("vscode") @scope("window") @variadic 2187 | external showErrorMessageWithMessageItem: ( 2188 | string, 2189 | array, 2190 | ) => promise> = "showErrorMessage" 2191 | @module("vscode") @scope("window") @variadic 2192 | external showErrorMessageWithOptionsAndMessageItem: ( 2193 | string, 2194 | MessageOptions.t, 2195 | array, 2196 | ) => promise> = "showErrorMessage" 2197 | @module("vscode") @scope("window") @variadic 2198 | external showInformationMessage: (string, array) => promise> = 2199 | "showInformationMessage" 2200 | @module("vscode") @scope("window") @variadic 2201 | external showInformationMessageWithOptions: ( 2202 | string, 2203 | MessageOptions.t, 2204 | array, 2205 | ) => promise> = "showInformationMessage" 2206 | @module("vscode") @scope("window") @variadic 2207 | external showInformationMessageWithMessageItem: ( 2208 | string, 2209 | array, 2210 | ) => promise> = "showInformationMessage" 2211 | @module("vscode") @scope("window") @variadic 2212 | external showInformationMessageWithOptionsAndMessageItem: ( 2213 | string, 2214 | MessageOptions.t, 2215 | array, 2216 | ) => promise> = "showInformationMessage" 2217 | @module("vscode") @scope("window") 2218 | external showInputBox: ( 2219 | ~option: InputBoxOptions.t=?, 2220 | ~token: CancellationToken.t=?, 2221 | ) => promise> = "showInputBox" 2222 | @module("vscode") @scope("window") 2223 | external showOpenDialog: OpenDialogOptions.t => promise> = "shoeOpenDialog" 2224 | @module("vscode") @scope("window") 2225 | external showQuickPick: ( 2226 | promise>, 2227 | QuickPickOptions.t, 2228 | option, 2229 | ) => promise>> = "showQuickPick" 2230 | @module("vscode") @scope("window") 2231 | external showSaveDialog: SaveDialogOptions.t => promise> = "showSaveDialog" 2232 | @module("vscode") @scope("window") 2233 | external showTextDocument: ( 2234 | TextDocument.t, 2235 | ~column: ViewColumn.t=?, 2236 | ~preserveFocus: bool=?, 2237 | unit, 2238 | ) => promise = "showTextDocument" 2239 | @module("vscode") @scope("window") 2240 | external showTextDocumentWithShowOptions: ( 2241 | TextDocument.t, 2242 | option, 2243 | ) => promise = "showTextDocument" 2244 | @module("vscode") @scope("window") 2245 | external showTextDocumentWithUri: ( 2246 | Uri.t, 2247 | option, 2248 | ) => promise = "showTextDocument" 2249 | @module("vscode") @scope("window") @variadic 2250 | external showWarningMessage: (string, array) => promise> = 2251 | "showWarningMessage" 2252 | @module("vscode") @scope("window") @variadic 2253 | external showWarningMessageWithOptions: ( 2254 | string, 2255 | MessageOptions.t, 2256 | array, 2257 | ) => promise> = "showWarningMessage" 2258 | @module("vscode") @scope("window") @variadic 2259 | external showWarningMessageWithMessageItem: ( 2260 | string, 2261 | array, 2262 | ) => promise> = "showWarningMessage" 2263 | @module("vscode") @scope("window") @variadic 2264 | external showWarningMessageWithOptionsAndMessageItem: ( 2265 | string, 2266 | MessageOptions.t, 2267 | array, 2268 | ) => promise> = "showWarningMessage" 2269 | @module("vscode") @scope("window") 2270 | external showWorkspaceFolderPick: option => promise< 2271 | option, 2272 | > = "showWorkspaceFolderPick" 2273 | @module("vscode") @scope("window") 2274 | external withProgress: ( 2275 | ProgressOptions.t, 2276 | (Progress.t<{"increment": int, "message": string}>, CancellationToken.t) => promise<'a>, 2277 | ) => promise<'a> = "withProgress" 2278 | @module("vscode") @scope("window") 2279 | external withScmProgress: ((Progress.t, CancellationToken.t) => promise<'a>) => promise<'a> = 2280 | "withScmProgress" 2281 | } 2282 | 2283 | // https://code.visualstudio.com/api/references/vscode-api#FileType 2284 | // 1.101 2285 | module FileType = { 2286 | type t = 2287 | | @as(0) Unknown 2288 | | @as(1) File 2289 | | @as(2) Directory 2290 | | @as(64) SymbolicLink 2291 | } 2292 | 2293 | // https://code.visualstudio.com/api/references/vscode-api#FilePermission 2294 | // 1.101 2295 | module FilePermission = { 2296 | type t = | @as(1) Readonly 2297 | } 2298 | 2299 | // https://code.visualstudio.com/api/references/vscode-api#FileRenameEvent 2300 | // 1.101 2301 | module FileRenameEvent = { 2302 | type t 2303 | // properties 2304 | @get 2305 | external files: t => array<{"newUri": Uri.t, "oldUri": Uri.t}> = "files" 2306 | } 2307 | 2308 | // https://code.visualstudio.com/api/references/vscode-api#FileDeleteEvent 2309 | // 1.101 2310 | module FileDeleteEvent = { 2311 | type t 2312 | // properties 2313 | @get external files: t => array = "files" 2314 | } 2315 | 2316 | // https://code.visualstudio.com/api/references/vscode-api#FileStat 2317 | // 1.101 2318 | module FileStat = { 2319 | type t 2320 | @get external ctime: t => int = "ctime" 2321 | @get external mtime: t => int = "mtime" 2322 | @get external permissions: t => option = "permissions" 2323 | @get external size: t => int = "size" 2324 | @get external type_: t => FileType.t = "type" 2325 | } 2326 | 2327 | // https://code.visualstudio.com/api/references/vscode-api#FoldingRangeKind 2328 | // 1.101 2329 | module FoldingRangeKind = { 2330 | type t = 2331 | | @as(1) Comment 2332 | | @as(2) Imports 2333 | | @as(3) Region 2334 | } 2335 | 2336 | // https://code.visualstudio.com/api/references/vscode-api#FoldingRange 2337 | // 1.101 2338 | module FoldingRange = { 2339 | type t 2340 | 2341 | // constructors 2342 | @module("vscode") @new 2343 | external make: (int, int, ~kind: FoldingRangeKind.t=?) => t = "FoldingRange" 2344 | 2345 | // properties 2346 | @get external end_: t => int = "end" 2347 | @get external kind: t => option = "kind" 2348 | @get external start: t => int = "start" 2349 | } 2350 | 2351 | // https://code.visualstudio.com/api/references/vscode-api#FoldingContext 2352 | // 1.101 2353 | module FoldingContext = { 2354 | type t 2355 | } 2356 | 2357 | // https://code.visualstudio.com/api/references/vscode-api#FoldingRangeProvider 2358 | // 1.101 2359 | module FoldingRangeProvider = { 2360 | type t 2361 | 2362 | // events 2363 | @get 2364 | external onDidChangeFoldingRanges: t => option<(unit => unit) => Disposable.t> = 2365 | "onDidChangeFoldingRanges" 2366 | 2367 | // methods 2368 | @send 2369 | external provideFoldingRanges: ( 2370 | t, 2371 | TextDocument.t, 2372 | FoldingContext.t, 2373 | CancellationToken.t, 2374 | ) => ProviderResult.t> = "provideFoldingRanges" 2375 | } 2376 | 2377 | // https://code.visualstudio.com/api/references/vscode-api#FormattingOptions 2378 | // 1.101 2379 | module FormattingOptions = { 2380 | type t 2381 | 2382 | // properties 2383 | @get external insertSpaces: t => bool = "insertSpaces" 2384 | @get external tabSize: t => int = "tabSize" 2385 | } 2386 | 2387 | // https://code.visualstudio.com/api/references/vscode-api#FunctionBreakpoint 2388 | // 1.101 2389 | module FunctionBreakpoint = { 2390 | type t 2391 | 2392 | // constructors 2393 | @module("vscode") @new 2394 | external make: ( 2395 | string, 2396 | ~enabled: bool=?, 2397 | ~condition: string=?, 2398 | ~hitCondition: string=?, 2399 | ~logMessage: string=?, 2400 | ) => t = "FunctionBreakpoint" 2401 | 2402 | // properties 2403 | @get external condition: t => option = "condition" 2404 | @get external enabled: t => bool = "enabled" 2405 | @get external functionName: t => string = "functionName" 2406 | @get external hitCondition: t => option = "hitCondition" 2407 | @get external id: t => string = "id" 2408 | @get external logMessage: t => option = "logMessage" 2409 | } 2410 | 2411 | // https://code.visualstudio.com/api/references/vscode-api#TelemetrySender 2412 | // 1.101 2413 | module TelemetrySender = { 2414 | type t 2415 | 2416 | // methods 2417 | @send 2418 | external flush: t => option> = "flush" 2419 | @send 2420 | external sendErrorData: (t, Js.Exn.t, ~data: Js.Dict.t<'any>=?) => unit = "sendErrorData" 2421 | @send 2422 | external sendEventData: (t, string, ~data: Js.Dict.t<'any>=?) => unit = "sendEventData" 2423 | } 2424 | 2425 | // https://code.visualstudio.com/api/references/vscode-api#TelemetryTrustedValue 2426 | // 1.101 2427 | module TelemetryTrustedValue = { 2428 | type t<'a> 2429 | 2430 | // constructors 2431 | @module("vscode") @new 2432 | external make: 'a => t<'a> = "TelemetryTrustedValue" 2433 | 2434 | // properties 2435 | @get external value: t<'a> => 'a = "value" 2436 | } 2437 | 2438 | // https://code.visualstudio.com/api/references/vscode-api#LogLevel 2439 | // 1.101 2440 | module LogLevel = { 2441 | type t = 2442 | | @as(0) Off 2443 | | @as(1) Trace 2444 | | @as(2) Debug 2445 | | @as(3) Info 2446 | | @as(4) Warning 2447 | | @as(5) Error 2448 | } 2449 | 2450 | // https://code.visualstudio.com/api/references/vscode-api#LogOutputChannel 2451 | // 1.101 2452 | module LogOutputChannel = { 2453 | type t 2454 | 2455 | // events 2456 | @send 2457 | external onDidChangeLogLevel: (t, LogLevel.t => unit) => Disposable.t = "onDidChangeLogLevel" 2458 | 2459 | // properties 2460 | @get external logLevel: t => LogLevel.t = "logLevel" 2461 | @get external name: t => string = "name" 2462 | 2463 | // methods 2464 | @send external append: (t, string) => unit = "append" 2465 | @send external appendLine: (t, string) => unit = "appendLine" 2466 | @send external clear: t => unit = "clear" 2467 | @send @variadic external debug: (t, string, array<'any>) => unit = "debug" 2468 | @send external dispose: t => unit = "dispose" 2469 | @send @variadic external error: (t, StringOr.t, array<'any>) => unit = "error" 2470 | @send external hide: t => unit = "hide" 2471 | @send @variadic external info: (t, string, array<'any>) => unit = "info" 2472 | @send external replace: (t, string) => unit = "replace" 2473 | @send external show: (t, ~preserveFocus: bool=?) => unit = "show" 2474 | @send 2475 | external showWithColumn: (t, ~column: ViewColumn.t=?, ~preserveFocus: bool=?) => unit = "show" 2476 | @send @variadic external trace: (t, string, array<'any>) => unit = "trace" 2477 | @send @variadic external warn: (t, string, array<'any>) => unit = "warn" 2478 | } 2479 | 2480 | // https://code.visualstudio.com/api/references/vscode-api#FileSystemError 2481 | // 1.101 2482 | module FileSystemError = { 2483 | type t 2484 | 2485 | // Constructors 2486 | @module("vscode") @new 2487 | external make: (~messageOrUri: StringOr.t=?) => t = "FileSystemError" 2488 | 2489 | // Properties 2490 | @get external code: t => string = "code" 2491 | 2492 | // Static methods 2493 | @module("vscode") @scope("FileSystemError") 2494 | external fileExists: (~messageOrUri: StringOr.t=?) => t = "FileExists" 2495 | @module("vscode") @scope("FileSystemError") 2496 | external fileIsADirectory: (~messageOrUri: StringOr.t=?) => t = "FileIsADirectory" 2497 | @module("vscode") @scope("FileSystemError") 2498 | external fileNotADirectory: (~messageOrUri: StringOr.t=?) => t = "FileNotADirectory" 2499 | @module("vscode") @scope("FileSystemError") 2500 | external fileNotFound: (~messageOrUri: StringOr.t=?) => t = "FileNotFound" 2501 | @module("vscode") @scope("FileSystemError") 2502 | external noPermissions: (~messageOrUri: StringOr.t=?) => t = "NoPermissions" 2503 | @module("vscode") @scope("FileSystemError") 2504 | external unavailable: (~messageOrUri: StringOr.t=?) => t = "Unavailable" 2505 | } 2506 | 2507 | // https://code.visualstudio.com/api/references/vscode-api#FileSystem 2508 | // 1.101 2509 | module FileSystem = { 2510 | type t 2511 | // methods 2512 | @send external copy: (t, Uri.t, Uri.t, ~options: {"overwrite": bool}=?) => promise = "copy" 2513 | @send 2514 | external createDirectory: (t, Uri.t) => promise = "createDirectory" 2515 | @send 2516 | external delete: (t, Uri.t, ~options: {"recursive": bool, "useTrash": bool}=?) => promise = 2517 | "delete" 2518 | @send 2519 | external isWritableFileSystem: (t, string) => bool = "isWritableFileSystem" 2520 | @send 2521 | external readDirectory: (t, Uri.t) => promise> = "readDirectory" 2522 | @send 2523 | external readFile: (t, Uri.t) => promise = "readFile" 2524 | @send 2525 | external rename: (t, Uri.t, Uri.t, ~options: {"overwrite": bool}=?) => promise = "rename" 2526 | @send external stat: (t, Uri.t) => promise = "stat" 2527 | @send 2528 | external writeFile: (t, Uri.t, Uint8Array.t) => promise = "writeFile" 2529 | } 2530 | 2531 | // https://code.visualstudio.com/api/references/vscode-api#ConfigurationChangeEvent 2532 | // 1.101 2533 | module ConfigurationChangeEvent = { 2534 | type t 2535 | 2536 | @send 2537 | external affectsConfiguration: ( 2538 | t, 2539 | string, 2540 | @unwrap 2541 | [ 2542 | | #Uri(Uri.t) 2543 | | #TextDocument(TextDocument.t) 2544 | | #WorkspaceFolder(WorkspaceFolder.t) 2545 | | #Others(option<{"languageId": string, "uri": Uri.t}>) 2546 | ], 2547 | ) => bool = "affectsConfiguration" 2548 | } 2549 | 2550 | // https://code.visualstudio.com/api/references/vscode-api#TextDocumentContentChangeEvent 2551 | // 1.101 2552 | module TextDocumentContentChangeEvent = { 2553 | type t 2554 | // properties 2555 | @get external range: t => Range.t = "range" 2556 | @get external rangeLength: t => int = "rangeLength" 2557 | @get external rangeOffset: t => int = "rangeOffset" 2558 | @get external text: t => string = "text" 2559 | } 2560 | 2561 | // https://code.visualstudio.com/api/references/vscode-api#TextDocumentChangeReason 2562 | // 1.101 2563 | module TextDocumentChangeReason = { 2564 | type t = 2565 | | @as(1) Undo 2566 | | @as(2) Redo 2567 | } 2568 | 2569 | // https://code.visualstudio.com/api/references/vscode-api#TextDocumentChangeEvent 2570 | // 1.101 2571 | module TextDocumentChangeEvent = { 2572 | type t 2573 | // properties 2574 | @get 2575 | external contentChanges: t => array = "contentChanges" 2576 | @get external document: t => TextDocument.t = "document" 2577 | @get external reason: t => option = "reason" 2578 | } 2579 | 2580 | // https://code.visualstudio.com/api/references/vscode-api#WorkspaceFoldersChangeEvent 2581 | module WorkspaceFoldersChangeEvent = { 2582 | type t 2583 | // properties 2584 | @get external added: t => array = "added" 2585 | @get external removed: t => array = "removed" 2586 | } 2587 | 2588 | // https://code.visualstudio.com/api/references/vscode-api#FileCreateEvent 2589 | module FileCreateEvent = { 2590 | type t 2591 | // properties 2592 | @get external files: t => array = "files" 2593 | } 2594 | 2595 | // https://code.visualstudio.com/api/references/vscode-api#FileChangeType 2596 | // 1.101 2597 | module FileChangeType = { 2598 | type t = 2599 | | @as(1) Changed 2600 | | @as(2) Created 2601 | | @as(3) Deleted 2602 | } 2603 | 2604 | // https://code.visualstudio.com/api/references/vscode-api#FileChangeEvent 2605 | // 1.101 2606 | module FileChangeEvent = { 2607 | type t 2608 | // properties 2609 | @get external type_: t => FileChangeType.t = "type" 2610 | @get external uri: t => Uri.t = "uri" 2611 | } 2612 | 2613 | // https://code.visualstudio.com/api/references/vscode-api#WorkspaceEditEntryMetadata; 2614 | module WorkspaceEditEntryMetadata = { 2615 | type t 2616 | // properties 2617 | @get external description: t => option = "description" 2618 | // TODO: [@bs.get] external iconPath: t => ??? = "iconPath"; 2619 | @get external label: t => string = "label" 2620 | @get external needsConfirmation: t => bool = "needsConfirmation" 2621 | } 2622 | 2623 | // https://code.visualstudio.com/api/references/vscode-api#TextEdit 2624 | // 1.101 2625 | module TextEdit = { 2626 | type t 2627 | 2628 | // static methods 2629 | @module("vscode") @scope("TextEdit") 2630 | external delete: Range.t => t = "delete" 2631 | @module("vscode") @scope("TextEdit") 2632 | external insert: (Position.t, string) => t = "insert" 2633 | @module("vscode") @scope("TextEdit") 2634 | external replace: (Range.t, string) => t = "replace" 2635 | @module("vscode") @scope("TextEdit") 2636 | external setEndOfLine: EndOfLine.t => t = "setEndOfLine" 2637 | 2638 | // constructors 2639 | @module("vscode") @new 2640 | external make: (Range.t, string) => t = "TextEdit" 2641 | 2642 | // properties 2643 | @get external newEol: t => option = "newEol" 2644 | @get external newText: t => string = "newText" 2645 | @get external range: t => Range.t = "range" 2646 | } 2647 | 2648 | // https://code.visualstudio.com/api/references/vscode-api#WorkspaceEdit 2649 | module WorkspaceEdit = { 2650 | type t 2651 | // NOTE: this is missing in the API 2652 | // constructors 2653 | @module("vscode") @new external make: unit => t = "WorkspaceEdit" 2654 | 2655 | // properties 2656 | @get external size: t => int = "size" 2657 | // methods 2658 | @send 2659 | external createFile: ( 2660 | t, 2661 | Uri.t, 2662 | option<{"ignoreIfExists": bool, "overwrite": bool}>, 2663 | option, 2664 | unit, 2665 | ) => unit = "createFile" 2666 | @send 2667 | external delete: (t, Uri.t, Range.t, option) => unit = "delete" 2668 | @send 2669 | external deleteFile: ( 2670 | t, 2671 | Uri.t, 2672 | Range.t, 2673 | option<{"ignoreIfNotExists": bool, "recursive": bool}>, 2674 | option, 2675 | ) => unit = "deleteFile" 2676 | @send external entries_raw: t => array<'shit> = "entries" 2677 | let entries = (self: t): array<(Uri.t, array)> => 2678 | entries_raw(self)->Array.map(shit => { 2679 | let toUri = %raw("function (shit) { return shit[0] }") 2680 | let toTextEdits = %raw("function (shit) { return shit[1] }") 2681 | (toUri(shit), toTextEdits(shit)) 2682 | }) 2683 | @send external get: (t, Uri.t) => array = "get" 2684 | @send external has: (t, Uri.t) => bool = "has" 2685 | @send 2686 | external insert: (t, Uri.t, Position.t, string, option) => unit = 2687 | "insert" 2688 | @send 2689 | external renameFile: ( 2690 | t, 2691 | Uri.t, 2692 | Uri.t, 2693 | option<{"ignoreIfExists": bool, "overwrite": bool}>, 2694 | option, 2695 | ) => unit = "renameFile" 2696 | @send 2697 | external replace: (t, Uri.t, Range.t, string, option) => unit = 2698 | "replace" 2699 | @send external set: (t, Uri.t, array) => unit = "set" 2700 | } 2701 | 2702 | // https://code.visualstudio.com/api/references/vscode-api#RenameProvider 2703 | // 1.101 2704 | module RenameProvider = { 2705 | type t 2706 | type prepareRenameResult = 2707 | | @unboxed Range(Range.t) 2708 | | @unboxed PlaceholderAndRange({placeholder: string, range: Range.t}) 2709 | 2710 | // methods 2711 | @send 2712 | external prepareRename: ( 2713 | t, 2714 | TextDocument.t, 2715 | Position.t, 2716 | CancellationToken.t, 2717 | ) => ProviderResult.t = "prepareRename" 2718 | 2719 | @send 2720 | external provideRenameEdits: ( 2721 | t, 2722 | TextDocument.t, 2723 | Position.t, 2724 | string, 2725 | CancellationToken.t, 2726 | ) => ProviderResult.t = "provideRenameEdits" 2727 | } 2728 | 2729 | // https://code.visualstudio.com/api/references/vscode-api#FileWillCreateEvent 2730 | // 1.101 2731 | module FileWillCreateEvent = { 2732 | type t 2733 | 2734 | // properties 2735 | @get external files: t => array = "files" 2736 | @get external token: t => CancellationToken.t = "token" 2737 | 2738 | // methods 2739 | @send 2740 | external waitUntilWithWorkspaceEdit: (t, promise) => unit = "waitUntil" 2741 | @send external waitUntil: (t, promise<'a>) => unit = "waitUntil" 2742 | } 2743 | // https://code.visualstudio.com/api/references/vscode-api#FileWillDeleteEvent 2744 | // 1.101 2745 | module FileWillDeleteEvent = { 2746 | type t 2747 | 2748 | // properties 2749 | @get external files: t => array = "files" 2750 | @get external token: t => CancellationToken.t = "token" 2751 | 2752 | // methods 2753 | @send 2754 | external waitUntilWithWorkspaceEdit: (t, promise) => unit = "waitUntil" 2755 | @send external waitUntil: (t, promise<'a>) => unit = "waitUntil" 2756 | } 2757 | // https://code.visualstudio.com/api/references/vscode-api#FileWillRenameEvent 2758 | // 1.101 2759 | module FileWillRenameEvent = { 2760 | type t 2761 | 2762 | // properties 2763 | @get 2764 | external files: t => array<{"newUri": Uri.t, "oldUri": Uri.t}> = "files" 2765 | @get external token: t => CancellationToken.t = "token" 2766 | 2767 | // methods 2768 | @send 2769 | external waitUntilWithWorkspaceEdit: (t, promise) => unit = "waitUntil" 2770 | @send external waitUntil: (t, promise<'a>) => unit = "waitUntil" 2771 | } 2772 | 2773 | // https://code.visualstudio.com/api/references/vscode-api#TextDocumentSaveReason 2774 | // 1.95 2775 | module TextDocumentSaveReason = { 2776 | type t = 2777 | | @as(1) Manual 2778 | | @as(2) AfterDelay 2779 | | @as(3) FocusOut 2780 | } 2781 | 2782 | // https://code.visualstudio.com/api/references/vscode-api#TextDocumentWillSaveEvent 2783 | // 1.95 2784 | module TextDocumentWillSaveEvent = { 2785 | type t 2786 | // properties 2787 | @get external document: t => TextDocument.t = "document" 2788 | @get external reason: t => TextDocumentSaveReason.t = "reason" 2789 | // methods 2790 | @send 2791 | external waitUntilWithTextEdit: (t, promise>) => unit = "waitUntil" 2792 | @send external waitUntil: (t, promise<'a>) => unit = "waitUntil" 2793 | } 2794 | 2795 | // https://code.visualstudio.com/api/references/vscode-api#RelativePattern 2796 | // 1.101 2797 | module RelativePattern = { 2798 | type t 2799 | 2800 | // constructors 2801 | @module("vscode") @new 2802 | external make: (string, string) => t = "RelativePattern" 2803 | @module("vscode") @new 2804 | external makeWithUri: (Uri.t, string) => t = "RelativePattern" 2805 | @module("vscode") @new 2806 | external makeWithWorkspaceFolder: (WorkspaceFolder.t, string) => t = "RelativePattern" 2807 | 2808 | // properties 2809 | @get external base: t => string = "base" 2810 | @get external baseUri: t => Uri.t = "baseUri" 2811 | @get external pattern: t => string = "pattern" 2812 | } 2813 | 2814 | // https://code.visualstudio.com/api/references/vscode-api#GlobPattern 2815 | // 1.101 2816 | module GlobPattern = { 2817 | type t = StringOr.t 2818 | } 2819 | 2820 | // https://code.visualstudio.com/api/references/vscode-api#FileSystemWatcher 2821 | // 1.101 2822 | module FileSystemWatcher = { 2823 | type t 2824 | 2825 | // events 2826 | @send 2827 | external onDidChange: (t, Uri.t => unit) => Disposable.t = "onDidChange" 2828 | @send 2829 | external onDidCreate: (t, Uri.t => unit) => Disposable.t = "onDidCreate" 2830 | @send 2831 | external onDidDelete: (t, Uri.t => unit) => Disposable.t = "onDidDelete" 2832 | 2833 | // properties 2834 | @get external ignoreChangeEvents: t => bool = "ignoreChangeEvents" 2835 | @get external ignoreCreateEvents: t => bool = "ignoreCreateEvents" 2836 | @get external ignoreDeleteEvents: t => bool = "ignoreDeleteEvents" 2837 | 2838 | // methods 2839 | @send external dispose: t => 'a = "dispose" 2840 | } 2841 | 2842 | // https://code.visualstudio.com/api/references/vscode-api#WorkspaceConfiguration 2843 | module WorkspaceConfiguration = { 2844 | type t 2845 | // methods 2846 | @send external get: (t, string) => option<'a> = "get" 2847 | @send external getWithDefault: (t, string, 'a) => 'a = "get" 2848 | @send external has: (t, string) => bool = "has" 2849 | @send 2850 | external inspect: ( 2851 | t, 2852 | string, 2853 | ) => option<{ 2854 | "defaultLanguageValue": 'a, 2855 | "defaultValue": 'a, 2856 | "globalLanguageValue": 'a, 2857 | "globalValue": 'a, 2858 | "key": string, 2859 | "languageIds": array, 2860 | "workspaceFolderLanguageValue": 'a, 2861 | "workspaceFolderValue": 'a, 2862 | "workspaceLanguageValue": 'a, 2863 | "workspaceValue": 'a, 2864 | }> = "inspect" 2865 | @send 2866 | external updateGlobalSettings: (t, string, 'a, @as(1) _, option) => promise = "update" 2867 | @send 2868 | external updateWorkspaceSettings: (t, string, 'a, @as(2) _, option) => promise = 2869 | "update" 2870 | @send 2871 | external updateWorkspaceFolderSettings: (t, string, 'a, @as(3) _, option) => promise = 2872 | "update" 2873 | } 2874 | 2875 | // https://code.visualstudio.com/api/references/vscode-api#TextDocumentContentProvider 2876 | // 1.59.0 2877 | module TextDocumentContentProvider = { 2878 | type t 2879 | // events 2880 | @module("vscode") @scope("workspace") 2881 | external onDidChange: option<(Uri.t => unit) => Disposable.t> = "onDidChange" 2882 | // methods 2883 | @send 2884 | external provideTextDocumentContent: (t, Uri.t, CancellationToken.t) => ProviderResult.t = 2885 | "provideTextDocumentContent" 2886 | } 2887 | 2888 | // https://code.visualstudio.com/api/references/vscode-api#TaskProvider 2889 | // 1.101 2890 | module TaskProvider = { 2891 | type t<'a> 2892 | 2893 | // methods 2894 | @send 2895 | external provideTasks: (t<'a>, CancellationToken.t) => ProviderResult.t> = 2896 | "provideTasks" 2897 | @send 2898 | external resolveTask: (t<'a>, 'a, CancellationToken.t) => ProviderResult.t<'a> = "resolveTask" 2899 | } 2900 | 2901 | // https://code.visualstudio.com/api/references/vscode-api#FileSystemProvider 2902 | // 1.101 2903 | module FileSystemProvider = { 2904 | type t 2905 | 2906 | // events 2907 | @send 2908 | external onDidChangeFile: (t, array => unit) => Disposable.t = 2909 | "onDidChangeFile" 2910 | 2911 | // methods 2912 | @send 2913 | external copy: (t, Uri.t, Uri.t, {"overwrite": bool}) => option> = "copy" 2914 | @send 2915 | external createDirectory: (t, Uri.t) => option> = "createDirectory" 2916 | @send 2917 | external delete: (t, Uri.t, {"recursive": bool}) => option> = "delete" 2918 | @send 2919 | external readDirectory: (t, Uri.t) => option>> = 2920 | "readDirectory" 2921 | @send 2922 | external readFile: (t, Uri.t) => option> = "readFile" 2923 | @send 2924 | external rename: (t, Uri.t, Uri.t, {"overwrite": bool}) => option> = "rename" 2925 | @send 2926 | external stat: (t, Uri.t) => option> = "stat" 2927 | @send 2928 | external watch: (t, Uri.t, {"excludes": array, "recursive": bool}) => Disposable.t = 2929 | "watch" 2930 | @send 2931 | external writeFile: ( 2932 | t, 2933 | Uri.t, 2934 | Uint8Array.t, 2935 | {"create": bool, "overwrite": bool}, 2936 | ) => option> = "writeFile" 2937 | } 2938 | 2939 | // https://code.visualstudio.com/api/references/vscode-api#workspace 2940 | // 1.85.1 WIP 2941 | module Workspace = { 2942 | // variables 2943 | @module("vscode") @scope("workspace") 2944 | external fs: FileSystem.t = "fs" 2945 | @module("vscode") @scope("workspace") 2946 | external isTrusted: bool = "isTrusted" 2947 | @module("vscode") @scope("workspace") 2948 | external name: option = "name" 2949 | @module("vscode") @scope("workspace") 2950 | external rootPath: option = "rootPath" 2951 | @module("vscode") @scope("workspace") 2952 | external textDocuments: array = "textDocuments" 2953 | @module("vscode") @scope("workspace") 2954 | external workspaceFile: option = "workspaceFile" 2955 | @module("vscode") @scope("workspace") 2956 | external workspaceFolders: option> = "workspaceFolders" 2957 | 2958 | // events 2959 | @module("vscode") @scope("workspace") 2960 | external onDidChangeConfiguration: (ConfigurationChangeEvent.t => unit) => Disposable.t = 2961 | "onDidChangeConfiguration" 2962 | @module("vscode") @scope("workspace") 2963 | external onDidChangeTextDocument: (TextDocumentChangeEvent.t => unit) => Disposable.t = 2964 | "onDidChangeTextDocument" 2965 | 2966 | @module("vscode") @scope("workspace") 2967 | external onDidChangeWorkspaceFolders: (WorkspaceFoldersChangeEvent.t => unit) => Disposable.t = 2968 | "onDidChangeWorkspaceFolders" 2969 | @module("vscode") @scope("workspace") 2970 | external onDidCloseTextDocument: (TextDocument.t => unit) => Disposable.t = 2971 | "onDidCloseTextDocument" 2972 | @module("vscode") @scope("workspace") 2973 | external onDidCreateFiles: (FileCreateEvent.t => unit) => Disposable.t = "onDidCreateFiles" 2974 | @module("vscode") @scope("workspace") 2975 | external onDidDeleteFiles: (FileDeleteEvent.t => unit) => Disposable.t = "onDidDeleteFiles" 2976 | @module("vscode") @scope("workspace") 2977 | external onDidOpenTextDocument: (TextDocument.t => unit) => Disposable.t = "onDidOpenTextDocument" 2978 | @module("vscode") @scope("workspace") 2979 | external onDidRenameFiles: (FileRenameEvent.t => unit) => Disposable.t = "onDidRenameFiles" 2980 | @module("vscode") @scope("workspace") 2981 | external onDidSaveTextDocument: (TextDocument.t => unit) => Disposable.t = "onDidSaveTextDocument" 2982 | @module("vscode") @scope("workspace") 2983 | external onWillCreateFiles: (FileWillCreateEvent.t => unit) => Disposable.t = "onWillCreateFiles" 2984 | @module("vscode") @scope("workspace") 2985 | external onWillDeleteFiles: (FileWillDeleteEvent.t => unit) => Disposable.t = "onWillDeleteFiles" 2986 | @module("vscode") @scope("workspace") 2987 | external onWillRenameFiles: (FileWillRenameEvent.t => unit) => Disposable.t = "onWillRenameFiles" 2988 | @module("vscode") @scope("workspace") 2989 | external onWillSaveTextDocument: (TextDocumentWillSaveEvent.t => unit) => Disposable.t = 2990 | "onWillSaveTextDocument" 2991 | // functions 2992 | @module("vscode") @scope("workspace") 2993 | external applyEdit: WorkspaceEdit.t => promise = "applyEdit" 2994 | @module("vscode") @scope("workspace") 2995 | external asRelativePath: (string, option) => string = "asRelativePath" 2996 | @module("vscode") @scope("workspace") 2997 | external asRelativePathWithUri: (Uri.t, option) => string = "asRelativePath" 2998 | @module("vscode") @scope("workspace") 2999 | external createFileSystemWatcher: ( 3000 | GlobPattern.t, 3001 | ~ignoreCreateEvents: bool=?, 3002 | ~ignoreChangeEvents: bool=?, 3003 | ~ignoreDeleteEvents: bool=?, 3004 | ) => FileSystemWatcher.t = "createFileSystemWatcher" 3005 | @module("vscode") @scope("workspace") 3006 | external findFiles: ( 3007 | GlobPattern.t, 3008 | ~exclude: Js.nullable=?, 3009 | ~token: CancellationToken.t=?, 3010 | ) => promise> = "findFiles" 3011 | @module("vscode") @scope("workspace") 3012 | external getConfiguration: (option, option) => WorkspaceConfiguration.t = 3013 | "getConfiguration" 3014 | external getConfigurationOfTextDocument: ( 3015 | option, 3016 | option, 3017 | ) => WorkspaceConfiguration.t = "getConfiguration" 3018 | external getConfigurationOfWorkspaceFolder: ( 3019 | option, 3020 | option, 3021 | ) => WorkspaceConfiguration.t = "getConfiguration" 3022 | external getConfigurationOfLanguage: ( 3023 | option, 3024 | option<{"languageId": string, "uri": Uri.t}>, 3025 | ) => WorkspaceConfiguration.t = "getConfiguration" 3026 | @module("vscode") @scope("workspace") 3027 | external getWorkspaceFolder: Uri.t => option = "getWorkspaceFolder" 3028 | @module("vscode") @scope("workspace") 3029 | external openTextDocument: Uri.t => promise = "openTextDocument" 3030 | @module("vscode") @scope("workspace") 3031 | external openTextDocumentWithFileName: string => promise = "openTextDocument" 3032 | @module("vscode") @scope("workspace") 3033 | external openTextDocumentWithOptions: option<{ 3034 | "content": string, 3035 | "language": string, 3036 | }> => promise = "openTextDocument" 3037 | @module("vscode") @scope("workspace") 3038 | external registerFileSystemProvider: ( 3039 | string, 3040 | FileSystemProvider.t, 3041 | option<{"isCaseSensitive": bool, "isReadonly": bool}>, 3042 | ) => Disposable.t = "registerFileSystemProvider" 3043 | @module("vscode") @scope("workspace") 3044 | external registerTaskProvider: (string, TaskProvider.t<'a>) => Disposable.t = 3045 | "registerTaskProvider" 3046 | @module("vscode") @scope("workspace") 3047 | external registerTextDocumentContentProvider: ( 3048 | string, 3049 | TextDocumentContentProvider.t, 3050 | ) => Disposable.t = "registerTextDocumentContentProvider" 3051 | @module("vscode") @scope("workspace") 3052 | external saveAll: option => promise = "saveAll" 3053 | @module("vscode") @scope("workspace") @variadic 3054 | external updateWorkspaceFolders: ( 3055 | int, 3056 | option, 3057 | array<{"name": string, "uri": Uri.t}>, 3058 | ) => promise = "updateWorkspaceFolders" 3059 | } 3060 | 3061 | // https://code.visualstudio.com/api/references/vscode-api#extensions 3062 | // 1.52.0 3063 | module Extensions = { 3064 | // variables 3065 | @module("vscode") @scope("extensions") 3066 | external all: array> = "all" 3067 | // events 3068 | @module("vscode") @scope("extensions") 3069 | external onDidChange: (unit => unit) => Disposable.t = "onDidChange" 3070 | // functions 3071 | @module("vscode") @scope("extensions") 3072 | external getExtension: string => option> = "getExtension" 3073 | } 3074 | 3075 | // https://code.visualstudio.com/api/references/vscode-api#DiagnosticChangeEvent 3076 | module DiagnosticChangeEvent = { 3077 | type t 3078 | // properties 3079 | @get external uris: t => array = "uris" 3080 | } 3081 | 3082 | // https://code.visualstudio.com/api/references/vscode-api#Location 3083 | module Location = { 3084 | type t 3085 | // constructors 3086 | @module("vscode") @new 3087 | external makeWithRange: (Uri.t, Range.t) => t = "Location" 3088 | @module("vscode") @new 3089 | external makeWithPosition: (Uri.t, Position.t) => t = "Location" 3090 | 3091 | // properties 3092 | @get external range: t => Range.t = "range" 3093 | @get external uri: t => Uri.t = "uri" 3094 | } 3095 | 3096 | // https://code.visualstudio.com/api/references/vscode-api#SourceBreakpoint 3097 | // 1.101 3098 | module SourceBreakpoint = { 3099 | type t 3100 | 3101 | // constructors 3102 | @module("vscode") @new 3103 | external make: ( 3104 | Location.t, 3105 | ~enabled: bool=?, 3106 | ~condition: string=?, 3107 | ~hitCondition: string=?, 3108 | ~logMessage: string=?, 3109 | ) => t = "SourceBreakpoint" 3110 | 3111 | // properties 3112 | @get external condition: t => option = "condition" 3113 | @get external enabled: t => bool = "enabled" 3114 | @get external hitCondition: t => option = "hitCondition" 3115 | @get external id: t => string = "id" 3116 | @get external location: t => Location.t = "location" 3117 | @get external logMessage: t => option = "logMessage" 3118 | } 3119 | 3120 | // https://code.visualstudio.com/api/references/vscode-api#ReferenceProvider 3121 | // 1.101 3122 | module ReferenceProvider = { 3123 | type t 3124 | 3125 | // methods 3126 | @send 3127 | external provideReferences: ( 3128 | t, 3129 | TextDocument.t, 3130 | Position.t, 3131 | ReferenceContext.t, 3132 | CancellationToken.t, 3133 | ) => ProviderResult.t> = "provideReferences" 3134 | } 3135 | 3136 | // https://code.visualstudio.com/api/references/vscode-api#RunOptions 3137 | // 1.101 3138 | module RunOptions = { 3139 | type t = {reevaluateOnRerun?: bool} 3140 | } 3141 | 3142 | // https://code.visualstudio.com/api/references/vscode-api#TaskDefinition 3143 | // 1.101 3144 | module TaskDefinition = { 3145 | type t = {\"type": string} 3146 | } 3147 | 3148 | // https://code.visualstudio.com/api/references/vscode-api#TaskFilter 3149 | // 1.101 3150 | module TaskFilter = { 3151 | type t = { 3152 | \"type"?: string, 3153 | version?: string, 3154 | } 3155 | } 3156 | 3157 | // https://code.visualstudio.com/api/references/vscode-api#TaskGroup 3158 | // 1.101 3159 | module TaskGroup = { 3160 | type t 3161 | 3162 | // static properties 3163 | @module("vscode") @scope("TaskGroup") 3164 | external build: t = "Build" 3165 | @module("vscode") @scope("TaskGroup") 3166 | external clean: t = "Clean" 3167 | @module("vscode") @scope("TaskGroup") 3168 | external rebuild: t = "Rebuild" 3169 | @module("vscode") @scope("TaskGroup") 3170 | external test: t = "Test" 3171 | 3172 | // constructors 3173 | @module("vscode") @new 3174 | external make: (string, string) => t = "TaskGroup" 3175 | 3176 | // properties 3177 | @get external id: t => string = "id" 3178 | @get external isDefault: t => bool = "isDefault" 3179 | } 3180 | 3181 | // https://code.visualstudio.com/api/references/vscode-api#TaskPanelKind 3182 | // 1.101 3183 | module TaskPanelKind = { 3184 | type t = 3185 | | @as(1) Shared 3186 | | @as(2) Dedicated 3187 | | @as(3) New 3188 | } 3189 | 3190 | // https://code.visualstudio.com/api/references/vscode-api#TaskRevealKind 3191 | // 1.101 3192 | module TaskRevealKind = { 3193 | type t = 3194 | | @as(0) Always 3195 | | @as(1) Silent 3196 | | @as(2) Never 3197 | } 3198 | 3199 | // https://code.visualstudio.com/api/references/vscode-api#TaskPresentationOptions 3200 | // 1.101 3201 | module TaskPresentationOptions = { 3202 | type t = { 3203 | clear?: bool, 3204 | close?: bool, 3205 | echo?: bool, 3206 | focus?: bool, 3207 | panel?: TaskPanelKind.t, 3208 | reveal?: TaskRevealKind.t, 3209 | showReuseMessage?: bool, 3210 | } 3211 | } 3212 | 3213 | // https://code.visualstudio.com/api/references/vscode-api#TaskScope 3214 | // 1.101 3215 | module TaskScope = { 3216 | type t = 3217 | | @as(1) Global 3218 | | @as(2) Workspace 3219 | } 3220 | 3221 | // https://code.visualstudio.com/api/references/vscode-api#TaskExecution 3222 | // 1.101 3223 | module TaskExecution = { 3224 | type t 3225 | 3226 | // properties 3227 | @get external task: t => 'task = "task" 3228 | @get external terminateRequested: t => bool = "terminateRequested" 3229 | 3230 | // methods 3231 | @send external terminate: t => unit = "terminate" 3232 | } 3233 | 3234 | // https://code.visualstudio.com/api/references/vscode-api#TaskStartEvent 3235 | // 1.101 3236 | module TaskStartEvent = { 3237 | type t = {execution: TaskExecution.t} 3238 | } 3239 | 3240 | // https://code.visualstudio.com/api/references/vscode-api#TaskProcessEndEvent 3241 | // 1.101 3242 | module TaskProcessEndEvent = { 3243 | type t = { 3244 | execution: TaskExecution.t, 3245 | exitCode: int, 3246 | } 3247 | } 3248 | 3249 | // https://code.visualstudio.com/api/references/vscode-api#TaskProcessStartEvent 3250 | // 1.101 3251 | module TaskProcessStartEvent = { 3252 | type t = { 3253 | execution: TaskExecution.t, 3254 | processId: int, 3255 | } 3256 | } 3257 | 3258 | // https://code.visualstudio.com/api/references/vscode-api#ProcessExecutionOptions 3259 | // 1.101 3260 | module ProcessExecutionOptions = { 3261 | type t = { 3262 | cwd?: string, 3263 | env?: Js.Dict.t, 3264 | } 3265 | } 3266 | 3267 | // https://code.visualstudio.com/api/references/vscode-api#ProcessExecution 3268 | // 1.101 3269 | module ProcessExecution = { 3270 | type t 3271 | 3272 | // constructors 3273 | @module("vscode") @new 3274 | external make: (string, ~options: ProcessExecutionOptions.t=?) => t = "ProcessExecution" 3275 | @module("vscode") @new 3276 | external makeWithArgs: (string, array, ~options: ProcessExecutionOptions.t=?) => t = 3277 | "ProcessExecution" 3278 | 3279 | // properties 3280 | @get external args: t => array = "args" 3281 | @get external options: t => option = "options" 3282 | @get external process: t => string = "process" 3283 | } 3284 | 3285 | // https://code.visualstudio.com/api/references/vscode-api#LocationLink 3286 | module LocationLink = { 3287 | type t = { 3288 | originSelectionRange: option, 3289 | targetRange: Range.t, 3290 | targetSelectionRange: option, 3291 | targetUri: Uri.t, 3292 | } 3293 | } 3294 | 3295 | // https://code.visualstudio.com/api/references/vscode-api#DiagnosticRelatedInformation 3296 | module DiagnosticRelatedInformation = { 3297 | type t 3298 | 3299 | // constructors 3300 | @module("vscode") @new 3301 | external make: (Location.t, string) => t = "DiagnosticRelatedInformation" 3302 | 3303 | // properties 3304 | @get external location: t => Location.t = "location" 3305 | @get external message: t => string = "message" 3306 | } 3307 | 3308 | // https://code.visualstudio.com/api/references/vscode-api#DiagnosticSeverity 3309 | // 1.95 3310 | module DiagnosticSeverity = { 3311 | type t = 3312 | | @as(0) Error 3313 | | @as(1) Warning 3314 | | @as(2) Information 3315 | | @as(3) Hint 3316 | } 3317 | 3318 | // https://code.visualstudio.com/api/references/vscode-api#DiagnosticTag 3319 | // 1.95 3320 | module DiagnosticTag = { 3321 | type t = 3322 | | @as(1) Unnecessary 3323 | | @as(2) Deprecated 3324 | } 3325 | 3326 | // https://code.visualstudio.com/api/references/vscode-api#Diagnostic 3327 | module Diagnostic = { 3328 | type t 3329 | 3330 | // constructors 3331 | @module("vscode") @new 3332 | external make: (Range.t, string, option) => t = "Diagnostic" 3333 | 3334 | // properties 3335 | @get external code: t => option = "code" // FIX THIS 3336 | @get external message: t => string = "message" 3337 | @get external range: t => Range.t = "range" 3338 | @get 3339 | external relatedInformation: t => option> = 3340 | "relatedInformation" 3341 | @get external severity: t => DiagnosticSeverity.t = "severity" 3342 | @get external source: t => option = "source" 3343 | @get external tags: t => option> = "tags" 3344 | } 3345 | 3346 | // https://code.visualstudio.com/api/references/vscode-api#DocumentFilter 3347 | module DocumentFilter = { 3348 | type t = { 3349 | language: option, 3350 | pattern: option, 3351 | scheme: option, 3352 | } 3353 | } 3354 | 3355 | // https://code.visualstudio.com/api/references/vscode-api#DocumentSelector 3356 | module DocumentSelector = { 3357 | type t = array> 3358 | } 3359 | 3360 | // https://code.visualstudio.com/api/references/vscode-api#DiagnosticCollection 3361 | module DiagnosticCollection = { 3362 | type t 3363 | // properties 3364 | @get external name: t => string = "name" 3365 | // methods 3366 | @send external clear: t => unit = "clear" 3367 | @send external delete: (t, Uri.t) => unit = "delete" 3368 | @send external dispose: t => unit = "dispose" 3369 | @send 3370 | external forEach: (t, (Uri.t, array, t) => 'a) => unit = "forEach" 3371 | @send external get: (t, Uri.t) => option> = "get" 3372 | @send external has: (t, Uri.t) => bool = "has" 3373 | @send external set: (t, Uri.t) => unit = "set" 3374 | @send 3375 | external setDiagnostics: (t, Uri.t, array) => unit = "set" 3376 | @send 3377 | external setDiagnosticEntries: (t, array<(Uri.t, option>)>) => unit = "set" 3378 | } 3379 | 3380 | // https://code.visualstudio.com/api/references/vscode-api#CallHierarchyItem 3381 | module CallHierarchyItem = { 3382 | type t 3383 | } 3384 | 3385 | // https://code.visualstudio.com/api/references/vscode-api#CallHierarchyOutgoingCall 3386 | module CallHierarchyOutgoingCall = { 3387 | type t 3388 | } 3389 | 3390 | // https://code.visualstudio.com/api/references/vscode-api#CallHierarchyIncomingCall 3391 | module CallHierarchyIncomingCall = { 3392 | type t 3393 | } 3394 | 3395 | // https://code.visualstudio.com/api/references/vscode-api#CallHierarchyProvider 3396 | module CallHierarchyProvider = { 3397 | type t 3398 | // methods 3399 | @send 3400 | external prepareCallHierarchy: ( 3401 | t, 3402 | TextDocument.t, 3403 | Position.t, 3404 | CancellationToken.t, 3405 | ) => ProviderResult.t> = "prepareCallHierarchy" 3406 | @send 3407 | external provideCallHierarchyIncomingCalls: ( 3408 | t, 3409 | CallHierarchyItem.t, 3410 | CancellationToken.t, 3411 | ) => ProviderResult.t> = "provideCallHierarchyIncomingCalls" 3412 | @send 3413 | external provideCallHierarchyOutgoingCalls: ( 3414 | t, 3415 | CallHierarchyItem.t, 3416 | CancellationToken.t, 3417 | ) => ProviderResult.t> = "provideCallHierarchyOutgoingCalls" 3418 | } 3419 | 3420 | // https://code.visualstudio.com/api/references/vscode-api#CodeActionProvider 3421 | module CodeActionProvider = { 3422 | type t 3423 | } 3424 | 3425 | // https://code.visualstudio.com/api/references/vscode-api#CodeActionProviderMetadata 3426 | module CodeActionProviderMetadata = { 3427 | type t 3428 | } 3429 | 3430 | // https://code.visualstudio.com/api/references/vscode-api#CodeLens 3431 | module CodeLens = { 3432 | type t 3433 | // constructors 3434 | @module("vscode") @new external make: Range.t => t = "CodeLens" 3435 | @module("vscode") @new 3436 | external makeWithCommand: (Range.t, Command.t) => t = "CodeLens" 3437 | // properties 3438 | @get external command: t => option = "command" 3439 | @get external isResolved: t => bool = "isResolved" 3440 | @get external range: t => Range.t = "range" 3441 | } 3442 | 3443 | // https://code.visualstudio.com/api/references/vscode-api#CodeLensProvider 3444 | module CodeLensProvider = { 3445 | type t<'a> = { 3446 | onDidChangeCodeLenses: option<(unit => unit) => Disposable.t>, 3447 | resolveCodeLens: ('a, CancellationToken.t) => ProviderResult.t<'a>, 3448 | provideCodeLenses: (TextDocument.t, CancellationToken.t) => ProviderResult.t>, 3449 | } 3450 | } 3451 | 3452 | // https://code.visualstudio.com/api/references/vscode-api#DocumentColorProvider 3453 | module DocumentColorProvider = { 3454 | type t 3455 | } 3456 | 3457 | // https://code.visualstudio.com/api/references/vscode-api#CompletionItemProvider 3458 | module CompletionItemProvider = { 3459 | type t 3460 | } 3461 | 3462 | // https://code.visualstudio.com/api/references/vscode-api#DeclarationProvider 3463 | module DeclarationProvider = { 3464 | type t 3465 | } 3466 | 3467 | // MarkedString is deprecated in favor of MarkdownString 3468 | 3469 | // https://code.visualstudio.com/api/references/vscode-api#Hover 3470 | module Hover = { 3471 | type t 3472 | // constructors 3473 | @module("vscode") @new 3474 | external make: array => t = "Hover" 3475 | @module("vscode") @new 3476 | external makeWithRange: (array, Range.t) => t = "Hover" 3477 | // properties 3478 | @get external contents: t => array = "contents" 3479 | @get external range: t => option = "range" 3480 | } 3481 | 3482 | // https://code.visualstudio.com/api/references/vscode-api#HoverProvider 3483 | module HoverProvider = { 3484 | type t = { 3485 | provideHover: (TextDocument.t, Position.t, CancellationToken.t) => ProviderResult.t, 3486 | } 3487 | } 3488 | 3489 | module LocationLinkOrLocation: { 3490 | type t 3491 | type case = 3492 | | Location(array) 3493 | | LocationLink(array) 3494 | let locations: array => t 3495 | let locationLinks: array => t 3496 | let classify: t => case 3497 | } = { 3498 | @unboxed 3499 | type rec t = Any('a): t 3500 | type case = 3501 | | Location(array) 3502 | | LocationLink(array) 3503 | let locations = (v: array) => Any(v) 3504 | let locationLinks = (v: array) => Any(v) 3505 | let classify = (Any(v): t): case => 3506 | if %raw(`function (a) { return a.targetRange === undefined}`)(v) { 3507 | Location((Obj.magic(v): array)) 3508 | } else { 3509 | LocationLink((Obj.magic(v): array)) 3510 | } 3511 | } 3512 | 3513 | // https://code.visualstudio.com/api/references/vscode-api#DefinitionProvider 3514 | module DefinitionProvider = { 3515 | type t = { 3516 | provideDefinition: ( 3517 | TextDocument.t, 3518 | Position.t, 3519 | CancellationToken.t, 3520 | ) => ProviderResult.t, 3521 | } 3522 | } 3523 | 3524 | // https://code.visualstudio.com/api/references/vscode-api#SemanticsTokens 3525 | module SemanticsTokens = { 3526 | type t 3527 | // constructors 3528 | @module("vscode") @new 3529 | external make: array => t = "SemanticsTokens" 3530 | @module("vscode") @new 3531 | external makeWithResultId: (array, string) => t = "SemanticsTokens" 3532 | // properties 3533 | @get external data: t => array = "data" 3534 | @get external resultId: t => option = "resultId" 3535 | } 3536 | 3537 | // https://code.visualstudio.com/api/references/vscode-api#SemanticTokensLegend 3538 | module SemanticTokensLegend = { 3539 | type t 3540 | // constructors 3541 | @module("vscode") @new 3542 | external make: array => t = "SemanticTokensLegend" 3543 | @module("vscode") @new 3544 | external makeWithTokenModifiers: (array, array) => t = "SemanticTokensLegend" 3545 | // properties 3546 | @get external tokenModifiers: t => array = "tokenModifiers" 3547 | @get external tokenTypes: t => array = "tokenTypes" 3548 | } 3549 | 3550 | // https://code.visualstudio.com/api/references/vscode-api#SemanticTokensBuilder 3551 | module SemanticTokensBuilder = { 3552 | type t 3553 | // constructors 3554 | @module("vscode") @new 3555 | external make: unit => t = "SemanticTokensBuilder" 3556 | @module("vscode") @new 3557 | external makeWithLegend: SemanticTokensLegend.t => t = "SemanticTokensBuilder" 3558 | // methods 3559 | @send external build: unit => SemanticsTokens.t = "build" 3560 | @send external buildWithResultId: string => SemanticsTokens.t = "build" 3561 | @send 3562 | external push: (int, int, int, int, option) => unit = "push" 3563 | @send 3564 | external pushLegend: (Range.t, string, option>) => unit = "push" 3565 | } 3566 | 3567 | // https://code.visualstudio.com/api/references/vscode-api#DocumentSemanticTokensProvider 3568 | module DocumentSemanticTokensProvider = { 3569 | // missing: onDidChangeSemanticTokens 3570 | // missing: provideDocumentSemanticTokensEdits 3571 | type t = { 3572 | provideDocumentSemanticTokens: ( 3573 | TextDocument.t, 3574 | CancellationToken.t, 3575 | ) => ProviderResult.t, 3576 | } 3577 | } 3578 | 3579 | // https://code.visualstudio.com/api/references/vscode-api#languages 3580 | module Languages = { 3581 | // events 3582 | @module("vscode") @scope("languages") 3583 | external onDidChangeDiagnostics: (DiagnosticChangeEvent.t => unit) => Disposable.t = 3584 | "onDidChangeDiagnostics" 3585 | 3586 | // functions 3587 | @module("vscode") @scope("languages") 3588 | external createDiagnosticCollection: option => DiagnosticCollection.t = 3589 | "createDiagnosticCollection" 3590 | @module("vscode") @scope("languages") 3591 | external getDiagnostics: Uri.t => array = "getDiagnostics" 3592 | @module("vscode") @scope("languages") 3593 | external getDiagnosticEntries: Uri.t => array<(Uri.t, array)> = "getDiagnostics" 3594 | @module("vscode") @scope("languages") 3595 | external getLanguages: unit => promise> = "getLanguages" 3596 | @module("vscode") @scope("languages") 3597 | external match_: (DocumentSelector.t, TextDocument.t) => int = "match" 3598 | @module("vscode") @scope("languages") 3599 | external registerCallHierarchyProvider: ( 3600 | DocumentSelector.t, 3601 | CallHierarchyProvider.t, 3602 | ) => Disposable.t = "registerCallHierarchyProvider" 3603 | @module("vscode") @scope("languages") 3604 | external registerCodeActionsProvider: ( 3605 | DocumentSelector.t, 3606 | CodeActionProvider.t, 3607 | option, 3608 | ) => Disposable.t = "registerCodeActionsProvider" 3609 | @module("vscode") @scope("languages") 3610 | external registerCodeLensProvider: (DocumentSelector.t, CodeLensProvider.t<'a>) => Disposable.t = 3611 | "registerCodeLensProvider" 3612 | @module("vscode") @scope("languages") 3613 | external registerColorProvider: (DocumentSelector.t, DocumentColorProvider.t) => Disposable.t = 3614 | "registerColorProvider" 3615 | @module("vscode") @scope("languages") 3616 | external registerCompletionItemProvider0: ( 3617 | DocumentSelector.t, 3618 | CompletionItemProvider.t, 3619 | ) => Disposable.t = "registerCompletionItemProvider" 3620 | @module("vscode") @scope("languages") 3621 | external registerCompletionItemProvider1: ( 3622 | DocumentSelector.t, 3623 | CompletionItemProvider.t, 3624 | string, 3625 | ) => Disposable.t = "registerCompletionItemProvider" 3626 | @module("vscode") @scope("languages") 3627 | external registerCompletionItemProvider2: ( 3628 | DocumentSelector.t, 3629 | CompletionItemProvider.t, 3630 | string, 3631 | string, 3632 | ) => Disposable.t = "registerCompletionItemProvider" 3633 | @module("vscode") @scope("languages") 3634 | external registerCompletionItemProvider3: ( 3635 | DocumentSelector.t, 3636 | CompletionItemProvider.t, 3637 | string, 3638 | string, 3639 | string, 3640 | ) => Disposable.t = "registerCompletionItemProvider" 3641 | @module("vscode") @scope("languages") 3642 | external registerDeclarationProvider: ( 3643 | DocumentSelector.t, 3644 | DeclarationProvider.t, 3645 | ) => Disposable.t = "registerDeclarationProvider" 3646 | @module("vscode") @scope("languages") 3647 | external registerDefinitionProvider: (DocumentSelector.t, DefinitionProvider.t) => Disposable.t = 3648 | "registerDefinitionProvider" 3649 | // registerDocumentFormattingEditProvider(selector: DocumentSelector, provider: DocumentFormattingEditProvider): Disposable 3650 | // registerDocumentHighlightProvider(selector: DocumentSelector, provider: DocumentHighlightProvider): Disposable 3651 | // registerDocumentLinkProvider(selector: DocumentSelector, provider: DocumentLinkProvider): Disposable 3652 | // registerDocumentRangeFormattingEditProvider(selector: DocumentSelector, provider: DocumentRangeFormattingEditProvider): Disposable 3653 | // registerDocumentRangeSemanticTokensProvider(selector: DocumentSelector, provider: DocumentRangeSemanticTokensProvider, legend: SemanticTokensLegend): Disposable 3654 | @module("vscode") @scope("languages") 3655 | external registerDocumentSemanticTokensProvider: ( 3656 | DocumentSelector.t, 3657 | DocumentSemanticTokensProvider.t, 3658 | SemanticTokensLegend.t, 3659 | ) => Disposable.t = "registerDocumentSemanticTokensProvider" 3660 | // registerDocumentSymbolProvider(selector: DocumentSelector, provider: DocumentSymbolProvider, metaData?: DocumentSymbolProviderMetadata): Disposable 3661 | // registerEvaluatableExpressionProvider(selector: DocumentSelector, provider: EvaluatableExpressionProvider): Disposable 3662 | // registerFoldingRangeProvider(selector: DocumentSelector, provider: FoldingRangeProvider): Disposable 3663 | 3664 | @module("vscode") @scope("languages") 3665 | external registerHoverProvider: (DocumentSelector.t, HoverProvider.t) => Disposable.t = 3666 | "registerHoverProvider" 3667 | // registerImplementationProvider(selector: DocumentSelector, provider: ImplementationProvider): Disposable 3668 | // registerOnTypeFormattingEditProvider(selector: DocumentSelector, provider: OnTypeFormattingEditProvider, firstTriggerCharacter: string, ...moreTriggerCharacter: string[]): Disposable 3669 | // registerReferenceProvider(selector: DocumentSelector, provider: ReferenceProvider): Disposable 3670 | // registerRenameProvider(selector: DocumentSelector, provider: RenameProvider): Disposable 3671 | // registerSelectionRangeProvider(selector: DocumentSelector, provider: SelectionRangeProvider): Disposable 3672 | // registerSignatureHelpProvider(selector: DocumentSelector, provider: SignatureHelpProvider, ...triggerCharacters: string[]): Disposable 3673 | // registerSignatureHelpProvider(selector: DocumentSelector, provider: SignatureHelpProvider, metadata: SignatureHelpProviderMetadata): Disposable 3674 | // registerTypeDefinitionProvider(selector: DocumentSelector, provider: TypeDefinitionProvider): Disposable 3675 | // registerWorkspaceSymbolProvider(provider: WorkspaceSymbolProvider): Disposable 3676 | // setLanguageConfiguration(language: string, configuration: LanguageConfiguration): Disposable 3677 | // setTextDocumentLanguage(document: TextDocument, languageId: string): Thenable 3678 | } 3679 | --------------------------------------------------------------------------------