### Project Setup for Local Testing Source: https://github.com/rescript-lang/rescript/blob/master/CONTRIBUTING.md Build the compiler, link it globally, and install it in a local project for testing. ```sh make artifacts npm link cd myProject npm install npm link rescript ``` -------------------------------- ### Install OCaml and Dependencies Source: https://github.com/rescript-lang/rescript/blob/master/CONTRIBUTING.md Initialize opam, create a new switch with a specific OCaml version, and install development dependencies. ```sh opam init # Any recent OCaml version works as a development compiler # Can also create local switch with opam switch create # If you get "No compiler matching `5.3.0' found" error, # then you need to run `opam update && opam upgrade` first opam switch create 5.3.0 # Install dev dependencies from OPAM opam install . --deps-only --with-test --with-dev-setup -y ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/rescript-lang/rescript/blob/master/rewatch/testrepo/packages/dep02/README.md Run this command in your terminal to install all necessary project dependencies. ```sh npm install ``` -------------------------------- ### Install ReScript Dependencies Source: https://github.com/rescript-lang/rescript/blob/master/docs/Syntax.md Installs project dependencies, including test dependencies, using opam. ```sh opam install . --deps-only --with-test ``` -------------------------------- ### Install Rust Toolchain Source: https://github.com/rescript-lang/rescript/blob/master/CONTRIBUTING.md Install a specific Rust toolchain version and set it as the default override for the project. ```sh rustup toolchain install 1.91 rustup override set 1.91 ``` -------------------------------- ### Install @rescript/tools Source: https://github.com/rescript-lang/rescript/blob/master/tools/README.md Install the ReScript Tools package as a development dependency using npm. ```sh npm install --save-dev @rescript/tools ``` -------------------------------- ### Run Jaeger All-in-One Container Source: https://github.com/rescript-lang/rescript/blob/master/AGENTS.md Starts a local Jaeger instance for visualizing OpenTelemetry traces. Ensure Docker is installed and running. ```bash docker run -d --name jaeger \ -p 4317:4317 -p 4318:4318 -p 16686:16686 \ jaegertracing/all-in-one ``` -------------------------------- ### Simple Pattern Matching Examples Source: https://github.com/rescript-lang/rescript/blob/master/tests/syntax_tests/data/printer/pattern/expected/variant.res.txt Provides basic examples of pattern matching using simple identifiers and numeric patterns. ```rescript switch x { | #a() => () | #a() => () } ``` ```rescript switch numericPolyVar { | #42 => () | #3(x, y, z) => Js.log3(x, y, z) } ``` -------------------------------- ### Array Map Function Signature Help with Example Source: https://github.com/rescript-lang/rescript/blob/master/tests/analysis_tests/tests/src/expected/SignatureHelp.res.txt Provides signature help for the `Array.map` function, including its signature, parameter documentation, and a practical code example. Useful for learning array transformations. ```json { "signatures": [ { "label": "(array, int => int) => array", "parameters": [{"label": [0, 11], "documentation": {"kind": "markdown", "value": ""}}, {"label": [13, 23], "documentation": {"kind": "markdown", "value": ""}}], "documentation": {"kind": "markdown", "value": "\n`map(array, fn)` returns a new array with all elements from `array`, each element transformed using the provided `fn`.\n\nSee [Array.map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map) on MDN.\n\n## Examples\n\n```rescript\nlet array = ["Hello", "Hi", "Good bye"]\nlet mappedArray = array->Array.map(greeting => greeting ++ \" to you\")\n\nmappedArray == ["Hello to you", "Hi to you", "Good bye to you"] ```\n"} } ], "activeSignature": 0, "activeParameter": 1 } ``` -------------------------------- ### ReScript Polyvariant Pattern Matching Examples Source: https://github.com/rescript-lang/rescript/blob/master/tests/syntax_tests/data/parsing/recovery/pattern/expected/polyvariant.res.txt Provides correct syntax examples for polyvariant pattern matching in ReScript. These examples demonstrate valid ways to match against polyvariant types, including nested structures and lists. ```rescript match x with | `Rgb (r, g, b) -> () | `Rgb (r, g, Color (a, b)) -> () | `Rgb (r, g, 1::2::[]) -> () ``` ```rescript match x with | `a () -> () | `a () -> () ``` -------------------------------- ### Start Reanalyze Server with Custom Socket Source: https://github.com/rescript-lang/rescript/blob/master/analysis/reanalyze/README.md Start the reanalyze server, specifying a custom path for the Unix domain socket. The default socket path is `/.rescript-reanalyze.sock`. ```bash rescript-tools reanalyze-server \ --socket /tmp/my-custom.sock \ ``` -------------------------------- ### ReScript If Let Basic Example (Commented) Source: https://github.com/rescript-lang/rescript/blob/master/tests/syntax_tests/data/printer/expr/expected/if.res.txt A commented-out example demonstrating a basic 'if let' structure, which is used for optional types. It attempts to unwrap an optional value and execute a block if successful. ```rescript // Basic // if let Some(x) = foo() { // doSomethingWithX(x) // } ``` -------------------------------- ### ReScript Correct Tuple Pattern Matching Example Source: https://github.com/rescript-lang/rescript/blob/master/tests/syntax_tests/data/parsing/recovery/pattern/expected/tuple.res.txt A correct example of tuple pattern matching in ReScript, demonstrating valid syntax for matching tuples and nested tuples. ```rescript ;;match x with | a -> () | (a, (b, c)) -> () | (a, (b, c)) -> () ``` -------------------------------- ### Install Specific PR Build with NPM Source: https://github.com/rescript-lang/rescript/blob/master/CONTRIBUTING.md Use this command to install a specific build from a pull request for debugging purposes. ```bash # Use NPM npm i "https://pkg.pr.new/rescript-lang/rescript@${PR_NUMBER}" ``` -------------------------------- ### Basic Doc Comment Example Source: https://github.com/rescript-lang/rescript/blob/master/tests/analysis_tests/tests/src/expected/DocComments.res.txt Demonstrates a simple doc comment with a code block. Use triple backticks for code examples within comments. ```rescript let a = 10 /* * stuff */ ``` -------------------------------- ### Install Specific PR Build with pnpm Source: https://github.com/rescript-lang/rescript/blob/master/CONTRIBUTING.md Use this command to install a specific build from a pull request for debugging purposes. Note the flag to handle platform subdependencies. ```bash # Use pnpm # pnpm 10 blocks pkg.pr.new's URL-based platform subdependencies unless block-exotic-subdeps is disabled. pnpm --config.block-exotic-subdeps=false add "https://pkg.pr.new/rescript-lang/rescript@${PR_NUMBER}" ``` -------------------------------- ### ReScript Single-Line Comment Example Source: https://github.com/rescript-lang/rescript/blob/master/tests/syntax_tests/data/conversion/reason/expected/singleLineComments.res.txt Demonstrates the use of single-line comments in ReScript. Comments starting with // are ignored by the compiler. ```rescript let x = 1 // here ``` -------------------------------- ### Build, Test, and Clean the Library with Make Source: https://github.com/rescript-lang/rescript/blob/master/analysis/reactive/README.md Standard make commands for building the library, running all tests, and cleaning build artifacts. ```bash # Build the library make build # Run all tests make test # Clean build artifacts make clean ``` -------------------------------- ### Execute Analysis Binary Help Source: https://github.com/rescript-lang/rescript/blob/master/analysis/README.md Run the analysis binary with the --help flag to see available commands and options. ```shell dune exec -- rescript-editor-analysis --help ``` -------------------------------- ### Array.copyWithinToEnd Example Source: https://github.com/rescript-lang/rescript/blob/master/tests/analysis_tests/tests/src/expected/Completion.res.txt Deprecated: Use `copyWithin` instead. This function mutates the array by copying elements from a start index to a target index. ```rescript let arr = [100, 101, 102, 103, 104] arr->Array.copyWithinToEnd(~target=0, ~start=2) == [102, 103, 104, 103, 104] arr == [102, 103, 104, 103, 104] ``` -------------------------------- ### Get RegExp lastIndex in ReScript Source: https://github.com/rescript-lang/rescript/blob/master/tests/analysis_tests/tests/src/expected/CompletionRegexp.res.txt Retrieve the index where the next match will start. Use this to track progress in string matching operations. ```rescript let regexp = RegExp.fromString("\\w+") let someStr = "Many words here." Console.log(regexp->RegExp.lastIndex) // Logs `0` to the console regexp->RegExp.exec(someStr)->ignore Console.log(regexp->RegExp.lastIndex) // Logs `4` to the console ``` -------------------------------- ### ReScript Pattern Matching Examples Source: https://github.com/rescript-lang/rescript/blob/master/tests/syntax_tests/data/parsing/recovery/pattern/expected/list.res.txt Illustrative examples of ReScript pattern matching, including empty lists, nested lists, and spread operators. These demonstrate correct syntax for various list matching scenarios. ```rescript ;;match x with | [] -> () | 1::[]::[] -> () | [] -> [%rescript.exprhole ] ;;1 ;;[3; 4] ;;() ``` -------------------------------- ### List.mapWithIndex Example Source: https://github.com/rescript-lang/rescript/blob/master/tests/analysis_tests/tests/src/expected/Completion.res.txt Demonstrates `List.mapWithIndex`, which applies a function to each element of a list along with its index. The function receives the index (starting from 0) and the element. ```rescript list{1, 2, 3}->List.mapWithIndex((x, index) => index + x) == list{1, 3, 5} ``` -------------------------------- ### Create Lists of Modules Source: https://github.com/rescript-lang/rescript/blob/master/tests/syntax_tests/data/parsing/grammar/expressions/expected/firstClassModule.res.txt Demonstrates creating a list of module instances. This is useful for ordered collections of modules. ```rescript let numbers = [three; (module Four)] ``` ```rescript let numbers = [three; (module struct let x = 4 end)] ``` -------------------------------- ### Serve Playground Bundle Locally Source: https://github.com/rescript-lang/rescript/blob/master/CONTRIBUTING.md Starts a local web server to serve the playground bundles. This is used in conjunction with running the ReScript website locally to test the playground integration. ```sh # Serve playground bundles locally yarn workspace playground serve-bundle # And run the website with "PLAYGROUND_BUNDLE_ENDPOINT" cd path/to/rescript-lang.org PLAYGROUND_BUNDLE_ENDPOINT=http://localhost:8888 npm run dev ``` -------------------------------- ### Get Byte Offset of TypedArray in Rescript Source: https://github.com/rescript-lang/rescript/blob/master/tests/analysis_tests/tests/src/expected/CompletionTypedArrays.res.txt Returns the offset in bytes from the start of the buffer for a given typed array. This is useful for understanding memory layout. ```rescript let view = Int32Array.fromArray([1, 2, 3, 4]) TypedArray.byteOffset(view) == 0 ``` -------------------------------- ### String.startsWith Source: https://github.com/rescript-lang/rescript/blob/master/tests/analysis_tests/tests/src/expected/CompletionJsx.res.txt Checks if a string starts with a specified substring. ```APIDOC ## String.startsWith ### Description `startsWith(str, substr)` returns `true` if the `str` starts with `substr`, `false` otherwise. See [`String.startsWith`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith) on MDN. ### Examples ```rescript String.startsWith("BuckleScript", "Buckle") == true String.startsWith("BuckleScript", "") == true String.startsWith("JavaScript", "Buckle") == false ``` ``` -------------------------------- ### Create New Chapter Object Source: https://github.com/rescript-lang/rescript/blob/master/tests/syntax_tests/data/conversion/reason/expected/letBinding.res.txt Illustrates the creation of a new `Video.chapter` object using a let binding. The `startTime` is calculated based on `percent` and `duration` variables. ```rescript let newChapter: Video.chapter = {startTime: percent *. duration} ``` -------------------------------- ### ReScript Type Definition: Naming Convention (Uppercase) Source: https://github.com/rescript-lang/rescript/blob/master/tests/syntax_tests/data/parsing/errors/typeDef/expected/typeDef.res.txt Type names must start with a lowercase letter. This example shows an error with an uppercase type name. ```rescript type T1 = D1 ``` -------------------------------- ### String.substring Example Source: https://github.com/rescript-lang/rescript/blob/master/tests/analysis_tests/tests/src/expected/CompletionJsx.res.txt Extracts characters from a string between specified start and end indices. Handles swapped or out-of-bounds indices gracefully. Corresponds to JavaScript's String.substring. ```rescript String.substring("playground", ~start=3, ~end=6) == "ygr" ``` ```rescript String.substring("playground", ~start=6, ~end=3) == "ygr" ``` ```rescript String.substring("playground", ~start=4, ~end=12) == "ground" ``` ```rescript String.substring("playground", ~start=4) == "ground" ``` ```rescript String.substring("Hello World", ~start=6) == "World" ``` -------------------------------- ### Constructor Usage with Attributes Source: https://github.com/rescript-lang/rescript/blob/master/tests/syntax_tests/data/parsing/grammar/expressions/expected/binary.res.txt Shows how to use a constructor in ReScript, with an example that includes attributes for potential metadata or specific syntax handling. ```rescript ;;Constructor (a, b) ;;`Constructor (a, b) let _ = ((Constructor (a, b); `Constructor (a, b))[@res.braces ]) ``` -------------------------------- ### ReScript Type Definition: Nested Module Access (Uppercase) Source: https://github.com/rescript-lang/rescript/blob/master/tests/syntax_tests/data/parsing/errors/typeDef/expected/typeDef.res.txt Type names in nested module access paths must start with lowercase. This example demonstrates an error. ```rescript type M1.M2.T3 += D3 ``` -------------------------------- ### Function Signature Help with Multiple Parameters Source: https://github.com/rescript-lang/rescript/blob/master/tests/analysis_tests/tests/src/expected/SignatureHelp.res.txt Demonstrates signature help for a function with multiple parameters, including type definition links. Useful for complex function signatures. ```json { "signatures": [ { "label": "Three(mySpecialThing, array>)", "parameters": [{"label": [6, 20], "documentation": {"kind": "markdown", "value": "```rescript\ntype mySpecialThing = string\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22SignatureHelp.res%22%2C78%2C0%5D)"}}, {"label": [22, 43], "documentation": {"kind": "markdown", "value": ""}}], "documentation": {"kind": "markdown", "value": " Three is... three "} } ], "activeSignature": 0, "activeParameter": 0 } ``` -------------------------------- ### String.search Example Source: https://github.com/rescript-lang/rescript/blob/master/tests/analysis_tests/tests/src/expected/CompletionJsx.res.txt Finds the starting index of the first match of a regular expression within a string. Returns -1 if no match is found. Corresponds to JavaScript's String.search. ```rescript String.search("testing 1 2 3", /\d+/) == 8 ``` ```rescript String.search("no numbers", /\d+/) == -1 ``` -------------------------------- ### Display rescript-tools Help Source: https://github.com/rescript-lang/rescript/blob/master/tools/README.md View the available commands and options for the rescript-tools CLI by running the --help flag. ```sh rescript-tools --help ``` -------------------------------- ### Use Local BSC with Existing Installation Source: https://github.com/rescript-lang/rescript/blob/master/CONTRIBUTING.md Set the RESCRIPT_BSC_EXE environment variable to point to your local bsc.exe for testing. ```sh RESCRIPT_BSC_EXE=your-rescript-repo/packages/@rescript/darwin-arm64/bin/bsc.exe npx rescript ``` -------------------------------- ### ReScript Labeled Parameter Syntax Error Source: https://github.com/rescript-lang/rescript/blob/master/tests/syntax_tests/data/parsing/errors/other/expected/labelledParameters.res.txt This example shows a syntax error where a labeled parameter is missing its leading tilde (~). Ensure all labeled parameters start with '~'. ```rescript let f = (x, y=2, z) => x + y + z ``` -------------------------------- ### Build Playground Bundle with Yarn Source: https://github.com/rescript-lang/rescript/blob/master/packages/playground/README.md Run this command to build the playground bundle. All generated cmij files will be placed in the `packages/` directory. ```bash yarn workspace playground build ``` -------------------------------- ### Get Byte Offset of Typed Array in ReScript Source: https://github.com/rescript-lang/rescript/blob/master/tests/analysis_tests/tests/src/expected/CompletionTypedArrays.res.txt Retrieves the offset in bytes from the start of the underlying buffer for a given typed array. This is useful for low-level memory manipulation. ```rescript ->TypedArray.byteOffset ``` -------------------------------- ### Function Signature Help with Type Aliases and Different Parameter Source: https://github.com/rescript-lang/rescript/blob/master/tests/analysis_tests/tests/src/expected/SignatureHelp.res.txt Similar to the previous example, this shows signature help for a function with type aliases but with a different active parameter. Useful for inspecting function arguments. ```json { "signatures": [ { "label": "(x, tt) => string", "parameters": [{"label": [0, 2], "documentation": {"kind": "markdown", "value": "```rescript\ntype x = {age?: int, name?: string}\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22SignatureHelp.res%22%2C117%2C0%5D)"}}, {"label": [4, 6], "documentation": {"kind": "markdown", "value": "```rescript\ntype tt = One\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22SignatureHelp.res%22%2C123%2C0%5D)"}}], "documentation": {"kind": "markdown", "value": " Some stuff "} } ], "activeSignature": 0, "activeParameter": 1 } ``` -------------------------------- ### Basic Await Usage Source: https://github.com/rescript-lang/rescript/blob/master/tests/syntax_tests/data/parsing/grammar/expressions/expected/await.res.txt Demonstrates the basic usage of `await` with a simple value and with a function that returns a promise. ```rescript let x = (await 1) + 2 ``` ```rescript let x = (await (wait 1)) + (await (wait 2)) ``` -------------------------------- ### Unsafe Array Get Example Source: https://github.com/rescript-lang/rescript/blob/master/tests/analysis_tests/tests/src/expected/Completion.res.txt Demonstrates safe access to array elements within a loop using `unsafe_get`. This function is intended for use when the index is guaranteed to be valid. ```rescript let array = [1, 2, 3] for index in 0 to array->Array.length - 1 { let value = array->Array.unsafe_get(index) Console.log(value) } ``` -------------------------------- ### Regex Flags and Extended Syntax Source: https://github.com/rescript-lang/rescript/blob/master/tests/syntax_tests/data/parsing/grammar/expressions/expected/regex.res.txt Shows examples of using regex flags like 's' for dotall mode and demonstrates extended syntax for more complex pattern matching. ```rescript let re = [%re {js|/(?s)a.b/|js}] ``` ```rescript let re = [%re {js|/(?s)a.*b/|js}] ``` ```rescript let re = [%re {js|/(?s)a.{4,5}b/|js}] ``` ```rescript let re = [%re {js|/(?s)a.b/|js}] ``` -------------------------------- ### ReScript Optional Labeled Parameter Syntax Error Source: https://github.com/rescript-lang/rescript/blob/master/tests/syntax_tests/data/parsing/errors/other/expected/labelledParameters.res.txt This example demonstrates a syntax error where an optional labeled parameter is not correctly prefixed. Optional labeled parameters should start with '~?'. ```rescript let g = (~?x, ~y=2, ~z) => x + y + z ``` -------------------------------- ### Build a Generic Query Handler Instance Source: https://github.com/rescript-lang/rescript/blob/master/tests/syntax_tests/data/parsing/grammar/expressions/expected/firstClassModule.res.txt Defines a function `build_instance` that creates a `Query_handler_instance` module. It takes a module `Q` conforming to `Query_handler` and a `config` to initialize the instance. ```rescript let build_instance = (type a) [arity:2]((module Q) : (module Query_handler with type config = a)) config => ((module struct module Query_handler = Q let this = Q.create config end) : (module Query_handler_instance)) ``` ```rescript let build_instance = (type a) [arity:2]((module Q) : (module Query_handler with type config = a)) config => ((((module struct module Query_handler = Q let this = Q.create config end) : (module Query_handler_instance))) [@res.braces ]) ``` -------------------------------- ### ReScript Completion: TypedArray.byteLength Source: https://github.com/rescript-lang/rescript/blob/master/tests/analysis_tests/tests/src/expected/CompletionTypedArrays.res.txt Use `TypedArray.byteLength` to get the length in bytes of a typed array view. Refer to MDN for JavaScript prototype details. Example provided shows usage with Int32Array. ```rescript ->TypedArray.byteLength ``` ```rescript let view = Int32Array.fromArray([1, 2]) TypedArray.byteLength(view) == 8 ``` -------------------------------- ### String.startsWithFrom Source: https://github.com/rescript-lang/rescript/blob/master/tests/analysis_tests/tests/src/expected/CompletionJsx.res.txt Checks if a string starts with a specified substring at a given position. ```APIDOC ## String.startsWithFrom ### Description `startsWithFrom(str, substr, n)` returns `true` if the `str` starts with `substr` starting at position `n`, `false` otherwise. If `n` is negative, the search starts at the beginning of `str`. See [`String.startsWith`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith) on MDN. ### Examples ```rescript String.startsWithFrom("BuckleScript", "kle", 3) == true String.startsWithFrom("BuckleScript", "", 3) == true String.startsWithFrom("JavaScript", "Buckle", 2) == false ``` ``` -------------------------------- ### ReScript Type Definition: Module Access in Generic Type (Uppercase) Source: https://github.com/rescript-lang/rescript/blob/master/tests/syntax_tests/data/parsing/errors/typeDef/expected/typeDef.res.txt Type names within module access paths for generic types must start with lowercase. This example shows an error. ```rescript type M1.M2.T5<_> += D5 ``` -------------------------------- ### Define and Use a First-Class Module Source: https://github.com/rescript-lang/rescript/blob/master/tests/syntax_tests/data/parsing/grammar/modexpr/expected/firstClassModules.res.txt Defines a module 'Device' from a hashtable lookup and uses it. Ensure the 'devices' hashtable is populated before use. ```rescript module Device = (val (((let deviceName = parseCmdline () in try Hashtbl.find devices deviceName with | Not_found -> exit 2) [@res.braces ]) : (module Device))) let draw_using_device [arity:2]device_name picture = ((let module Device = (val (Hashtbl.find devices device_name : (module DEVICE))) in Device.draw picture) [@res.braces ]) ``` -------------------------------- ### ReScript Type Definition Labeled Parameter Syntax Error Source: https://github.com/rescript-lang/rescript/blob/master/tests/syntax_tests/data/parsing/errors/other/expected/labelledParameters.res.txt This example illustrates a syntax error in a type definition for a function with labeled parameters. Labeled parameters in type definitions must start with '~'. ```rescript type f = (x: int, y: int) => int ``` -------------------------------- ### ReScript Type Definition: Module Access in Type Name (Uppercase) Source: https://github.com/rescript-lang/rescript/blob/master/tests/syntax_tests/data/parsing/errors/typeDef/expected/typeDef.res.txt Type names within module access paths must also follow naming conventions (start with lowercase). This example shows an error. ```rescript type M.T2 += D2 ``` -------------------------------- ### Create and Derive Reactive Collections in OCaml Source: https://github.com/rescript-lang/rescript/blob/master/analysis/reactive/README.md Demonstrates creating a source collection and deriving new collections using combinators like flatMap and join. Ensure the Reactive module is opened. ```ocaml open Reactive (* Create a source collection *) let (files, emit) = source ~name:"files" () (* Derive collections with combinators *) let decls = flatMap ~name:"decls" files ~f:(fun _path data -> data.declarations) () let refs = flatMap ~name:"refs" files ~f:(fun _path data -> data.references) ~merge:PosSet.union () (* Join collections *) let resolved = join ~name:"resolved" refs decls ~key_of:(fun pos _ref -> pos) ~f:(fun pos ref decl_opt -> ...) () (* Compute transitive closure *) let reachable = fixpoint ~name:"reachable" ~init:roots ~edges:graph () (* Emit changes *) emit (Set ("file.res", file_data)) emit (Batch [set "a.res" data_a; set "b.res" data_b]) ``` -------------------------------- ### Substring from Start to End Source: https://github.com/rescript-lang/rescript/blob/master/tests/analysis_tests/tests/src/expected/CompletionJsx.res.txt Extracts a substring from a specified start index to the end of the string. Returns the entire string if the start index is non-positive, and an empty string if the start index is beyond the string length. ```rescript String.substringToEnd("playground", ~start=4) == "ground" ``` ```rescript String.substringToEnd("playground", ~start=-3) == "playground" ``` ```rescript String.substringToEnd("playground", ~start=12) == "" ``` -------------------------------- ### Basic Polyvariant Constructors Source: https://github.com/rescript-lang/rescript/blob/master/tests/syntax_tests/data/printer/expr/expected/polyvariant.res.txt Illustrates the basic usage of polyvariant constructors like #Reducer and #Constr with different argument styles (single, tuple, record, list). ```rescript let r = #Reducer() let r = #Reducer(state, nexState, sideEffect) let r = #Reducer( superLongIdentiiiiiiiifffffffiiiiieeeeeeeer, superLongIdentiiiiiiiifffffffiiiiieeeeeeeer, superLongIdentiiiiiiiifffffffiiiiieeeeeeeer, ) let r = #Reducer([state, nexState, sideEffect]) let r = #Reducer([ superLongIdentiiiiiiiifffffffiiiiieeeeeeeer, superLongIdentiiiiiiiifffffffiiiiieeeeeeeer, superLongIdentiiiiiiiifffffffiiiiieeeeeeeer, ]) let r = #Reducer({state: nextState, sideEffects: []}) ``` ```rescript let c = #Constr({ firstField: superLongIdentiiiiiiiifffffffiiiiieeeeeeeer, secondField: superLongIdentiiiiiiiifffffffiiiiieeeeeeeer, thirdField: superLongIdentiiiiiiiifffffffiiiiieeeeeeeer, }) ``` ```rescript let forceBreak = #Cartesian({ x: Omega.x, y: Theta.y, }) ``` ```rescript let c = #Constr(list{ superLoooooooooooooooooooooooooooooongIiiiiiiiiideeeentifieeeeeeeeeeeeeeeeer, superLoooooooooooooooooooooooooooooongIiiiiiiiiideeeentifieeeeeeeeeeeeeeeeer, superLoooooooooooooooooooooooooooooongIiiiiiiiiideeeentifieeeeeeeeeeeeeeeeer, ...superLoooooooooooooooooooooooooooooongListHere, }) ``` ```rescript let c = #Constr(list{ superLoooooooooooooooooooooooooooooongIiiiiiiiiideeeentifieeeeeeeeeeeeeeeeer, superLoooooooooooooooooooooooooooooongIiiiiiiiiideeeentifieeeeeeeeeeeeeeeeer, superLoooooooooooooooooooooooooooooongIiiiiiiiiideeeentifieeeeeeeeeeeeeeeeer, }) ``` -------------------------------- ### sliceToEnd Source: https://github.com/rescript-lang/rescript/blob/master/tests/analysis_tests/tests/src/expected/Completion.res.txt Deprecated: Use `slice` instead. `sliceToEnd(array, start)` creates a new array from `array`, with all items from `array` starting from `start`. ```APIDOC ## sliceToEnd array ~start ### Description Deprecated: Use `slice` instead Creates a new array from `array`, with all items from `array` starting from `start`. See [`Array.slice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice) on MDN. ### Parameters #### Path Parameters - **array** (array<'a>) - The input array. - **~start** (int) - The starting index (inclusive). ### Examples ```rescript [1, 2, 3, 4]->Array.sliceToEnd(~start=1) == [2, 3, 4] ``` ``` -------------------------------- ### Check if String Contains Substring from Start Index Source: https://github.com/rescript-lang/rescript/blob/master/tests/analysis_tests/tests/src/expected/DotPipeCompletionSpec.res.txt Use String.includesFrom to check if a string contains a substring starting from a specific index. The search is inclusive of the start index. ```rescript String.includesFrom("programmer", "gram", 1) == true ``` ```rescript String.includesFrom("programmer", "gram", 4) == false ``` ```rescript String.includesFrom(`대한민국`, `한`, 1) == true ``` -------------------------------- ### Create Arrays of Modules Source: https://github.com/rescript-lang/rescript/blob/master/tests/syntax_tests/data/parsing/grammar/expressions/expected/firstClassModule.res.txt Shows how to create an array containing different module instances, all conforming to a common type. This example uses a mix of pre-defined and inline modules. ```rescript let numbers = [|three;(module Four)|] ``` ```rescript let numbers = [|three;(module struct let x = 4 end)|] ``` -------------------------------- ### String.sliceToEnd Source: https://github.com/rescript-lang/rescript/blob/master/tests/analysis_tests/tests/src/expected/CompletionInferValues.res.txt Deprecated: Use `slice` instead. `sliceToEnd(str, ~start)` returns the substring of `str` from `start` to the end. Handles negative `start` values and `start` values greater than string length. ```APIDOC ## String.sliceToEnd ### Description Deprecated: Use `slice` instead `sliceToEnd(str, ~start)` returns the substring of `str` starting at character `start` to the end of the string. - If `start` is negative, then it is evaluated as `length(str - start)`. - If `start` is greater than the length of `str`, then sliceToEnd returns the empty string. See [`String.slice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/slice) on MDN. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **string** (string) - The extracted substring. #### Response Example None ## Examples ```rescript String.sliceToEnd("abcdefg", ~start=4) == "efg" String.sliceToEnd("abcdefg", ~start=-2) == "fg" String.sliceToEnd("abcdefg", ~start=7) == "" ``` ``` -------------------------------- ### Worked Example: Removing Edge A->B Source: https://github.com/rescript-lang/rescript/blob/master/analysis/reactive/IncrementalFixpointReport.md Illustrates the step-by-step execution of the incremental fixpoint algorithm when an edge is removed. Shows how nodes are tentatively deleted and then re-added if alternative paths exist. ```text A (root) / \ B X \ / D ``` ```text Output: `[(B, None)]` — only B was lost. D survived because it had an alternative path through X. ``` -------------------------------- ### Function Signature Help with Different Active Parameter Source: https://github.com/rescript-lang/rescript/blob/master/tests/analysis_tests/tests/src/expected/SignatureHelp.res.txt Shows signature help for the same function as the previous example, but with a different active parameter highlighted. Useful for navigating through parameters. ```json { "signatures": [ { "label": "Three(mySpecialThing, array>)", "parameters": [{"label": [6, 20], "documentation": {"kind": "markdown", "value": "```rescript\ntype mySpecialThing = string\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22SignatureHelp.res%22%2C78%2C0%5D)"}}, {"label": [22, 43], "documentation": {"kind": "markdown", "value": ""}}], "documentation": {"kind": "markdown", "value": " Three is... three "} } ], "activeSignature": 0, "activeParameter": 1 } ``` -------------------------------- ### Start Development Watchers Source: https://github.com/rescript-lang/rescript/blob/master/tests/gentype_tests/typescript-react-example/README.md Initiate the ReScript watcher using 'npm run start' in one terminal. Concurrently, start the TypeScript watcher in another terminal using 'npm run ts:watch'. ```sh # Start the Reason watcher. npm run start # In another tab: start the TypeScript watcher. npm run ts:watch ``` -------------------------------- ### Function Signature Help with Optional Parameters Source: https://github.com/rescript-lang/rescript/blob/master/tests/analysis_tests/tests/src/expected/SignatureHelp.res.txt Illustrates signature help for a function with optional parameters. Helps in understanding which parameters are optional and their types. ```json { "signatures": [ { "label": "One({miss?: bool, hit?: bool, stuff?: string})", "parameters": [{"label": [0, 0], "documentation": {"kind": "markdown", "value": ""}}, {"label": [5, 16], "documentation": {"kind": "markdown", "value": ""}}, {"label": [18, 28], "documentation": {"kind": "markdown", "value": ""}}, {"label": [30, 44], "documentation": {"kind": "markdown", "value": ""}}], "documentation": {"kind": "markdown", "value": " One is cool. "} } ], "activeSignature": 0, "activeParameter": -1 } ``` -------------------------------- ### Build Compiler and Test Single File Source: https://github.com/rescript-lang/rescript/blob/master/CONTRIBUTING.md Build the compiler and standard library, then test a single ReScript file. ```sh make lib ./cli/bsc.js myTestFile.res ``` -------------------------------- ### Await with Fetch and Pattern Matching Source: https://github.com/rescript-lang/rescript/blob/master/tests/syntax_tests/data/parsing/grammar/expressions/expected/await.res.txt Shows how to use `await` with the `fetch` API and pattern match on the result, handling potential exceptions. ```rescript let maybeSomeValue = match await (fetchData url) with | data -> Some data | exception JsExn _ -> None ``` -------------------------------- ### Basic Reducer Constructor Source: https://github.com/rescript-lang/rescript/blob/master/tests/syntax_tests/data/printer/expr/expected/constructor.res.txt Illustrates the basic usage of the Reducer constructor with state, nextState, and sideEffect. ```rescript let r = Reducer() let r = Reducer(state, nexState, sideEffect) ``` -------------------------------- ### Extract Substring with Start and End Indices Source: https://github.com/rescript-lang/rescript/blob/master/tests/analysis_tests/tests/src/expected/CompletionInferValues.res.txt Extracts a portion of a string between specified start and end indices. Supports negative indices and handles out-of-bounds end indices. Returns an empty string if start exceeds end. ```rescript String.slice("abcdefg", ~start=2, ~end=5) == "cde" String.slice("abcdefg", ~start=2, ~end=9) == "cdefg" String.slice("abcdefg", ~start=-4, ~end=-2) == "de" String.slice("abcdefg", ~start=5, ~end=1) == "" String.slice("abcdefg", ~start=2) == "cdefg" String.slice("Hello World", ~start=6) == "World" ``` -------------------------------- ### Defining Objects with Properties in ReScript Source: https://github.com/rescript-lang/rescript/blob/master/tests/syntax_tests/data/conversion/reason/expected/jsObject.res.txt Shows how to define objects with various properties. You can initialize objects with specific key-value pairs. ```rescript let y = {"age": 30} let y = {"age": 30, "name": "steve"} ``` -------------------------------- ### Basic Named Arguments in ReScript Source: https://github.com/rescript-lang/rescript/blob/master/tests/syntax_tests/data/conversion/reason/expected/namedArgs.res.txt Demonstrates the basic syntax for passing named arguments to a function. Ensure all required arguments are provided with their correct names. ```rescript let wizard = Wizard.make( ~spriteSheet=wizard, ~hp=999999999999999, ~mp=50, //~coordinates={x: 0., y:0. z: 0.}, ~coordinates={x: 40, y: 100., z: 0.}, // /* c0 */ ~gpuCoordinates= /* c1 */ gpuBuffer[10] /* c2 */, // trailing ) ``` -------------------------------- ### Install Specific PR Build with Yarn Source: https://github.com/rescript-lang/rescript/blob/master/CONTRIBUTING.md Use this command to install a specific build from a pull request for debugging purposes. ```bash # Use Yarn yarn add "rescript@https://pkg.pr.new/rescript-lang/rescript@${PR_NUMBER}" ``` -------------------------------- ### Create Analysis Service with Reactive Collection Source: https://github.com/rescript-lang/rescript/blob/master/docs/reactive_reanalyze_design.md Initializes the analysis service with a configuration and a reactive collection for CMT files. CMT file paths are added to the collection, and a process function is defined to handle CMT processing based on the configuration. ```ocaml (* DceService.ml *) type t = { config: Reanalyze.DceConfig.t; collection: cmt_file_result Reactive_file_collection.t; mutable last_result: Reanalyze.AnalysisResult.t option; } let create ~project_root = let config = Reanalyze.DceConfig.current () in let cmt_paths = Reanalyze.collectCmtFilePaths ~cmtRoot:None in let collection = Reactive_file_collection.create ~process:(process_cmt_for_config ~config) in List.iter (Reactive_file_collection.add collection) cmt_paths; { config; collection; last_result = None } ``` -------------------------------- ### Basic Function Calls and Logging Source: https://github.com/rescript-lang/rescript/blob/master/tests/syntax_tests/data/printer/expr/expected/apply.res.txt Illustrates standard function calls and logging with Js.log. ```rescript console.log() ``` ```rescript Js.log("arg1", "arg2") ``` -------------------------------- ### Array.toShuffled Example Source: https://github.com/rescript-lang/rescript/blob/master/tests/analysis_tests/tests/src/expected/Completion.res.txt Shows how to create a new array with elements in a random order using Array.toShuffled. The original array remains unchanged. ```rescript let array = ["Hello", "Hi", "Good bye"] let shuffledArray = array->Array.toShuffled Console.log(shuffledArray) Array.toShuffled([1, 2, 3])->Array.length == 3 ``` -------------------------------- ### Instantiate Modules for Integer Types Source: https://github.com/rescript-lang/rescript/blob/master/tests/syntax_tests/data/parsing/grammar/expressions/expected/firstClassModule.res.txt Demonstrates instantiating modules that conform to the `X_int` module type. This is useful for creating distinct integer representations. ```rescript let three = ((module Three) : (module X_int)) ``` -------------------------------- ### ReScript: Exotic Identifier Usage Examples Source: https://github.com/rescript-lang/rescript/blob/master/tests/syntax_tests/data/parsing/errors/scanner/expected/exoticIdent.res.txt Provides examples of valid and invalid usage of exotic (quoted) identifiers in ReScript. ```rescript type nonrec "" = int ``` ```rescript let "" = [%rescript.exprhole ] ``` ```rescript let "a = b ``` ```rescript ;; ;;{js| = 1 |js} ``` -------------------------------- ### String.startsWithFrom Source: https://github.com/rescript-lang/rescript/blob/master/tests/analysis_tests/tests/src/expected/CompletionJsx.res.txt `startsWithFrom(str, substr, n)` returns `true` if the `str` starts with `substr` starting at position `n`, `false` otherwise. ```APIDOC ## String.startsWithFrom ### Description Checks if a string starts with a substring from a specified position. ### Parameters - **str** (string) - The string to check. - **substr** (string) - The substring to look for. - **n** (int) - The position to start the search from. If negative, starts from the beginning. ### Returns - bool - `true` if the string starts with the substring at the specified position, `false` otherwise. ### Examples ```rescript String.startsWithFrom("BuckleScript", "kle", 3) == true String.startsWithFrom("BuckleScript", "", 3) == true String.startsWithFrom("JavaScript", "Buckle", 2) == false ``` ``` -------------------------------- ### Set RegExp lastIndex in ReScript Source: https://github.com/rescript-lang/rescript/blob/master/tests/analysis_tests/tests/src/expected/CompletionRegexp.res.txt Set the index where the next match will start. This is useful for resuming searches or starting from a specific position. ```rescript let regexp = RegExp.fromString("\\w+") let someStr = "Many words here." regexp->RegExp.setLastIndex(4) regexp->RegExp.exec(someStr)->ignore Console.log(regexp->RegExp.lastIndex) // Logs `10` to the console ``` -------------------------------- ### Fix OCaml Install Error with fsmonitor Source: https://github.com/rescript-lang/rescript/blob/master/CONTRIBUTING.md Troubleshoot and resolve an error during `opam install` related to `fsmonitor` by disabling it for the specific package. ```sh cd _opam/.opam-switch/sources/flow_parser \ && git config core.fsmonitor false \ && rm -f .git/fsmonitor--daemon.ipc ``` -------------------------------- ### JavaScript Object Constructor Source: https://github.com/rescript-lang/rescript/blob/master/tests/syntax_tests/data/printer/expr/expected/constructor.res.txt Shows how to instantiate JavaScript objects using ReScript syntax, passing key-value pairs. ```rescript let coordinate = JsCoord({"x": 1, "y": 1}) let user = JsUser({ "name": "steve", "age": 32, }) ``` -------------------------------- ### Corrected Recursive Binding Example Source: https://github.com/rescript-lang/rescript/blob/master/tests/syntax_tests/data/parsing/errors/expressions/expected/letUnwrapRec.res.txt This example shows the corrected syntax for recursive bindings, removing the disallowed `let? rec` combination. ```rescript let rec Some baz = someOption[@@let.unwrap ] and Some bar = baz[@@let.unwrap ] ``` -------------------------------- ### Starting a Timeout Timer Source: https://github.com/rescript-lang/rescript/blob/master/tests/analysis_tests/tests/src/expected/CompletionExpressions.res.txt Starts a timer that executes a callback function once after a specified duration in milliseconds. Use `clearTimeout` (not shown) to cancel it before execution. ```rescript let timeoutId = setTimeout(() => { Console.log("This prints in 200 ms.") }, 200) ``` -------------------------------- ### ReScript Valid Exponent Notation Examples Source: https://github.com/rescript-lang/rescript/blob/master/tests/syntax_tests/data/parsing/errors/scanner/expected/exponent_notation.res.txt Examples of correctly formatted exponent notation in ReScript. These demonstrate valid usage with and without underscores. ```rescript let x = 1e1 ``` ```rescript let x = 1e_1 ``` ```rescript let x = 1. ``` -------------------------------- ### ReScript Dictionary Creation and Destructuring Source: https://github.com/rescript-lang/rescript/blob/master/tests/syntax_tests/data/printer/pattern/expected/dict.res.txt Demonstrates how to create a dictionary and destructure it using a pattern match. This is useful for extracting specific values from a dictionary. ```rescript let someDict = dict{ "one": "one", } let dict{"one": ?one} = someDict ``` -------------------------------- ### Pattern Matching with First-Class Modules Source: https://github.com/rescript-lang/rescript/blob/master/tests/syntax_tests/data/parsing/grammar/pattern/expected/firstClassModules.res.txt Illustrates how to use pattern matching to deconstruct and handle different types of first-class modules. This is useful for conditional logic based on module structure. ```rescript ;;match x with | (module Set) -> () | ((module Set) : (module Set.S with type elt = s)) -> () | ((module Set) : (module Set.S with type elt = s and type elt2 = t)) -> () ``` -------------------------------- ### RegExp.lastIndex Completion with Example Source: https://github.com/rescript-lang/rescript/blob/master/tests/analysis_tests/tests/src/expected/CompletionPipeChain.res.txt Shows the completion for `RegExp.lastIndex`, which returns the index for the next match. Includes a usage example demonstrating its behavior before and after executing a match. ```json [ { "label": "RegExp.lastIndex", "kind": 12, "tags": [], "detail": "t => int", "documentation": {"kind": "markdown", "value": "\n`lastIndex(regexp)` returns the index the next match will start from.\n\nSee [`RegExp.lastIndex`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/lastIndex) on MDN.\n\n## Examples\n```rescript\n// Match the first word in a sentence\nlet regexp = RegExp.fromString(\"\\\\w+\")\nlet someStr = \"Many words here.\"\n\nConsole.log(regexp->RegExp.lastIndex) // Logs `0` to the console\n\nregexp->RegExp.exec(someStr)->ignore\n\nConsole.log(regexp->RegExp.lastIndex) // Logs `4` to the console\n```\n"} } ] ``` -------------------------------- ### Build ReScript Runtime Library Source: https://github.com/rescript-lang/rescript/blob/master/CONTRIBUTING.md Build the runtime and standard library components of ReScript. ```sh # Build the runtime/standard library make lib ``` -------------------------------- ### Match%exn Syntax for Sound Exception Handling Source: https://github.com/rescript-lang/rescript/blob/master/compiler/core/destruct_exn.md The `match%%exn` syntax provides a sounder way to handle exceptions by directly matching against exception branches without needing to pre-emptively check if the value is an exception. ```ocaml match%exn v with | .. | .. ``` -------------------------------- ### Direct Exception Destructuring Example Source: https://github.com/rescript-lang/rescript/blob/master/compiler/core/destruct_exn.md An example demonstrating the use of the `destruct` external. This approach forces the programmer to explicitly check if the value `v` is an exception. ```ocaml destruct v begin fun exn -> Js.log exn ; match exn with | .. | .. ``` -------------------------------- ### Run ReScript Compiler in Node.js Source: https://github.com/rescript-lang/rescript/blob/master/CONTRIBUTING.md Demonstrates how to load and use the ReScript compiler from a Node.js environment. Ensure the compiler.js and cmij.js files are in the correct paths. ```javascript let { rescript_compiler } = require("./compiler.js"); require("./packages/compiler-builtins/cmij.js") let { rescript } = rescript_compiler.make() let result = rescript.compile(`Console.log(${rescript.version})`); eval(result.js_code); ``` -------------------------------- ### Extract Substring to End of String Source: https://github.com/rescript-lang/rescript/blob/master/tests/analysis_tests/tests/src/expected/CompletionInferValues.res.txt Extracts a substring from a specified start index to the end of the string. Handles negative start indices. Deprecated in favor of String.slice. ```rescript String.sliceToEnd("abcdefg", ~start=4) == "efg" String.sliceToEnd("abcdefg", ~start=-2) == "fg" String.sliceToEnd("abcdefg", ~start=7) == "" ``` -------------------------------- ### Await with Module Import and Attributes Source: https://github.com/rescript-lang/rescript/blob/master/tests/syntax_tests/data/parsing/grammar/expressions/expected/await.res.txt Shows how to await a module import and apply attributes like `[@a]` and `[@b]`. ```rescript let forEach = await ((Js.Import Belt.List.forEach)[@a ][@b ]) ``` -------------------------------- ### Int.range Source: https://github.com/rescript-lang/rescript/blob/master/tests/analysis_tests/tests/src/expected/CompletionJsx.res.txt `range(start, end, ~options=?)` returns an int array of the sequence of integers in the range `[start, end)`. It supports optional step and inclusive options. ```APIDOC ## Int.range ### Description `range(start, end, ~options=?)` returns an int array of the sequence of integers in the range `[start, end)`. That is, including `start` but excluding `end`. If `step` is not set and `start < end`, the sequence will be increasing in steps of 1. If `step` is not set and `start > end`, the sequence will be decreasing in steps of -1. If `step` is set, the sequence will increase or decrease by that amount for each step. If `start < end` and `step` is negative, or vice versa, an empty array is returned since the sequence would otherwise never reach or exceed the end value and hence be infinite. If `step` is `0` and `start !=` end, a `RangeError` is thrown as the sequence would never reach or exceed the end value and hence be infinite. If `inclusive` is set to `true`, the sequence will include `end` if `step` is set such that the sequence includes it. ### Examples ```rescript Int.range(3, 6) == [3, 4, 5] Int.range(-3, -1) == [-3, -2] Int.range(3, 1) == [3, 2] Int.range(3, 7, ~options={step: 2}) == [3, 5] Int.range(3, 7, ~options={step: 2, inclusive: true}) == [3, 5, 7] Int.range(3, 6, ~options={step: -2}) // RangeError ``` ### Exceptions - Raises `RangeError` if `step == 0 && start != end`. ``` -------------------------------- ### Corrected Type Definition Examples Source: https://github.com/rescript-lang/rescript/blob/master/tests/syntax_tests/data/parsing/errors/typeDef/expected/typeParams.res.txt These examples show the correct syntax for defining types with parameters, including non-recursive types and correctly escaped or named parameters. ```rescript type nonrec 'a node = { _value: 'a Js.Nullable.value } ``` ```rescript type nonrec ('from, 'for) derivedNode = { mutable value: 'to_ ; updateF: 'from -> 'to_ (a:1) } ``` ```rescript type nonrec ('from, ') derivedNode = { mutable value: 'to_ ; updateF: 'from -> 'to_ (a:1) } ``` ```rescript type nonrec ('from, 'foo) derivedNode = { mutable value: 'to_ ; updateF: 'from -> 'to_ (a:1) } ``` -------------------------------- ### Index Of From TypedArray in Rescript Source: https://github.com/rescript-lang/rescript/blob/master/tests/analysis_tests/tests/src/expected/CompletionTypedArrays.res.txt Searches for a value in a typed array starting from a specified index. Returns the index of the first occurrence of the value at or after the starting index, or -1 if not found. ```rescript let view = Int32Array.fromArray([1, 2, 3, 2]) TypedArray.indexOfFrom(view, 2, 2) == 3 ``` -------------------------------- ### Build Platform Toolchain Commands Source: https://github.com/rescript-lang/rescript/blob/master/AGENTS.md Use these make commands to build the ReScript platform toolchain and related components. 'make' builds the default toolchain, 'make lib' includes the standard library, and 'make test' includes tests. ```bash make # Build the platform toolchain + stdlib make lib # Build the platform toolchain + stdlib and run tests make test # Format code make format # Check formatting make checkformat ``` -------------------------------- ### Function Signature Help with Documentation Source: https://github.com/rescript-lang/rescript/blob/master/tests/analysis_tests/tests/src/expected/SignatureHelp.res.txt Displays signature help for a function with parameters and documentation. Useful for understanding function arguments and their types. ```json { "signatures": [ { "label": "One({miss?: bool, hit?: bool, stuff?: string})", "parameters": [{"label": [0, 0], "documentation": {"kind": "markdown", "value": ""}}, {"label": [5, 16], "documentation": {"kind": "markdown", "value": ""}}, {"label": [18, 28], "documentation": {"kind": "markdown", "value": ""}}, {"label": [30, 44], "documentation": {"kind": "markdown", "value": ""}}], "documentation": {"kind": "markdown", "value": " One is cool. "} } ], "activeSignature": 0, "activeParameter": 2 } ```