Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aspeddro committed Apr 22, 2024
1 parent 1d7dfb7 commit 3541fb1
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 21 deletions.
10 changes: 5 additions & 5 deletions analysis/src/Hover.ml
Original file line number Diff line number Diff line change
Expand Up @@ -237,12 +237,12 @@ let newHover ~full:{file; package} ~supportsMarkdownLinks locItem =
match References.definedForLoc ~file ~package locKind with
| None ->
let typeString, docstring = t |> fromType ~docstring:[] in
docstring @ [typeString]
typeString :: docstring
| Some (docstring, res) -> (
match res with
| `Declared ->
let typeString, docstring = t |> fromType ~docstring in
docstring @ [typeString]
typeString :: docstring
| `Constructor {cname = {txt}; args; docstring} ->
let typeString, docstring = t |> fromType ~docstring in
let argsString =
Expand All @@ -253,9 +253,9 @@ let newHover ~full:{file; package} ~supportsMarkdownLinks locItem =
|> List.map (fun (t, _) -> Shared.typeToString t)
|> String.concat ", " |> Printf.sprintf "(%s)"
in
(Markdown.codeBlock (txt ^ argsString) :: docstring) @ [typeString]
typeString :: Markdown.codeBlock (txt ^ argsString) :: docstring
| `Field ->
let typeString, docstring = t |> fromType ~docstring in
docstring @ [typeString])
typeString :: docstring)
in
Some (String.concat "\n\n" parts)
Some (String.concat "\n" parts)
2 changes: 1 addition & 1 deletion analysis/tests/src/expected/CompletionResolve.res.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Completion resolve: Belt_Array
"\nUtilities for `Array` functions.\n\n### Note about index syntax\n\nCode like `arr[0]` does *not* compile to JavaScript `arr[0]`. Reason transforms\nthe `[]` index syntax into a function: `Array.get(arr, 0)`. By default, this\nuses the default standard library's `Array.get` function, which may raise an\nexception if the index isn't found. If you `open Belt`, it will use the\n`Belt.Array.get` function which returns options instead of raising exceptions. \n[See this for more information](../belt.mdx#array-access-runtime-safety).\n"
"\nUtililites for `Array` functions.\n\n### Note about index syntax\n\nCode like `arr[0]` does *not* compile to JavaScript `arr[0]`. Reason transforms\nthe `[]` index syntax into a function: `Array.get(arr, 0)`. By default, this\nuses the default standard library's `Array.get` function, which may raise an\nexception if the index isn't found. If you `open Belt`, it will use the\n`Belt.Array.get` function which returns options instead of raising exceptions. \n[See this for more information](../belt.mdx#array-access-runtime-safety).\n"

Completion resolve: ModuleStuff
" This is a top level module doc. "
Expand Down
2 changes: 1 addition & 1 deletion analysis/tests/src/expected/Definition.res.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Definition src/Definition.res 10:23
{"uri": "Definition.res", "range": {"start": {"line": 6, "character": 7}, "end": {"line": 6, "character": 13}}}

Hover src/Definition.res 14:14
{"contents": {"kind": "markdown", "value": " [List.map f [a1; ...; an]] applies function [f] to [a1, ..., an],\n and builds the list [[f a1; ...; f an]]\n with the results returned by [f]. Not tail-recursive. \n\n```rescript\n('a => 'b, list<'a>) => list<'b>\n```"}}
{"contents": {"kind": "markdown", "value": "```rescript\n('a => 'b, list<'a>) => list<'b>\n```\n [List.map f [a1; ...; an]] applies function [f] to [a1, ..., an],\n and builds the list [[f a1; ...; f an]]\n with the results returned by [f]. Not tail-recursive. "}}

Hover src/Definition.res 18:14
{"contents": {"kind": "markdown", "value": "```rescript\n(list<'a>, 'a => 'b) => list<'b>\n```"}}
Expand Down
10 changes: 5 additions & 5 deletions analysis/tests/src/expected/DocComments.res.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
Hover src/DocComments.res 9:9
{"contents": {"kind": "markdown", "value": " Doc comment with a triple-backquote example\\n \\n ```res example\\n let a = 10\\n /*\\n * stuff\\n */\\n ```\\n\n\n```rescript\nint\n```"}}
{"contents": {"kind": "markdown", "value": "```rescript\nint\n```\n Doc comment with a triple-backquote example\\n \\n ```res example\\n let a = 10\\n /*\\n * stuff\\n */\\n ```\\n"}}

Hover src/DocComments.res 22:6
{"contents": {"kind": "markdown", "value": "\n Doc comment with a triple-backquote example\n \n ```res example\n let a = 10\n /*\n * stuff\n */\n ```\n\n\n```rescript\nint\n```"}}
{"contents": {"kind": "markdown", "value": "```rescript\nint\n```\n\n Doc comment with a triple-backquote example\n \n ```res example\n let a = 10\n /*\n * stuff\n */\n ```\n"}}

Hover src/DocComments.res 33:9
{"contents": {"kind": "markdown", "value": " Doc comment with a triple-backquote example\\n \\n ```res example\\n let a = 10\\n let b = 20\\n ```\\n\n\n```rescript\nint\n```"}}
{"contents": {"kind": "markdown", "value": "```rescript\nint\n```\n Doc comment with a triple-backquote example\\n \\n ```res example\\n let a = 10\\n let b = 20\\n ```\\n"}}

Hover src/DocComments.res 44:6
{"contents": {"kind": "markdown", "value": "\n Doc comment with a triple-backquote example\n \n ```res example\n let a = 10\n let b = 20\n ```\n\n\n```rescript\nint\n```"}}
{"contents": {"kind": "markdown", "value": "```rescript\nint\n```\n\n Doc comment with a triple-backquote example\n \n ```res example\n let a = 10\n let b = 20\n ```\n"}}

Hover src/DocComments.res 48:5
{"contents": {"kind": "markdown", "value": "New doc comment format\n\n```rescript\nint\n```"}}
{"contents": {"kind": "markdown", "value": "```rescript\nint\n```\nNew doc comment format"}}

16 changes: 8 additions & 8 deletions analysis/tests/src/expected/Hover.res.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ Hover src/Hover.res 19:11
{"contents": {"kind": "markdown", "value": "\nThis module is commented\n```rescript\nmodule Dep: {\n let customDouble: int => int\n}\n```"}}

Hover src/Hover.res 22:11
{"contents": {"kind": "markdown", "value": "Some doc comment\n\n```rescript\nint => int\n```"}}
{"contents": {"kind": "markdown", "value": "```rescript\nint => int\n```\nSome doc comment"}}

Hover src/Hover.res 26:6
getLocItem #8: heuristic for JSX with at most one child
heuristic for: [makeProps, make, createElement], give the loc of `make`
{"contents": {"kind": "markdown", "value": "```rescript\nint\n```"}}

Hover src/Hover.res 33:4
{"contents": {"kind": "markdown", "value": "Doc comment for functionWithTypeAnnotation\n\n```rescript\nunit => int\n```"}}
{"contents": {"kind": "markdown", "value": "```rescript\nunit => int\n```\nDoc comment for functionWithTypeAnnotation"}}

Hover src/Hover.res 37:13
getLocItem #5: heuristic for JSX and compiler combined:
Expand Down Expand Up @@ -103,10 +103,10 @@ Hover src/Hover.res 137:5
{"contents": {"kind": "markdown", "value": "```rescript\nunit => unit => int\n```"}}

Hover src/Hover.res 144:9
{"contents": {"kind": "markdown", "value": "doc comment 1\n\n```rescript\nint\n```"}}
{"contents": {"kind": "markdown", "value": "```rescript\nint\n```\ndoc comment 1"}}

Hover src/Hover.res 148:6
{"contents": {"kind": "markdown", "value": " doc comment 2 \n\n```rescript\nint\n```"}}
{"contents": {"kind": "markdown", "value": "```rescript\nint\n```\n doc comment 2 "}}

Hover src/Hover.res 165:23
{"contents": {"kind": "markdown", "value": "```rescript\nfoo<bar>\n```\n\n---\n\n```\n \n```\n```rescript\ntype foo<'a> = {content: 'a, zzz: string}\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22Hover.res%22%2C161%2C2%5D)\n\n\n---\n\n```\n \n```\n```rescript\ntype bar = {age: int}\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22Hover.res%22%2C162%2C2%5D)\n"}}
Expand Down Expand Up @@ -206,10 +206,10 @@ Resolved opens 1 pervasives
{"contents": {"kind": "markdown", "value": "```rescript\nuseR\n```\n\n---\n\n```\n \n```\n```rescript\ntype useR = {x: int, y: list<option<r<float>>>}\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22Hover.res%22%2C200%2C0%5D)\n\n\n---\n\n```\n \n```\n```rescript\ntype r<'a> = {i: 'a, f: float}\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22Hover.res%22%2C101%2C0%5D)\n"}}

Hover src/Hover.res 230:20
{"contents": {"kind": "markdown", "value": " More Stuff \n\n```rescript\nint\n```"}}
{"contents": {"kind": "markdown", "value": "```rescript\nint\n```\n More Stuff "}}

Hover src/Hover.res 233:17
{"contents": {"kind": "markdown", "value": " More Stuff \n\n```rescript\nint\n```"}}
{"contents": {"kind": "markdown", "value": "```rescript\nint\n```\n More Stuff "}}

Hover src/Hover.res 245:6
Nothing at that position. Now trying to use completion.
Expand All @@ -226,10 +226,10 @@ Resolved opens 1 pervasives
{"contents": {"kind": "markdown", "value": " Mighty fine field here. \n\n```rescript\nbool\n```"}}

Hover src/Hover.res 248:19
{"contents": {"kind": "markdown", "value": " Mighty fine field here. \n\n```rescript\nbool\n```"}}
{"contents": {"kind": "markdown", "value": "```rescript\nbool\n```\n Mighty fine field here. "}}

Hover src/Hover.res 253:20
{"contents": {"kind": "markdown", "value": "```rescript\nCoolVariant\n```\n\n Cool variant! \n\n```rescript\nvariant\n```\n\n---\n\n```\n \n```\n```rescript\ntype variant = CoolVariant | OtherCoolVariant\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22Hover.res%22%2C251%2C0%5D)\n"}}
{"contents": {"kind": "markdown", "value": "```rescript\nvariant\n```\n\n---\n\n```\n \n```\n```rescript\ntype variant = CoolVariant | OtherCoolVariant\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22Hover.res%22%2C251%2C0%5D)\n\n```rescript\nCoolVariant\n```\n Cool variant! "}}

