From d83efef205138a6d92de147aa963d2b54821a8b5 Mon Sep 17 00:00:00 2001 From: Cristiano Calcagno Date: Fri, 16 Apr 2021 04:45:25 +0200 Subject: [PATCH 1/7] Check in results of tests. --- test.sh | 5 - test/src/Complete.exp | 333 ++++++++++++++++++++++++++++++++++++++++ test/src/Definition.exp | 1 + test/test.sh | 5 + 4 files changed, 339 insertions(+), 5 deletions(-) delete mode 100755 test.sh create mode 100644 test/src/Complete.exp create mode 100644 test/src/Definition.exp create mode 100755 test/test.sh diff --git a/test.sh b/test.sh deleted file mode 100755 index 7d48ae7b..00000000 --- a/test.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/zsh - -./_build/install/default/bin/rescript-editor-support.exe test test/src/Definition.res - -./_build/install/default/bin/rescript-editor-support.exe test test/src/Complete.res diff --git a/test/src/Complete.exp b/test/src/Complete.exp new file mode 100644 index 00000000..8b0cc259 --- /dev/null +++ b/test/src/Complete.exp @@ -0,0 +1,333 @@ +[{ + "label": "mapReverse", + "kind": 12, + "tags": [], + "detail": "(t<'a>, 'a => 'b) => t<'b>", + "documentation": {"kind": "markdown", "value": "`mapReverse xs f`\n\nEquivalent to `reverse (map xs f)`\n\n```ml\nmapReverse [3;4;5] (fun x -> x * x) = [25;16;9];;\n```\n\n\n\nbelt_List.mli:299"} + }, { + "label": "makeBy", + "kind": 12, + "tags": [], + "detail": "(int, int => 'a) => t<'a>", + "documentation": {"kind": "markdown", "value": "`makeBy n f`\n\n- return a list of length `n` with element `i` initialized with `f i`\n\n\n- return the empty list if `n` is negative\n\n\n\n```ml\nmakeBy 5 (fun i -> i) = [0;1;2;3;4];;\nmakeBy 5 (fun i -> i * i) = [0;1;4;9;16];;\n```\n\n\n\nbelt_List.mli:127"} + }, { + "label": "make", + "kind": 12, + "tags": [], + "detail": "(int, 'a) => t<'a>", + "documentation": {"kind": "markdown", "value": "`make n v`\n\n- return a list of length `n` with each element filled with value `v`\n\n\n- return the empty list if `n` is negative\n\n\n\n```ml\nmake 3 1 = [1;1;1]\n```\n\n\n\nbelt_List.mli:115"} + }, { + "label": "mapReverse2U", + "kind": 12, + "tags": [], + "detail": "(t<'a>, t<'b>, (. 'a, 'b) => 'c) => t<'c>", + "documentation": {"kind": "markdown", "value": "\nbelt_List.mli:391"} + }, { + "label": "map", + "kind": 12, + "tags": [], + "detail": "(t<'a>, 'a => 'b) => t<'b>", + "documentation": {"kind": "markdown", "value": "`map xs f`\n\nreturn the list obtained by applying `f` to each element of `xs`\n\n```ml\nmap [1;2] (fun x-> x + 1) = [3;4]\n```\n\n\n\nbelt_List.mli:222"} + }, { + "label": "mapWithIndexU", + "kind": 12, + "tags": [], + "detail": "(t<'a>, (. int, 'a) => 'b) => t<'b>", + "documentation": {"kind": "markdown", "value": "\nbelt_List.mli:258"} + }, { + "label": "mapU", + "kind": 12, + "tags": [], + "detail": "(t<'a>, (. 'a) => 'b) => t<'b>", + "documentation": {"kind": "markdown", "value": "\nbelt_List.mli:221"} + }, { + "label": "makeByU", + "kind": 12, + "tags": [], + "detail": "(int, (. int) => 'a) => t<'a>", + "documentation": {"kind": "markdown", "value": "\nbelt_List.mli:126"} + }, { + "label": "mapReverse2", + "kind": 12, + "tags": [], + "detail": "(t<'a>, t<'b>, ('a, 'b) => 'c) => t<'c>", + "documentation": {"kind": "markdown", "value": "`mapReverse2 xs ys f`\n\nequivalent to `reverse (zipBy xs ys f)`\n\n```ml\nmapReverse2 [1;2;3] [1;2] (+) = [4;2]\n```\n\n\n\nbelt_List.mli:392"} + }, { + "label": "mapWithIndex", + "kind": 12, + "tags": [], + "detail": "(t<'a>, (int, 'a) => 'b) => t<'b>", + "documentation": {"kind": "markdown", "value": "`mapWithIndex xs f` applies `f` to each element of `xs`. Function `f` takes two arguments: the index starting from 0 and the element from `xs`.\n\n```ml\nmapWithIndex [1;2;3] (fun i x -> i + x) =\n[0 + 1; 1 + 2; 2 + 3 ]\n```\n\n\n\nbelt_List.mli:259"} + }, { + "label": "mapReverseU", + "kind": 12, + "tags": [], + "detail": "(t<'a>, (. 'a) => 'b) => t<'b>", + "documentation": {"kind": "markdown", "value": "\nbelt_List.mli:298"} + }] +[{ + "label": "Floatarray", + "kind": 9, + "tags": [], + "detail": "module", + "documentation": {"kind": "markdown", "value": "\narray.mli:267"} + }, { + "label": "fold_left", + "kind": 12, + "tags": [], + "detail": "(('a, 'b) => 'a, 'a, array<'b>) => 'a", + "documentation": {"kind": "markdown", "value": "`Array.fold_left f x a` computes `f (... (f (f x a.(0)) a.(1)) ...) a.(n-1)`, where `n` is the length of the array `a`.\n\n\n\n\narray.mli:160"} + }, { + "label": "concat", + "kind": 12, + "tags": [], + "detail": "list> => array<'a>", + "documentation": {"kind": "markdown", "value": "Same as append, but concatenates a list of arrays.\n\n\n\n\narray.mli:95"} + }, { + "label": "mapi", + "kind": 12, + "tags": [], + "detail": "((int, 'a) => 'b, array<'a>) => array<'b>", + "documentation": {"kind": "markdown", "value": "Same as map, but the function is applied to the index of the element as first argument, and the element itself as second argument.\n\n\n\n\narray.mli:155"} + }, { + "label": "exists", + "kind": 12, + "tags": [], + "detail": "('a => bool, array<'a>) => bool", + "documentation": {"kind": "markdown", "value": "`Array.exists p [|a1; ...; an|]` checks if at least one element of the array satisfies the predicate `p`. That is, it returns `(p a1) || (p a2) || ... || (p an)`.\n\nSince: 4.03.0\n\n\narray.mli:197"} + }, { + "label": "for_all", + "kind": 12, + "tags": [], + "detail": "('a => bool, array<'a>) => bool", + "documentation": {"kind": "markdown", "value": "`Array.for_all p [|a1; ...; an|]` checks if all elements of the array satisfy the predicate `p`. That is, it returns `(p a1) && (p a2) && ... && (p an)`.\n\nSince: 4.03.0\n\n\narray.mli:191"} + }, { + "label": "copy", + "kind": 12, + "tags": [], + "detail": "array<'a> => array<'a>", + "documentation": {"kind": "markdown", "value": "`Array.copy a` returns a copy of `a`, that is, a fresh array containing the same elements as `a`.\n\n\n\n\narray.mli:107"} + }, { + "label": "iter2", + "kind": 12, + "tags": [], + "detail": "(('a, 'b) => unit, array<'a>, array<'b>) => unit", + "documentation": {"kind": "markdown", "value": "`Array.iter2 f a b` applies function `f` to all the elements of `a` and `b`. Raise `Invalid_argument` if the arrays are not the same size.\n\nSince: 4.03.0\n\n\narray.mli:174"} + }, { + "label": "to_list", + "kind": 12, + "tags": [], + "detail": "array<'a> => list<'a>", + "documentation": {"kind": "markdown", "value": "`Array.to_list a` returns the list of all the elements of `a`.\n\n\n\n\narray.mli:129"} + }, { + "label": "stable_sort", + "kind": 12, + "tags": [], + "detail": "(('a, 'a) => int, array<'a>) => unit", + "documentation": {"kind": "markdown", "value": "Same as sort, but the sorting algorithm is stable \\(i.e. elements that compare equal are kept in their original order\\) and not guaranteed to run in constant heap space.\n\nThe current implementation uses Merge Sort. It uses `n/2` words of heap space, where `n` is the length of the array. It is usually faster than the current implementation of sort.\n\n\n\n\narray.mli:243"} + }, { + "label": "iteri", + "kind": 12, + "tags": [], + "detail": "((int, 'a) => unit, array<'a>) => unit", + "documentation": {"kind": "markdown", "value": "Same as iter, but the function is applied with the index of the element as first argument, and the element itself as second argument.\n\n\n\n\narray.mli:145"} + }, { + "label": "memq", + "kind": 12, + "tags": [], + "detail": "('a, array<'a>) => bool", + "documentation": {"kind": "markdown", "value": "Same as mem, but uses physical equality instead of structural equality to compare array elements.\n\nSince: 4.03.0\n\n\narray.mli:208"} + }, { + "label": "map2", + "kind": 12, + "tags": [], + "detail": "(('a, 'b) => 'c, array<'a>, array<'b>) => array<'c>", + "documentation": {"kind": "markdown", "value": "`Array.map2 f a b` applies function `f` to all the elements of `a` and `b`, and builds an array with the results returned by `f`: `[| f a.(0) b.(0); ...; f a.(Array.length a - 1) b.(Array.length b - 1)|]`. Raise `Invalid_argument` if the arrays are not the same size.\n\nSince: 4.03.0\n\n\narray.mli:180"} + }, { + "label": "set", + "kind": 12, + "tags": [], + "detail": "(array<'a>, int, 'a) => unit", + "documentation": {"kind": "markdown", "value": "`Array.set a n x` modifies array `a` in place, replacing element number `n` with `x`. You can also write `a.(n) <- x` instead of `Array.set a n x`.\n\nRaise `Invalid_argument \"index out of bounds\"` if `n` is outside the range 0 to `Array.length a - 1`.\n\n\n\n\narray.mli:30"} + }, { + "label": "make", + "kind": 12, + "tags": [], + "detail": "(int, 'a) => array<'a>", + "documentation": {"kind": "markdown", "value": "`Array.make n x` returns a fresh array of length `n`, initialized with `x`. All the elements of this new array are initially physically equal to `x` \\(in the sense of the `==` predicate\\). Consequently, if `x` is mutable, it is shared among all elements of the array, and modifying `x` through one of the array entries will modify all other entries at the same time.\n\nRaise `Invalid_argument` if `n < 0` or `n > Sys.max_array_length`. If the value of `x` is a floating-point number, then the maximum size is only `Sys.max_array_length / 2`.\n\n\n\n\narray.mli:38"} + }, { + "label": "make_float", + "kind": 12, + "tags": [], + "detail": "int => array", + "documentation": {"kind": "markdown", "value": "Deprecated: `Array.make_float` is an alias for create_float.\n\n\n\n\n\n\narray.mli:60"} + }, { + "label": "fold_right", + "kind": 12, + "tags": [], + "detail": "(('b, 'a) => 'a, array<'b>, 'a) => 'a", + "documentation": {"kind": "markdown", "value": "`Array.fold_right f a x` computes `f a.(0) (f a.(1) ( ... (f a.(n-1) x) ...))`, where `n` is the length of the array `a`.\n\n\n\n\narray.mli:165"} + }, { + "label": "sort", + "kind": 12, + "tags": [], + "detail": "(('a, 'a) => int, array<'a>) => unit", + "documentation": {"kind": "markdown", "value": "Sort an array in increasing order according to a comparison function. The comparison function must return 0 if its arguments compare as equal, a positive integer if the first is greater, and a negative integer if the first is smaller \\(see below for a complete specification\\). For example, compare is a suitable comparison function, provided there are no floating-point NaN values in the data. After calling `Array.sort`, the array is sorted in place in increasing order. `Array.sort` is guaranteed to run in constant heap space and \\(at most\\) logarithmic stack space.\n\nThe current implementation uses Heap Sort. It runs in constant stack space.\n\nSpecification of the comparison function: Let `a` be the array and `cmp` the comparison function. The following must be true for all x, y, z in a :\n\n- `cmp x y` \\> 0 if and only if `cmp y x` < 0\n\n\n- if `cmp x y` \\>= 0 and `cmp y z` \\>= 0 then `cmp x z` \\>= 0\n\n\n\nWhen `Array.sort` returns, `a` contains the same elements as before, reordered in such a way that for all i and j valid indices of `a` :\n\n- `cmp a.(i) a.(j)` \\>= 0 if and only if i \\>= j\n\n\n\n\n\n\narray.mli:217"} + }, { + "label": "length", + "kind": 12, + "tags": [], + "detail": "array<'a> => int", + "documentation": {"kind": "markdown", "value": "Return the length \\(number of elements\\) of the given array.\n\n\n\n\narray.mli:18"} + }, { + "label": "sub", + "kind": 12, + "tags": [], + "detail": "(array<'a>, int, int) => array<'a>", + "documentation": {"kind": "markdown", "value": "`Array.sub a start len` returns a fresh array of length `len`, containing the elements number `start` to `start + len - 1` of array `a`.\n\nRaise `Invalid_argument \"Array.sub\"` if `start` and `len` do not designate a valid subarray of `a`; that is, if `start < 0`, or `len < 0`, or `start + len > Array.length a`.\n\n\n\n\narray.mli:98"} + }, { + "label": "of_list", + "kind": 12, + "tags": [], + "detail": "list<'a> => array<'a>", + "documentation": {"kind": "markdown", "value": "`Array.of_list l` returns a fresh array containing the elements of `l`.\n\n\n\n\narray.mli:132"} + }, { + "label": "iter", + "kind": 12, + "tags": [], + "detail": "('a => unit, array<'a>) => unit", + "documentation": {"kind": "markdown", "value": "`Array.iter f a` applies function `f` in turn to all the elements of `a`. It is equivalent to `f a.(0); f a.(1); ...; f a.(Array.length a - 1); ()`.\n\n\n\n\narray.mli:140"} + }, { + "label": "map", + "kind": 12, + "tags": [], + "detail": "('a => 'b, array<'a>) => array<'b>", + "documentation": {"kind": "markdown", "value": "`Array.map f a` applies function `f` to all the elements of `a`, and builds an array with the results returned by `f`: `[| f a.(0); f a.(1); ...; f a.(Array.length a - 1) |]`.\n\n\n\n\narray.mli:150"} + }, { + "label": "unsafe_get", + "kind": 12, + "tags": [], + "detail": "(array<'a>, int) => 'a", + "documentation": {"kind": "markdown", "value": "\narray.mli:264"} + }, { + "label": "make_matrix", + "kind": 12, + "tags": [], + "detail": "(int, int, 'a) => array>", + "documentation": {"kind": "markdown", "value": "`Array.make_matrix dimx dimy e` returns a two-dimensional array \\(an array of arrays\\) with first dimension `dimx` and second dimension `dimy`. All the elements of this new matrix are initially physically equal to `e`. The element \\(`x,y`\\) of a matrix `m` is accessed with the notation `m.(x).(y)`.\n\nRaise `Invalid_argument` if `dimx` or `dimy` is negative or greater than max_array_length. If the value of `e` is a floating-point number, then the maximum size is only `Sys.max_array_length / 2`.\n\n\n\n\narray.mli:74"} + }, { + "label": "mem", + "kind": 12, + "tags": [], + "detail": "('a, array<'a>) => bool", + "documentation": {"kind": "markdown", "value": "`mem a l` is true if and only if `a` is equal to an element of `l`.\n\nSince: 4.03.0\n\n\narray.mli:203"} + }, { + "label": "get", + "kind": 12, + "tags": [], + "detail": "(array<'a>, int) => 'a", + "documentation": {"kind": "markdown", "value": "`Array.get a n` returns the element number `n` of array `a`. The first element has number 0. The last element has number `Array.length a - 1`. You can also write `a.(n)` instead of `Array.get a n`.\n\nRaise `Invalid_argument \"index out of bounds\"` if `n` is outside the range 0 to `(Array.length a - 1)`.\n\n\n\n\narray.mli:21"} + }, { + "label": "append", + "kind": 12, + "tags": [], + "detail": "(array<'a>, array<'a>) => array<'a>", + "documentation": {"kind": "markdown", "value": "`Array.append v1 v2` returns a fresh array containing the concatenation of the arrays `v1` and `v2`.\n\n\n\n\narray.mli:91"} + }, { + "label": "unsafe_set", + "kind": 12, + "tags": [], + "detail": "(array<'a>, int, 'a) => unit", + "documentation": {"kind": "markdown", "value": "\narray.mli:265"} + }, { + "label": "create_matrix", + "kind": 12, + "tags": [], + "detail": "(int, int, 'a) => array>", + "documentation": {"kind": "markdown", "value": "Deprecated: `Array.create_matrix` is an alias for make_matrix.\n\n\n\n\n\n\narray.mli:87"} + }, { + "label": "create_float", + "kind": 12, + "tags": [], + "detail": "int => array", + "documentation": {"kind": "markdown", "value": "`Array.create_float n` returns a fresh float array of length `n`, with uninitialized data.\n\nSince: 4.03\n\n\narray.mli:55"} + }, { + "label": "create", + "kind": 12, + "tags": [], + "detail": "(int, 'a) => array<'a>", + "documentation": {"kind": "markdown", "value": "Deprecated: `Array.create` is an alias for make.\n\n\n\n\n\n\narray.mli:51"} + }, { + "label": "init", + "kind": 12, + "tags": [], + "detail": "(int, int => 'a) => array<'a>", + "documentation": {"kind": "markdown", "value": "`Array.init n f` returns a fresh array of length `n`, with element number `i` initialized to the result of `f i`. In other terms, `Array.init n f` tabulates the results of `f` applied to the integers `0` to `n-1`.\n\nRaise `Invalid_argument` if `n < 0` or `n > Sys.max_array_length`. If the return type of `f` is `float`, then the maximum size is only `Sys.max_array_length / 2`.\n\n\n\n\narray.mli:64"} + }, { + "label": "fast_sort", + "kind": 12, + "tags": [], + "detail": "(('a, 'a) => int, array<'a>) => unit", + "documentation": {"kind": "markdown", "value": "Same as sort or stable_sort, whichever is faster on typical input.\n\n\n\n\narray.mli:253"} + }, { + "label": "fill", + "kind": 12, + "tags": [], + "detail": "(array<'a>, int, int, 'a) => unit", + "documentation": {"kind": "markdown", "value": "`Array.fill a ofs len x` modifies the array `a` in place, storing `x` in elements number `ofs` to `ofs + len - 1`.\n\nRaise `Invalid_argument \"Array.fill\"` if `ofs` and `len` do not designate a valid subarray of `a`.\n\n\n\n\narray.mli:111"} + }, { + "label": "blit", + "kind": 12, + "tags": [], + "detail": "(array<'a>, int, array<'a>, int, int) => unit", + "documentation": {"kind": "markdown", "value": "`Array.blit v1 o1 v2 o2 len` copies `len` elements from array `v1`, starting at element number `o1`, to array `v2`, starting at element number `o2`. It works correctly even if `v1` and `v2` are the same array, and the source and destination chunks overlap.\n\nRaise `Invalid_argument \"Array.blit\"` if `o1` and `len` do not designate a valid subarray of `v1`, or if `o2` and `len` do not designate a valid subarray of `v2`.\n\n\n\n\narray.mli:118"} + }] +[{ + "label": "mapi", + "kind": 12, + "tags": [], + "detail": "((int, 'a) => 'b, array<'a>) => array<'b>", + "documentation": {"kind": "markdown", "value": "Same as map, but the function is applied to the index of the element as first argument, and the element itself as second argument.\n\n\n\n\narray.mli:155"} + }, { + "label": "memq", + "kind": 12, + "tags": [], + "detail": "('a, array<'a>) => bool", + "documentation": {"kind": "markdown", "value": "Same as mem, but uses physical equality instead of structural equality to compare array elements.\n\nSince: 4.03.0\n\n\narray.mli:208"} + }, { + "label": "map2", + "kind": 12, + "tags": [], + "detail": "(('a, 'b) => 'c, array<'a>, array<'b>) => array<'c>", + "documentation": {"kind": "markdown", "value": "`Array.map2 f a b` applies function `f` to all the elements of `a` and `b`, and builds an array with the results returned by `f`: `[| f a.(0) b.(0); ...; f a.(Array.length a - 1) b.(Array.length b - 1)|]`. Raise `Invalid_argument` if the arrays are not the same size.\n\nSince: 4.03.0\n\n\narray.mli:180"} + }, { + "label": "make", + "kind": 12, + "tags": [], + "detail": "(int, 'a) => array<'a>", + "documentation": {"kind": "markdown", "value": "`Array.make n x` returns a fresh array of length `n`, initialized with `x`. All the elements of this new array are initially physically equal to `x` \\(in the sense of the `==` predicate\\). Consequently, if `x` is mutable, it is shared among all elements of the array, and modifying `x` through one of the array entries will modify all other entries at the same time.\n\nRaise `Invalid_argument` if `n < 0` or `n > Sys.max_array_length`. If the value of `x` is a floating-point number, then the maximum size is only `Sys.max_array_length / 2`.\n\n\n\n\narray.mli:38"} + }, { + "label": "make_float", + "kind": 12, + "tags": [], + "detail": "int => array", + "documentation": {"kind": "markdown", "value": "Deprecated: `Array.make_float` is an alias for create_float.\n\n\n\n\n\n\narray.mli:60"} + }, { + "label": "map", + "kind": 12, + "tags": [], + "detail": "('a => 'b, array<'a>) => array<'b>", + "documentation": {"kind": "markdown", "value": "`Array.map f a` applies function `f` to all the elements of `a`, and builds an array with the results returned by `f`: `[| f a.(0); f a.(1); ...; f a.(Array.length a - 1) |]`.\n\n\n\n\narray.mli:150"} + }, { + "label": "make_matrix", + "kind": 12, + "tags": [], + "detail": "(int, int, 'a) => array>", + "documentation": {"kind": "markdown", "value": "`Array.make_matrix dimx dimy e` returns a two-dimensional array \\(an array of arrays\\) with first dimension `dimx` and second dimension `dimy`. All the elements of this new matrix are initially physically equal to `e`. The element \\(`x,y`\\) of a matrix `m` is accessed with the notation `m.(x).(y)`.\n\nRaise `Invalid_argument` if `dimx` or `dimy` is negative or greater than max_array_length. If the value of `e` is a floating-point number, then the maximum size is only `Sys.max_array_length / 2`.\n\n\n\n\narray.mli:74"} + }, { + "label": "mem", + "kind": 12, + "tags": [], + "detail": "('a, array<'a>) => bool", + "documentation": {"kind": "markdown", "value": "`mem a l` is true if and only if `a` is equal to an element of `l`.\n\nSince: 4.03.0\n\n\narray.mli:203"} + }] diff --git a/test/src/Definition.exp b/test/src/Definition.exp new file mode 100644 index 00000000..91f01010 --- /dev/null +++ b/test/src/Definition.exp @@ -0,0 +1 @@ +{"uri": "Definition.res", "range": "{"start": "{"line": "0", "character": "4"}", "end": "{"line": "0", "character": "6"}"}"} diff --git a/test/test.sh b/test/test.sh new file mode 100755 index 00000000..b39e96b5 --- /dev/null +++ b/test/test.sh @@ -0,0 +1,5 @@ +#!/bin/zsh + +../_build/install/default/bin/rescript-editor-support.exe test src/Definition.res >src/Definition.exp + +../_build/install/default/bin/rescript-editor-support.exe test src/Complete.res >src/Complete.exp From 93b95c56c892b13e906678d610021ed522080abb Mon Sep 17 00:00:00 2001 From: Cristiano Calcagno Date: Fri, 16 Apr 2021 04:49:15 +0200 Subject: [PATCH 2/7] Use expected folder. --- .../{Complete.exp => expected/Complete.res.txt} | 0 .../Definition.res.txt} | 0 test/src/expected/Hover.res.txt | 0 test/test.sh | 15 +++++++++++++-- 4 files changed, 13 insertions(+), 2 deletions(-) rename test/src/{Complete.exp => expected/Complete.res.txt} (100%) rename test/src/{Definition.exp => expected/Definition.res.txt} (100%) create mode 100644 test/src/expected/Hover.res.txt diff --git a/test/src/Complete.exp b/test/src/expected/Complete.res.txt similarity index 100% rename from test/src/Complete.exp rename to test/src/expected/Complete.res.txt diff --git a/test/src/Definition.exp b/test/src/expected/Definition.res.txt similarity index 100% rename from test/src/Definition.exp rename to test/src/expected/Definition.res.txt diff --git a/test/src/expected/Hover.res.txt b/test/src/expected/Hover.res.txt new file mode 100644 index 00000000..e69de29b diff --git a/test/test.sh b/test/test.sh index b39e96b5..ad4d906c 100755 --- a/test/test.sh +++ b/test/test.sh @@ -1,5 +1,16 @@ #!/bin/zsh -../_build/install/default/bin/rescript-editor-support.exe test src/Definition.res >src/Definition.exp +function exp { + echo "$(dirname $1)/expected/$(basename $1).txt" +} -../_build/install/default/bin/rescript-editor-support.exe test src/Complete.res >src/Complete.exp +taskCount=0 +function maybeWait { + let taskCount+=1 + # spawn in batch of 20 processes + [[ $((taskCount % 20)) = 0 ]] && wait +} + +for file in src/**/*.res; do + ../_build/install/default/bin/rescript-editor-support.exe test $file &> $(exp $file) & maybeWait +done From 500ec59097227a189237c670966f6b0bfe9a76e7 Mon Sep 17 00:00:00 2001 From: Cristiano Calcagno Date: Fri, 16 Apr 2021 04:51:50 +0200 Subject: [PATCH 3/7] Build before test. --- test/package-lock.json | 29 +---------------------------- test/test.sh | 1 + 2 files changed, 2 insertions(+), 28 deletions(-) diff --git a/test/package-lock.json b/test/package-lock.json index 50fe3745..979580da 100644 --- a/test/package-lock.json +++ b/test/package-lock.json @@ -1,33 +1,6 @@ { - "name": "test", - "lockfileVersion": 2, "requires": true, - "packages": { - "": { - "dependencies": { - "reason-react": "^0.9.1", - "rescript": "9.1.0" - } - }, - "node_modules/reason-react": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/reason-react/-/reason-react-0.9.1.tgz", - "integrity": "sha512-nlH0O2TDy9KzOLOW+vlEQk4ExHOeciyzFdoLcsmmiit6hx6H5+CVDrwJ+8aiaLT/kqK5xFOjy4PS7PftWz4plA==" - }, - "node_modules/rescript": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/rescript/-/rescript-9.1.0.tgz", - "integrity": "sha512-KHBM5SRk4aauUzeDCT3EB5kjly36Olkv+8jmurVJxJAa6L7Sz6AJXzmgZA0cU65/nvdi3InhpNSuxTsDlPj/3A==", - "hasInstallScript": true, - "bin": { - "bsb": "bsb", - "bsc": "bsc", - "bsrefmt": "bsrefmt", - "bstracing": "lib/bstracing", - "rescript": "rescript" - } - } - }, + "lockfileVersion": 1, "dependencies": { "reason-react": { "version": "0.9.1", diff --git a/test/test.sh b/test/test.sh index ad4d906c..1e7703c1 100755 --- a/test/test.sh +++ b/test/test.sh @@ -11,6 +11,7 @@ function maybeWait { [[ $((taskCount % 20)) = 0 ]] && wait } +./node_modules/.bin/rescript build for file in src/**/*.res; do ../_build/install/default/bin/rescript-editor-support.exe test $file &> $(exp $file) & maybeWait done From ee7db7334a3c6bf7121f636af661882858178c49 Mon Sep 17 00:00:00 2001 From: Cristiano Calcagno Date: Fri, 16 Apr 2021 04:55:28 +0200 Subject: [PATCH 4/7] Add test command to package.json. --- package.json | 1 + test/test.sh | 9 +-------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index d40c2cb3..fdb6f0e8 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "name": "rescript-editor-support", "version": "1.0.0", "scripts": { + "test": "cd test && ./test.sh", "dce": "dune build @check @all && node_modules/.bin/reanalyze -dce-cmt _build -suppress src/vendor" }, "keywords": [ diff --git a/test/test.sh b/test/test.sh index 1e7703c1..2b97f919 100755 --- a/test/test.sh +++ b/test/test.sh @@ -4,14 +4,7 @@ function exp { echo "$(dirname $1)/expected/$(basename $1).txt" } -taskCount=0 -function maybeWait { - let taskCount+=1 - # spawn in batch of 20 processes - [[ $((taskCount % 20)) = 0 ]] && wait -} - ./node_modules/.bin/rescript build for file in src/**/*.res; do - ../_build/install/default/bin/rescript-editor-support.exe test $file &> $(exp $file) & maybeWait + ../_build/install/default/bin/rescript-editor-support.exe test $file &> $(exp $file) done From 5920d36a82291fe73b6d02374c09bf9bc21e7464 Mon Sep 17 00:00:00 2001 From: Cristiano Calcagno Date: Fri, 16 Apr 2021 04:56:33 +0200 Subject: [PATCH 5/7] dune: don't try to build in test/ --- dune | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dune b/dune index 6260b2e2..9ed2ee1b 100644 --- a/dune +++ b/dune @@ -1,4 +1,4 @@ -(dirs :standard \ examples) +(dirs :standard \ examples test) (env (dev (flags (:standard -warn-error -A)))) \ No newline at end of file From cc4cf24b228468f058e7d23526297062afb0c530 Mon Sep 17 00:00:00 2001 From: Cristiano Calcagno Date: Fri, 16 Apr 2021 05:13:04 +0200 Subject: [PATCH 6/7] Added JSX autocomplete test. --- test/bsconfig.json | 5 +++-- test/src/Jsx.res | 12 ++++++++++++ test/src/expected/Jsx.res.txt | 21 +++++++++++++++++++++ 3 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 test/src/Jsx.res create mode 100644 test/src/expected/Jsx.res.txt diff --git a/test/bsconfig.json b/test/bsconfig.json index 0c9eafc6..a65991b9 100644 --- a/test/bsconfig.json +++ b/test/bsconfig.json @@ -1,5 +1,6 @@ { "name": "test", "sources": "src", - "bs-dependencies": ["reason-react"] -} \ No newline at end of file + "bs-dependencies": ["reason-react"], + "reason": { "react-jsx": 3 } +} diff --git a/test/src/Jsx.res b/test/src/Jsx.res new file mode 100644 index 00000000..d28ce76e --- /dev/null +++ b/test/src/Jsx.res @@ -0,0 +1,12 @@ +module M = { + @react.component + let make = (~first, ~fun="", ~second="") => React.string(first ++ fun++ second) +} + +let d = +// ^def + +//^com ", + "documentation": {"kind": "markdown", "value": "\nJsx.res:11"} + }] From 4f95b7dd568f1c69b1a88350fa3ab1b103de27c7 Mon Sep 17 00:00:00 2001 From: Cristiano Calcagno Date: Fri, 16 Apr 2021 05:17:57 +0200 Subject: [PATCH 7/7] Add a hover test. --- src/EditorSupportCommands.ml | 1 + test/expected.txt | 334 -------------------------------- test/src/Hover.res | 2 + test/src/expected/Hover.res.txt | 1 + 4 files changed, 4 insertions(+), 334 deletions(-) delete mode 100644 test/expected.txt diff --git a/src/EditorSupportCommands.ml b/src/EditorSupportCommands.ml index 4e1d801b..1d41c507 100644 --- a/src/EditorSupportCommands.ml +++ b/src/EditorSupportCommands.ml @@ -182,6 +182,7 @@ let test ~path = if mlen >= 3 then match String.sub rest 0 3 with | "def" -> definition ~path ~line ~col + | "hov" -> hover ~path ~line ~col | "com" -> let currentFile, cout = Filename.open_temp_file "def" "txt" in lines diff --git a/test/expected.txt b/test/expected.txt deleted file mode 100644 index e94ae057..00000000 --- a/test/expected.txt +++ /dev/null @@ -1,334 +0,0 @@ -{"uri": "Definition.res", "range": "{"start": "{"line": "0", "character": "4"}", "end": "{"line": "0", "character": "6"}"}"} -[{ - "label": "mapReverse", - "kind": 12, - "tags": [], - "detail": "(t<'a>, 'a => 'b) => t<'b>", - "documentation": {"kind": "markdown", "value": "`mapReverse xs f`\n\nEquivalent to `reverse (map xs f)`\n\n```ml\nmapReverse [3;4;5] (fun x -> x * x) = [25;16;9];;\n```\n\n\n\nbelt_List.mli:299"} - }, { - "label": "makeBy", - "kind": 12, - "tags": [], - "detail": "(int, int => 'a) => t<'a>", - "documentation": {"kind": "markdown", "value": "`makeBy n f`\n\n- return a list of length `n` with element `i` initialized with `f i`\n\n\n- return the empty list if `n` is negative\n\n\n\n```ml\nmakeBy 5 (fun i -> i) = [0;1;2;3;4];;\nmakeBy 5 (fun i -> i * i) = [0;1;4;9;16];;\n```\n\n\n\nbelt_List.mli:127"} - }, { - "label": "make", - "kind": 12, - "tags": [], - "detail": "(int, 'a) => t<'a>", - "documentation": {"kind": "markdown", "value": "`make n v`\n\n- return a list of length `n` with each element filled with value `v`\n\n\n- return the empty list if `n` is negative\n\n\n\n```ml\nmake 3 1 = [1;1;1]\n```\n\n\n\nbelt_List.mli:115"} - }, { - "label": "mapReverse2U", - "kind": 12, - "tags": [], - "detail": "(t<'a>, t<'b>, (. 'a, 'b) => 'c) => t<'c>", - "documentation": {"kind": "markdown", "value": "\nbelt_List.mli:391"} - }, { - "label": "map", - "kind": 12, - "tags": [], - "detail": "(t<'a>, 'a => 'b) => t<'b>", - "documentation": {"kind": "markdown", "value": "`map xs f`\n\nreturn the list obtained by applying `f` to each element of `xs`\n\n```ml\nmap [1;2] (fun x-> x + 1) = [3;4]\n```\n\n\n\nbelt_List.mli:222"} - }, { - "label": "mapWithIndexU", - "kind": 12, - "tags": [], - "detail": "(t<'a>, (. int, 'a) => 'b) => t<'b>", - "documentation": {"kind": "markdown", "value": "\nbelt_List.mli:258"} - }, { - "label": "mapU", - "kind": 12, - "tags": [], - "detail": "(t<'a>, (. 'a) => 'b) => t<'b>", - "documentation": {"kind": "markdown", "value": "\nbelt_List.mli:221"} - }, { - "label": "makeByU", - "kind": 12, - "tags": [], - "detail": "(int, (. int) => 'a) => t<'a>", - "documentation": {"kind": "markdown", "value": "\nbelt_List.mli:126"} - }, { - "label": "mapReverse2", - "kind": 12, - "tags": [], - "detail": "(t<'a>, t<'b>, ('a, 'b) => 'c) => t<'c>", - "documentation": {"kind": "markdown", "value": "`mapReverse2 xs ys f`\n\nequivalent to `reverse (zipBy xs ys f)`\n\n```ml\nmapReverse2 [1;2;3] [1;2] (+) = [4;2]\n```\n\n\n\nbelt_List.mli:392"} - }, { - "label": "mapWithIndex", - "kind": 12, - "tags": [], - "detail": "(t<'a>, (int, 'a) => 'b) => t<'b>", - "documentation": {"kind": "markdown", "value": "`mapWithIndex xs f` applies `f` to each element of `xs`. Function `f` takes two arguments: the index starting from 0 and the element from `xs`.\n\n```ml\nmapWithIndex [1;2;3] (fun i x -> i + x) =\n[0 + 1; 1 + 2; 2 + 3 ]\n```\n\n\n\nbelt_List.mli:259"} - }, { - "label": "mapReverseU", - "kind": 12, - "tags": [], - "detail": "(t<'a>, (. 'a) => 'b) => t<'b>", - "documentation": {"kind": "markdown", "value": "\nbelt_List.mli:298"} - }] -[{ - "label": "Floatarray", - "kind": 9, - "tags": [], - "detail": "module", - "documentation": {"kind": "markdown", "value": "\narray.mli:267"} - }, { - "label": "fold_left", - "kind": 12, - "tags": [], - "detail": "(('a, 'b) => 'a, 'a, array<'b>) => 'a", - "documentation": {"kind": "markdown", "value": "`Array.fold_left f x a` computes `f (... (f (f x a.(0)) a.(1)) ...) a.(n-1)`, where `n` is the length of the array `a`.\n\n\n\n\narray.mli:160"} - }, { - "label": "concat", - "kind": 12, - "tags": [], - "detail": "list> => array<'a>", - "documentation": {"kind": "markdown", "value": "Same as append, but concatenates a list of arrays.\n\n\n\n\narray.mli:95"} - }, { - "label": "mapi", - "kind": 12, - "tags": [], - "detail": "((int, 'a) => 'b, array<'a>) => array<'b>", - "documentation": {"kind": "markdown", "value": "Same as map, but the function is applied to the index of the element as first argument, and the element itself as second argument.\n\n\n\n\narray.mli:155"} - }, { - "label": "exists", - "kind": 12, - "tags": [], - "detail": "('a => bool, array<'a>) => bool", - "documentation": {"kind": "markdown", "value": "`Array.exists p [|a1; ...; an|]` checks if at least one element of the array satisfies the predicate `p`. That is, it returns `(p a1) || (p a2) || ... || (p an)`.\n\nSince: 4.03.0\n\n\narray.mli:197"} - }, { - "label": "for_all", - "kind": 12, - "tags": [], - "detail": "('a => bool, array<'a>) => bool", - "documentation": {"kind": "markdown", "value": "`Array.for_all p [|a1; ...; an|]` checks if all elements of the array satisfy the predicate `p`. That is, it returns `(p a1) && (p a2) && ... && (p an)`.\n\nSince: 4.03.0\n\n\narray.mli:191"} - }, { - "label": "copy", - "kind": 12, - "tags": [], - "detail": "array<'a> => array<'a>", - "documentation": {"kind": "markdown", "value": "`Array.copy a` returns a copy of `a`, that is, a fresh array containing the same elements as `a`.\n\n\n\n\narray.mli:107"} - }, { - "label": "iter2", - "kind": 12, - "tags": [], - "detail": "(('a, 'b) => unit, array<'a>, array<'b>) => unit", - "documentation": {"kind": "markdown", "value": "`Array.iter2 f a b` applies function `f` to all the elements of `a` and `b`. Raise `Invalid_argument` if the arrays are not the same size.\n\nSince: 4.03.0\n\n\narray.mli:174"} - }, { - "label": "to_list", - "kind": 12, - "tags": [], - "detail": "array<'a> => list<'a>", - "documentation": {"kind": "markdown", "value": "`Array.to_list a` returns the list of all the elements of `a`.\n\n\n\n\narray.mli:129"} - }, { - "label": "stable_sort", - "kind": 12, - "tags": [], - "detail": "(('a, 'a) => int, array<'a>) => unit", - "documentation": {"kind": "markdown", "value": "Same as sort, but the sorting algorithm is stable \\(i.e. elements that compare equal are kept in their original order\\) and not guaranteed to run in constant heap space.\n\nThe current implementation uses Merge Sort. It uses `n/2` words of heap space, where `n` is the length of the array. It is usually faster than the current implementation of sort.\n\n\n\n\narray.mli:243"} - }, { - "label": "iteri", - "kind": 12, - "tags": [], - "detail": "((int, 'a) => unit, array<'a>) => unit", - "documentation": {"kind": "markdown", "value": "Same as iter, but the function is applied with the index of the element as first argument, and the element itself as second argument.\n\n\n\n\narray.mli:145"} - }, { - "label": "memq", - "kind": 12, - "tags": [], - "detail": "('a, array<'a>) => bool", - "documentation": {"kind": "markdown", "value": "Same as mem, but uses physical equality instead of structural equality to compare array elements.\n\nSince: 4.03.0\n\n\narray.mli:208"} - }, { - "label": "map2", - "kind": 12, - "tags": [], - "detail": "(('a, 'b) => 'c, array<'a>, array<'b>) => array<'c>", - "documentation": {"kind": "markdown", "value": "`Array.map2 f a b` applies function `f` to all the elements of `a` and `b`, and builds an array with the results returned by `f`: `[| f a.(0) b.(0); ...; f a.(Array.length a - 1) b.(Array.length b - 1)|]`. Raise `Invalid_argument` if the arrays are not the same size.\n\nSince: 4.03.0\n\n\narray.mli:180"} - }, { - "label": "set", - "kind": 12, - "tags": [], - "detail": "(array<'a>, int, 'a) => unit", - "documentation": {"kind": "markdown", "value": "`Array.set a n x` modifies array `a` in place, replacing element number `n` with `x`. You can also write `a.(n) <- x` instead of `Array.set a n x`.\n\nRaise `Invalid_argument \"index out of bounds\"` if `n` is outside the range 0 to `Array.length a - 1`.\n\n\n\n\narray.mli:30"} - }, { - "label": "make", - "kind": 12, - "tags": [], - "detail": "(int, 'a) => array<'a>", - "documentation": {"kind": "markdown", "value": "`Array.make n x` returns a fresh array of length `n`, initialized with `x`. All the elements of this new array are initially physically equal to `x` \\(in the sense of the `==` predicate\\). Consequently, if `x` is mutable, it is shared among all elements of the array, and modifying `x` through one of the array entries will modify all other entries at the same time.\n\nRaise `Invalid_argument` if `n < 0` or `n > Sys.max_array_length`. If the value of `x` is a floating-point number, then the maximum size is only `Sys.max_array_length / 2`.\n\n\n\n\narray.mli:38"} - }, { - "label": "make_float", - "kind": 12, - "tags": [], - "detail": "int => array", - "documentation": {"kind": "markdown", "value": "Deprecated: `Array.make_float` is an alias for create_float.\n\n\n\n\n\n\narray.mli:60"} - }, { - "label": "fold_right", - "kind": 12, - "tags": [], - "detail": "(('b, 'a) => 'a, array<'b>, 'a) => 'a", - "documentation": {"kind": "markdown", "value": "`Array.fold_right f a x` computes `f a.(0) (f a.(1) ( ... (f a.(n-1) x) ...))`, where `n` is the length of the array `a`.\n\n\n\n\narray.mli:165"} - }, { - "label": "sort", - "kind": 12, - "tags": [], - "detail": "(('a, 'a) => int, array<'a>) => unit", - "documentation": {"kind": "markdown", "value": "Sort an array in increasing order according to a comparison function. The comparison function must return 0 if its arguments compare as equal, a positive integer if the first is greater, and a negative integer if the first is smaller \\(see below for a complete specification\\). For example, compare is a suitable comparison function, provided there are no floating-point NaN values in the data. After calling `Array.sort`, the array is sorted in place in increasing order. `Array.sort` is guaranteed to run in constant heap space and \\(at most\\) logarithmic stack space.\n\nThe current implementation uses Heap Sort. It runs in constant stack space.\n\nSpecification of the comparison function: Let `a` be the array and `cmp` the comparison function. The following must be true for all x, y, z in a :\n\n- `cmp x y` \\> 0 if and only if `cmp y x` < 0\n\n\n- if `cmp x y` \\>= 0 and `cmp y z` \\>= 0 then `cmp x z` \\>= 0\n\n\n\nWhen `Array.sort` returns, `a` contains the same elements as before, reordered in such a way that for all i and j valid indices of `a` :\n\n- `cmp a.(i) a.(j)` \\>= 0 if and only if i \\>= j\n\n\n\n\n\n\narray.mli:217"} - }, { - "label": "length", - "kind": 12, - "tags": [], - "detail": "array<'a> => int", - "documentation": {"kind": "markdown", "value": "Return the length \\(number of elements\\) of the given array.\n\n\n\n\narray.mli:18"} - }, { - "label": "sub", - "kind": 12, - "tags": [], - "detail": "(array<'a>, int, int) => array<'a>", - "documentation": {"kind": "markdown", "value": "`Array.sub a start len` returns a fresh array of length `len`, containing the elements number `start` to `start + len - 1` of array `a`.\n\nRaise `Invalid_argument \"Array.sub\"` if `start` and `len` do not designate a valid subarray of `a`; that is, if `start < 0`, or `len < 0`, or `start + len > Array.length a`.\n\n\n\n\narray.mli:98"} - }, { - "label": "of_list", - "kind": 12, - "tags": [], - "detail": "list<'a> => array<'a>", - "documentation": {"kind": "markdown", "value": "`Array.of_list l` returns a fresh array containing the elements of `l`.\n\n\n\n\narray.mli:132"} - }, { - "label": "iter", - "kind": 12, - "tags": [], - "detail": "('a => unit, array<'a>) => unit", - "documentation": {"kind": "markdown", "value": "`Array.iter f a` applies function `f` in turn to all the elements of `a`. It is equivalent to `f a.(0); f a.(1); ...; f a.(Array.length a - 1); ()`.\n\n\n\n\narray.mli:140"} - }, { - "label": "map", - "kind": 12, - "tags": [], - "detail": "('a => 'b, array<'a>) => array<'b>", - "documentation": {"kind": "markdown", "value": "`Array.map f a` applies function `f` to all the elements of `a`, and builds an array with the results returned by `f`: `[| f a.(0); f a.(1); ...; f a.(Array.length a - 1) |]`.\n\n\n\n\narray.mli:150"} - }, { - "label": "unsafe_get", - "kind": 12, - "tags": [], - "detail": "(array<'a>, int) => 'a", - "documentation": {"kind": "markdown", "value": "\narray.mli:264"} - }, { - "label": "make_matrix", - "kind": 12, - "tags": [], - "detail": "(int, int, 'a) => array>", - "documentation": {"kind": "markdown", "value": "`Array.make_matrix dimx dimy e` returns a two-dimensional array \\(an array of arrays\\) with first dimension `dimx` and second dimension `dimy`. All the elements of this new matrix are initially physically equal to `e`. The element \\(`x,y`\\) of a matrix `m` is accessed with the notation `m.(x).(y)`.\n\nRaise `Invalid_argument` if `dimx` or `dimy` is negative or greater than max_array_length. If the value of `e` is a floating-point number, then the maximum size is only `Sys.max_array_length / 2`.\n\n\n\n\narray.mli:74"} - }, { - "label": "mem", - "kind": 12, - "tags": [], - "detail": "('a, array<'a>) => bool", - "documentation": {"kind": "markdown", "value": "`mem a l` is true if and only if `a` is equal to an element of `l`.\n\nSince: 4.03.0\n\n\narray.mli:203"} - }, { - "label": "get", - "kind": 12, - "tags": [], - "detail": "(array<'a>, int) => 'a", - "documentation": {"kind": "markdown", "value": "`Array.get a n` returns the element number `n` of array `a`. The first element has number 0. The last element has number `Array.length a - 1`. You can also write `a.(n)` instead of `Array.get a n`.\n\nRaise `Invalid_argument \"index out of bounds\"` if `n` is outside the range 0 to `(Array.length a - 1)`.\n\n\n\n\narray.mli:21"} - }, { - "label": "append", - "kind": 12, - "tags": [], - "detail": "(array<'a>, array<'a>) => array<'a>", - "documentation": {"kind": "markdown", "value": "`Array.append v1 v2` returns a fresh array containing the concatenation of the arrays `v1` and `v2`.\n\n\n\n\narray.mli:91"} - }, { - "label": "unsafe_set", - "kind": 12, - "tags": [], - "detail": "(array<'a>, int, 'a) => unit", - "documentation": {"kind": "markdown", "value": "\narray.mli:265"} - }, { - "label": "create_matrix", - "kind": 12, - "tags": [], - "detail": "(int, int, 'a) => array>", - "documentation": {"kind": "markdown", "value": "Deprecated: `Array.create_matrix` is an alias for make_matrix.\n\n\n\n\n\n\narray.mli:87"} - }, { - "label": "create_float", - "kind": 12, - "tags": [], - "detail": "int => array", - "documentation": {"kind": "markdown", "value": "`Array.create_float n` returns a fresh float array of length `n`, with uninitialized data.\n\nSince: 4.03\n\n\narray.mli:55"} - }, { - "label": "create", - "kind": 12, - "tags": [], - "detail": "(int, 'a) => array<'a>", - "documentation": {"kind": "markdown", "value": "Deprecated: `Array.create` is an alias for make.\n\n\n\n\n\n\narray.mli:51"} - }, { - "label": "init", - "kind": 12, - "tags": [], - "detail": "(int, int => 'a) => array<'a>", - "documentation": {"kind": "markdown", "value": "`Array.init n f` returns a fresh array of length `n`, with element number `i` initialized to the result of `f i`. In other terms, `Array.init n f` tabulates the results of `f` applied to the integers `0` to `n-1`.\n\nRaise `Invalid_argument` if `n < 0` or `n > Sys.max_array_length`. If the return type of `f` is `float`, then the maximum size is only `Sys.max_array_length / 2`.\n\n\n\n\narray.mli:64"} - }, { - "label": "fast_sort", - "kind": 12, - "tags": [], - "detail": "(('a, 'a) => int, array<'a>) => unit", - "documentation": {"kind": "markdown", "value": "Same as sort or stable_sort, whichever is faster on typical input.\n\n\n\n\narray.mli:253"} - }, { - "label": "fill", - "kind": 12, - "tags": [], - "detail": "(array<'a>, int, int, 'a) => unit", - "documentation": {"kind": "markdown", "value": "`Array.fill a ofs len x` modifies the array `a` in place, storing `x` in elements number `ofs` to `ofs + len - 1`.\n\nRaise `Invalid_argument \"Array.fill\"` if `ofs` and `len` do not designate a valid subarray of `a`.\n\n\n\n\narray.mli:111"} - }, { - "label": "blit", - "kind": 12, - "tags": [], - "detail": "(array<'a>, int, array<'a>, int, int) => unit", - "documentation": {"kind": "markdown", "value": "`Array.blit v1 o1 v2 o2 len` copies `len` elements from array `v1`, starting at element number `o1`, to array `v2`, starting at element number `o2`. It works correctly even if `v1` and `v2` are the same array, and the source and destination chunks overlap.\n\nRaise `Invalid_argument \"Array.blit\"` if `o1` and `len` do not designate a valid subarray of `v1`, or if `o2` and `len` do not designate a valid subarray of `v2`.\n\n\n\n\narray.mli:118"} - }] -[{ - "label": "mapi", - "kind": 12, - "tags": [], - "detail": "((int, 'a) => 'b, array<'a>) => array<'b>", - "documentation": {"kind": "markdown", "value": "Same as map, but the function is applied to the index of the element as first argument, and the element itself as second argument.\n\n\n\n\narray.mli:155"} - }, { - "label": "memq", - "kind": 12, - "tags": [], - "detail": "('a, array<'a>) => bool", - "documentation": {"kind": "markdown", "value": "Same as mem, but uses physical equality instead of structural equality to compare array elements.\n\nSince: 4.03.0\n\n\narray.mli:208"} - }, { - "label": "map2", - "kind": 12, - "tags": [], - "detail": "(('a, 'b) => 'c, array<'a>, array<'b>) => array<'c>", - "documentation": {"kind": "markdown", "value": "`Array.map2 f a b` applies function `f` to all the elements of `a` and `b`, and builds an array with the results returned by `f`: `[| f a.(0) b.(0); ...; f a.(Array.length a - 1) b.(Array.length b - 1)|]`. Raise `Invalid_argument` if the arrays are not the same size.\n\nSince: 4.03.0\n\n\narray.mli:180"} - }, { - "label": "make", - "kind": 12, - "tags": [], - "detail": "(int, 'a) => array<'a>", - "documentation": {"kind": "markdown", "value": "`Array.make n x` returns a fresh array of length `n`, initialized with `x`. All the elements of this new array are initially physically equal to `x` \\(in the sense of the `==` predicate\\). Consequently, if `x` is mutable, it is shared among all elements of the array, and modifying `x` through one of the array entries will modify all other entries at the same time.\n\nRaise `Invalid_argument` if `n < 0` or `n > Sys.max_array_length`. If the value of `x` is a floating-point number, then the maximum size is only `Sys.max_array_length / 2`.\n\n\n\n\narray.mli:38"} - }, { - "label": "make_float", - "kind": 12, - "tags": [], - "detail": "int => array", - "documentation": {"kind": "markdown", "value": "Deprecated: `Array.make_float` is an alias for create_float.\n\n\n\n\n\n\narray.mli:60"} - }, { - "label": "map", - "kind": 12, - "tags": [], - "detail": "('a => 'b, array<'a>) => array<'b>", - "documentation": {"kind": "markdown", "value": "`Array.map f a` applies function `f` to all the elements of `a`, and builds an array with the results returned by `f`: `[| f a.(0); f a.(1); ...; f a.(Array.length a - 1) |]`.\n\n\n\n\narray.mli:150"} - }, { - "label": "make_matrix", - "kind": 12, - "tags": [], - "detail": "(int, int, 'a) => array>", - "documentation": {"kind": "markdown", "value": "`Array.make_matrix dimx dimy e` returns a two-dimensional array \\(an array of arrays\\) with first dimension `dimx` and second dimension `dimy`. All the elements of this new matrix are initially physically equal to `e`. The element \\(`x,y`\\) of a matrix `m` is accessed with the notation `m.(x).(y)`.\n\nRaise `Invalid_argument` if `dimx` or `dimy` is negative or greater than max_array_length. If the value of `e` is a floating-point number, then the maximum size is only `Sys.max_array_length / 2`.\n\n\n\n\narray.mli:74"} - }, { - "label": "mem", - "kind": 12, - "tags": [], - "detail": "('a, array<'a>) => bool", - "documentation": {"kind": "markdown", "value": "`mem a l` is true if and only if `a` is equal to an element of `l`.\n\nSince: 4.03.0\n\n\narray.mli:203"} - }] diff --git a/test/src/Hover.res b/test/src/Hover.res index e69de29b..447cf5d8 100644 --- a/test/src/Hover.res +++ b/test/src/Hover.res @@ -0,0 +1,2 @@ +let abc = 22 + 34 +// ^hov diff --git a/test/src/expected/Hover.res.txt b/test/src/expected/Hover.res.txt index e69de29b..f524e45a 100644 --- a/test/src/expected/Hover.res.txt +++ b/test/src/expected/Hover.res.txt @@ -0,0 +1 @@ +{"contents": "```rescript\nint\n```"}