Hover src/Hover.res 257:23
Nothing at that position. Now trying to use completion.
Expand Down
2 changes: 1 addition & 1 deletion analysis/tests/src/expected/JsxV4.res.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Path M4.make
}]

Hover src/JsxV4.res 14:9
{"contents": {"kind": "markdown", "value": " Doc Comment For M4 \n\n```rescript\nReact.component<M4.props<string, string, string>>\n```\n\n---\n\n```\n \n```\n```rescript\ntype React.component<'props> = Jsx.component<'props>\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22React.res%22%2C12%2C0%5D)\n\n\n---\n\n```\n \n```\n```rescript\ntype M4.props<'first, 'fun, 'second> = {\n first: 'first,\n fun?: 'fun,\n second?: 'second,\n}\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22JsxV4.res%22%2C3%2C2%5D)\n"}}
{"contents": {"kind": "markdown", "value": "```rescript\nReact.component<M4.props<string, string, string>>\n```\n\n---\n\n```\n \n```\n```rescript\ntype React.component<'props> = Jsx.component<'props>\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22React.res%22%2C12%2C0%5D)\n\n\n---\n\n```\n \n```\n```rescript\ntype M4.props<'first, 'fun, 'second> = {\n first: 'first,\n fun?: 'fun,\n second?: 'second,\n}\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22JsxV4.res%22%2C3%2C2%5D)\n\n Doc Comment For M4 "}}

Create Interface src/JsxV4.res
module M4: {
Expand Down

0 comments on commit 3541fb1

Please sign in to comment.