diff --git a/CHANGELOG.md b/CHANGELOG.md index f4ea7469f..744ba85dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ #### :rocket: New Feature - Extend signature help to work on constructor payloads as well. Can be turned off if wanted through settings. https://github.com/rescript-lang/rescript-vscode/pull/947 +- Show module docs for file modules. https://github.com/rescript-lang/rescript-vscode/pull/952 #### :nail_care: Polish @@ -22,6 +23,7 @@ - Clean occasional dots from "insert missing fields" code action. https://github.com/rescript-lang/rescript-vscode/pull/948 - Pick up code actions in incremental compilation. https://github.com/rescript-lang/rescript-vscode/pull/948 - Various improvements to the signature help functionality. https://github.com/rescript-lang/rescript-vscode/pull/950 +- Clean up completion item "details" and "documentation". https://github.com/rescript-lang/rescript-vscode/pull/952 ## 1.48.0 diff --git a/analysis/bin/main.ml b/analysis/bin/main.ml index 5a2fb5f40..c8af54330 100644 --- a/analysis/bin/main.ml +++ b/analysis/bin/main.ml @@ -115,6 +115,8 @@ let main () = Commands.completion ~debug ~path ~pos:(int_of_string line, int_of_string col) ~currentFile + | [_; "completionResolve"; path; modulePath] -> + Commands.completionResolve ~path ~modulePath | [_; "definition"; path; line; col] -> Commands.definition ~path ~pos:(int_of_string line, int_of_string col) diff --git a/analysis/src/Commands.ml b/analysis/src/Commands.ml index e4470be40..c861c5b01 100644 --- a/analysis/src/Commands.ml +++ b/analysis/src/Commands.ml @@ -4,13 +4,42 @@ let completion ~debug ~path ~pos ~currentFile = Completions.getCompletions ~debug ~path ~pos ~currentFile ~forHover:false with | None -> [] - | Some (completions, _, _) -> completions + | Some (completions, full, _) -> + completions + |> List.map (CompletionBackEnd.completionToItem ~full) + |> List.map Protocol.stringifyCompletionItem in - print_endline - (completions - |> List.map CompletionBackEnd.completionToItem - |> List.map Protocol.stringifyCompletionItem - |> Protocol.array) + completions |> Protocol.array |> print_endline + +let completionResolve ~path ~modulePath = + (* We ignore the internal module path as of now because there's currently + no use case for it. But, if we wanted to move resolving documentation + for regular modules and not just file modules to the completionResolve + hook as well, it'd be easy to implement here. *) + let moduleName, _innerModulePath = + match modulePath |> String.split_on_char '.' with + | [moduleName] -> (moduleName, []) + | moduleName :: rest -> (moduleName, rest) + | [] -> raise (Failure "Invalid module path.") + in + let docstring = + match Cmt.loadFullCmtFromPath ~path with + | None -> + if Debug.verbose () then + Printf.printf "[completion_resolve] Could not load cmt\n"; + Protocol.null + | Some full -> ( + match ProcessCmt.fileForModule ~package:full.package moduleName with + | None -> + if Debug.verbose () then + Printf.printf "[completion_resolve] Did not find file for module %s\n" + moduleName; + Protocol.null + | Some file -> + file.structure.docstring |> String.concat "\n\n" + |> Protocol.wrapInQuotes) + in + print_endline docstring let inlayhint ~path ~pos ~maxLength ~debug = let result = @@ -321,6 +350,11 @@ let test ~path = let currentFile = createCurrentFile () in completion ~debug:true ~path ~pos:(line, col) ~currentFile; Sys.remove currentFile + | "cre" -> + let modulePath = String.sub rest 3 (String.length rest - 3) in + let modulePath = String.trim modulePath in + print_endline ("Completion resolve: " ^ modulePath); + completionResolve ~path ~modulePath | "dce" -> print_endline ("DCE " ^ path); Reanalyze.RunConfig.runConfig.suppress <- ["src"]; diff --git a/analysis/src/CompletionBackEnd.ml b/analysis/src/CompletionBackEnd.ml index c8c1e7e7f..5b7a96779 100644 --- a/analysis/src/CompletionBackEnd.ml +++ b/analysis/src/CompletionBackEnd.ml @@ -79,7 +79,7 @@ let completionForExporteds iterExported getDeclared ~prefix ~exact ~env res := { (Completion.create declared.name.txt ~env - ~kind:(transformContents declared.item)) + ~kind:(transformContents declared)) with deprecated = declared.deprecated; docstring = declared.docstring; @@ -90,18 +90,20 @@ let completionForExporteds iterExported getDeclared ~prefix ~exact ~env let completionForExportedModules ~env ~prefix ~exact ~namesUsed = completionForExporteds (Exported.iter env.QueryEnv.exported Exported.Module) - (Stamps.findModule env.file.stamps) ~prefix ~exact ~env ~namesUsed (fun m -> - Completion.Module m) + (Stamps.findModule env.file.stamps) ~prefix ~exact ~env ~namesUsed + (fun declared -> + Completion.Module + {docstring = declared.docstring; module_ = declared.item}) let completionForExportedValues ~env ~prefix ~exact ~namesUsed = completionForExporteds (Exported.iter env.QueryEnv.exported Exported.Value) - (Stamps.findValue env.file.stamps) ~prefix ~exact ~env ~namesUsed (fun v -> - Completion.Value v) + (Stamps.findValue env.file.stamps) ~prefix ~exact ~env ~namesUsed + (fun declared -> Completion.Value declared.item) let completionForExportedTypes ~env ~prefix ~exact ~namesUsed = completionForExporteds (Exported.iter env.QueryEnv.exported Exported.Type) - (Stamps.findType env.file.stamps) ~prefix ~exact ~env ~namesUsed (fun t -> - Completion.Type t) + (Stamps.findType env.file.stamps) ~prefix ~exact ~env ~namesUsed + (fun declared -> Completion.Type declared.item) let completionsForExportedConstructors ~(env : QueryEnv.t) ~prefix ~exact ~namesUsed = @@ -224,39 +226,109 @@ let getEnvWithOpens ~scope ~(env : QueryEnv.t) ~package | None -> None | Some env -> ResolvePath.resolvePath ~env ~package ~path)) +let rec expandTypeExpr ~env ~package typeExpr = + match typeExpr |> Shared.digConstructor with + | Some path -> ( + match References.digConstructor ~env ~package path with + | None -> None + | Some (env, {item = {decl = {type_manifest = Some t}}}) -> + expandTypeExpr ~env ~package t + | Some (_, {docstring; item}) -> Some (docstring, item)) + | None -> None + +let kindToDocumentation ~env ~full ~currentDocstring name + (kind : Completion.kind) = + let docsFromKind = + match kind with + | ObjLabel _ | Label _ | FileModule _ | Snippet _ | FollowContextPath _ -> + [] + | Module {docstring} -> docstring + | Type {decl; name} -> + [decl |> Shared.declToString name |> Markdown.codeBlock] + | Value typ -> ( + match expandTypeExpr ~env ~package:full.package typ with + | None -> [] + | Some (docstrings, {decl; name; kind}) -> + docstrings + @ [ + (match kind with + | Record _ | Tuple _ | Variant _ -> + Markdown.codeBlock (Shared.declToString name decl) + | _ -> ""); + ]) + | Field ({typ; optional; docstring}, s) -> + (* Handle optional fields. Checking for "?" is because sometimes optional + fields are prefixed with "?" when completing, and at that point we don't + need to _also_ add a "?" after the field name, as that looks weird. *) + docstring + @ [ + Markdown.codeBlock + (if optional && Utils.startsWith name "?" = false then + name ^ "?: " + ^ (typ |> Utils.unwrapIfOption |> Shared.typeToString) + else name ^ ": " ^ (typ |> Shared.typeToString)); + Markdown.codeBlock s; + ] + | Constructor (c, s) -> + [Markdown.codeBlock (showConstructor c); Markdown.codeBlock s] + | PolyvariantConstructor ({displayName; args}, s) -> + [ + Markdown.codeBlock + ("#" ^ displayName + ^ + match args with + | [] -> "" + | typeExprs -> + "(" + ^ (typeExprs + |> List.map (fun typeExpr -> typeExpr |> Shared.typeToString) + |> String.concat ", ") + ^ ")"); + Markdown.codeBlock s; + ] + | ExtractedType (extractedType, _) -> + [Markdown.codeBlock (TypeUtils.extractedTypeToString extractedType)] + in + currentDocstring @ docsFromKind + |> List.filter (fun s -> s <> "") + |> String.concat "\n\n" + let kindToDetail name (kind : Completion.kind) = match kind with - | Type {decl} -> decl |> Shared.declToString name + | Type {name} -> "type " ^ name | Value typ -> typ |> Shared.typeToString | ObjLabel typ -> typ |> Shared.typeToString | Label typString -> typString - | Module _ -> "module" - | FileModule _ -> "file module" - | Field ({typ; optional}, s) -> + | Module _ -> "module " ^ name + | FileModule f -> "module " ^ f + | Field ({typ; optional}, _) -> (* Handle optional fields. Checking for "?" is because sometimes optional fields are prefixed with "?" when completing, and at that point we don't need to _also_ add a "?" after the field name, as that looks weird. *) if optional && Utils.startsWith name "?" = false then - name ^ "?: " - ^ (typ |> Utils.unwrapIfOption |> Shared.typeToString) - ^ "\n\n" ^ s - else name ^ ": " ^ (typ |> Shared.typeToString) ^ "\n\n" ^ s - | Constructor (c, s) -> showConstructor c ^ "\n\n" ^ s - | PolyvariantConstructor ({displayName; args}, s) -> + typ |> Utils.unwrapIfOption |> Shared.typeToString + else typ |> Shared.typeToString + | Constructor (c, _) -> showConstructor c + | PolyvariantConstructor ({displayName; args}, _) -> ( "#" ^ displayName - ^ (match args with - | [] -> "" - | typeExprs -> - "(" - ^ (typeExprs - |> List.map (fun typeExpr -> typeExpr |> Shared.typeToString) - |> String.concat ", ") - ^ ")") - ^ "\n\n" ^ s + ^ + match args with + | [] -> "" + | typeExprs -> + "(" + ^ (typeExprs + |> List.map (fun typeExpr -> typeExpr |> Shared.typeToString) + |> String.concat ", ") + ^ ")") | Snippet s -> s | FollowContextPath _ -> "" | ExtractedType (extractedType, _) -> - TypeUtils.extractedTypeToString extractedType + TypeUtils.extractedTypeToString ~nameOnly:true extractedType + +let kindToData filePath (kind : Completion.kind) = + match kind with + | FileModule f -> Some [("modulePath", f); ("filePath", filePath)] + | _ -> None let findAllCompletions ~(env : QueryEnv.t) ~prefix ~exact ~namesUsed ~(completionContext : Completable.completionContext) = @@ -366,7 +438,9 @@ let processLocalModule name loc ~prefix ~exact ~env localTables.resultRev <- { (Completion.create declared.name.txt ~env - ~kind:(Module declared.item)) + ~kind: + (Module + {docstring = declared.docstring; module_ = declared.item})) with deprecated = declared.deprecated; docstring = declared.docstring; @@ -579,7 +653,7 @@ let rec digToRecordFieldsForCompletion ~debug ~package ~opens ~full ~pos ~env | {kind = Type {kind = Record fields}} :: _ -> Some fields | _ -> None -let mkItem ~name ~kind ~detail ~deprecated ~docstring = +let mkItem ?data name ~kind ~detail ~deprecated ~docstring = let docContent = (match deprecated with | None -> "" @@ -607,6 +681,7 @@ let mkItem ~name ~kind ~detail ~deprecated ~docstring = insertText = None; insertTextFormat = None; filterText = None; + data; } let completionToItem @@ -620,16 +695,23 @@ let completionToItem insertTextFormat; filterText; detail; - } = + env; + } ~full = let item = - mkItem ~name + mkItem name + ?data:(kindToData (full.file.uri |> Uri.toPath) kind) ~kind:(Completion.kindToInt kind) ~deprecated ~detail: (match detail with | None -> kindToDetail name kind | Some detail -> detail) - ~docstring + ~docstring: + (match + kindToDocumentation ~currentDocstring:docstring ~full ~env name kind + with + | "" -> [] + | docstring -> [docstring]) in {item with sortText; insertText; insertTextFormat; filterText} diff --git a/analysis/src/Protocol.ml b/analysis/src/Protocol.ml index a98007d45..e10411664 100644 --- a/analysis/src/Protocol.ml +++ b/analysis/src/Protocol.ml @@ -50,6 +50,7 @@ type completionItem = { insertTextFormat: insertTextFormat option; insertText: string option; documentation: markupContent option; + data: (string * string) list option; } type location = {uri: string; range: range} @@ -139,6 +140,14 @@ let stringifyCompletionItem c = | None -> None | Some insertTextFormat -> Some (Printf.sprintf "%i" (insertTextFormatToInt insertTextFormat)) ); + ( "data", + match c.data with + | None -> None + | Some fields -> + Some + (fields + |> List.map (fun (key, value) -> (key, Some (wrapInQuotes value))) + |> stringifyObject ~indentation:2) ); ] let stringifyHover value = diff --git a/analysis/src/SharedTypes.ml b/analysis/src/SharedTypes.ml index e25e66fc3..11578527f 100644 --- a/analysis/src/SharedTypes.ml +++ b/analysis/src/SharedTypes.ml @@ -775,7 +775,7 @@ end module Completion = struct type kind = - | Module of Module.t + | Module of {docstring: string list; module_: Module.t} | Value of Types.type_expr | ObjLabel of Types.type_expr | Label of string @@ -800,10 +800,11 @@ module Completion = struct kind: kind; detail: string option; typeArgContext: typeArgContext option; + data: (string * string) list option; } - let create ?typeArgContext ?(includesSnippets = false) ?insertText ~kind ~env - ?sortText ?deprecated ?filterText ?detail ?(docstring = []) name = + let create ?data ?typeArgContext ?(includesSnippets = false) ?insertText ~kind + ~env ?sortText ?deprecated ?filterText ?detail ?(docstring = []) name = { name; env; @@ -817,6 +818,7 @@ module Completion = struct filterText; detail; typeArgContext; + data; } (* https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_completion *) diff --git a/analysis/src/TypeUtils.ml b/analysis/src/TypeUtils.ml index dbef28dd7..89cd694ed 100644 --- a/analysis/src/TypeUtils.ml +++ b/analysis/src/TypeUtils.ml @@ -26,16 +26,22 @@ let printRecordFromFields ?name (fields : field list) = |> String.concat ", ") ^ "}" -let rec extractedTypeToString ?(inner = false) = function - | Tuple (_, _, typ) - | Tpolyvariant {typeExpr = typ} - | Tfunction {typ} - | Trecord {definition = `TypeExpr typ} -> +let rec extractedTypeToString ?(nameOnly = false) ?(inner = false) = function + | Tuple (_, _, typ) | Tpolyvariant {typeExpr = typ} | Tfunction {typ} -> if inner then - match pathFromTypeExpr typ with - | None -> "record" (* Won't happen *) - | Some p -> p |> SharedTypes.pathIdentToString + try typ |> pathFromTypeExpr |> Option.get |> SharedTypes.pathIdentToString + with _ -> "" else Shared.typeToString typ + | Trecord {definition; fields} -> + let name = + match definition with + | `TypeExpr typ -> ( + try + typ |> pathFromTypeExpr |> Option.get |> SharedTypes.pathIdentToString + with _ -> "") + | `NameOnly name -> name + in + if inner || nameOnly then name else printRecordFromFields ~name fields | Tbool _ -> "bool" | Tstring _ -> "string" | TtypeT _ -> "type t" @@ -53,9 +59,8 @@ let rec extractedTypeToString ?(inner = false) = function "option<" ^ extractedTypeToString ~inner:true innerTyp ^ ">" | Tpromise (_, innerTyp) -> "promise<" ^ Shared.typeToString innerTyp ^ ">" | Tvariant {variantDecl; variantName} -> - if inner then variantName else Shared.declToString variantName variantDecl - | Trecord {definition = `NameOnly name; fields} -> - if inner then name else printRecordFromFields ~name fields + if inner || nameOnly then variantName + else Shared.declToString variantName variantDecl | TinlineRecord {fields} -> printRecordFromFields fields | Texn _ -> "exn" diff --git a/analysis/tests-incremental-typechecking/src/expected/ConstructorCompletion__Json.res.txt b/analysis/tests-incremental-typechecking/src/expected/ConstructorCompletion__Json.res.txt index 97b5054db..83eea85a2 100644 --- a/analysis/tests-incremental-typechecking/src/expected/ConstructorCompletion__Json.res.txt +++ b/analysis/tests-incremental-typechecking/src/expected/ConstructorCompletion__Json.res.txt @@ -12,7 +12,7 @@ ContextPath CTypeAtPos() "kind": 12, "tags": [], "detail": "t", - "documentation": null, + "documentation": {"kind": "markdown", "value": " The JSON data structure \n\n```rescript\ntype t =\n | Boolean(bool)\n | Null\n | String(string)\n | Number(float)\n | Object(Js.Dict.t)\n | Array(array)\n```"}, "sortText": "A", "insertText": "[$0]", "insertTextFormat": 2 diff --git a/analysis/tests/src/CompletionResolve.res b/analysis/tests/src/CompletionResolve.res new file mode 100644 index 000000000..187e00046 --- /dev/null +++ b/analysis/tests/src/CompletionResolve.res @@ -0,0 +1,4 @@ +// ^cre Belt_Array + +// ^cre ModuleStuff + diff --git a/analysis/tests/src/ModuleStuff.res b/analysis/tests/src/ModuleStuff.res new file mode 100644 index 000000000..13210ac76 --- /dev/null +++ b/analysis/tests/src/ModuleStuff.res @@ -0,0 +1,5 @@ +/*** This is a top level module doc. */ + +module Nested = { + /*** Module doc for nested. */ +} diff --git a/analysis/tests/src/expected/CompletePrioritize2.res.txt b/analysis/tests/src/expected/CompletePrioritize2.res.txt index a1ecd61c8..b6bea71f9 100644 --- a/analysis/tests/src/expected/CompletePrioritize2.res.txt +++ b/analysis/tests/src/expected/CompletePrioritize2.res.txt @@ -31,6 +31,6 @@ Path ax "kind": 12, "tags": [], "detail": "Test.t", - "documentation": null + "documentation": {"kind": "markdown", "value": "```rescript\ntype t = {name: int}\n```"} }] diff --git a/analysis/tests/src/expected/Completion.res.txt b/analysis/tests/src/expected/Completion.res.txt index ba0f27ed4..9b345c299 100644 --- a/analysis/tests/src/expected/Completion.res.txt +++ b/analysis/tests/src/expected/Completion.res.txt @@ -296,7 +296,7 @@ Path Array. "label": "Floatarray", "kind": 9, "tags": [], - "detail": "module", + "detail": "module Floatarray", "documentation": null }] @@ -732,14 +732,14 @@ Path r "label": "x", "kind": 5, "tags": [], - "detail": "x: int\n\ntype r = {x: int, y: string}", - "documentation": null + "detail": "int", + "documentation": {"kind": "markdown", "value": "```rescript\nx: int\n```\n\n```rescript\ntype r = {x: int, y: string}\n```"} }, { "label": "y", "kind": 5, "tags": [], - "detail": "y: string\n\ntype r = {x: int, y: string}", - "documentation": null + "detail": "string", + "documentation": {"kind": "markdown", "value": "```rescript\ny: string\n```\n\n```rescript\ntype r = {x: int, y: string}\n```"} }] Complete src/Completion.res 113:25 @@ -755,14 +755,14 @@ Path Objects.Rec.recordVal "label": "xx", "kind": 5, "tags": [], - "detail": "xx: int\n\ntype recordt = {xx: int, ss: string}", - "documentation": null + "detail": "int", + "documentation": {"kind": "markdown", "value": "```rescript\nxx: int\n```\n\n```rescript\ntype recordt = {xx: int, ss: string}\n```"} }, { "label": "ss", "kind": 5, "tags": [], - "detail": "ss: string\n\ntype recordt = {xx: int, ss: string}", - "documentation": null + "detail": "string", + "documentation": {"kind": "markdown", "value": "```rescript\nss: string\n```\n\n```rescript\ntype recordt = {xx: int, ss: string}\n```"} }] Complete src/Completion.res 120:7 @@ -819,7 +819,7 @@ Path O. "label": "Comp", "kind": 9, "tags": [], - "detail": "module", + "detail": "module Comp", "documentation": null }] @@ -837,14 +837,14 @@ Path q "label": "x", "kind": 5, "tags": [], - "detail": "x: int\n\ntype aa = {x: int, name: string}", - "documentation": null + "detail": "int", + "documentation": {"kind": "markdown", "value": "```rescript\nx: int\n```\n\n```rescript\ntype aa = {x: int, name: string}\n```"} }, { "label": "name", "kind": 5, "tags": [], - "detail": "name: string\n\ntype aa = {x: int, name: string}", - "documentation": null + "detail": "string", + "documentation": {"kind": "markdown", "value": "```rescript\nname: string\n```\n\n```rescript\ntype aa = {x: int, name: string}\n```"} }] Complete src/Completion.res 159:9 @@ -861,8 +861,8 @@ Path q "label": "name", "kind": 5, "tags": [], - "detail": "name: string\n\ntype aa = {x: int, name: string}", - "documentation": null + "detail": "string", + "documentation": {"kind": "markdown", "value": "```rescript\nname: string\n```\n\n```rescript\ntype aa = {x: int, name: string}\n```"} }] Complete src/Completion.res 162:6 @@ -877,14 +877,22 @@ Path Lis "label": "List", "kind": 9, "tags": [], - "detail": "file module", - "documentation": null + "detail": "module List", + "documentation": null, + "data": { + "modulePath": "List", + "filePath": "src/Completion.res" + } }, { "label": "ListLabels", "kind": 9, "tags": [], - "detail": "file module", - "documentation": null + "detail": "module ListLabels", + "documentation": null, + "data": { + "modulePath": "ListLabels", + "filePath": "src/Completion.res" + } }] Complete src/Completion.res 169:16 @@ -899,7 +907,7 @@ Path WithChildren "label": "WithChildren", "kind": 9, "tags": [], - "detail": "module", + "detail": "module WithChildren", "documentation": null }] @@ -915,20 +923,20 @@ Path Js.n "label": "null_undefined", "kind": 22, "tags": [], - "detail": "type null_undefined<'a> = nullable<'a>", - "documentation": null + "detail": "type null_undefined", + "documentation": {"kind": "markdown", "value": "```rescript\ntype null_undefined<'a> = nullable<'a>\n```"} }, { "label": "nullable", "kind": 22, "tags": [], - "detail": "type nullable<'a> = Value('a) | Null | Undefined", - "documentation": null + "detail": "type nullable", + "documentation": {"kind": "markdown", "value": "```rescript\ntype nullable<'a> = Value('a) | Null | Undefined\n```"} }, { "label": "null", "kind": 22, "tags": [], - "detail": "type null<'a> = Value('a) | Null", - "documentation": {"kind": "markdown", "value": "\n Nullable value of this type can be either null or 'a. This type is equivalent to Js.Null.t.\n"} + "detail": "type null", + "documentation": {"kind": "markdown", "value": "\n Nullable value of this type can be either null or 'a. This type is equivalent to Js.Null.t.\n\n\n```rescript\ntype null<'a> = Value('a) | Null\n```"} }] Complete src/Completion.res 174:20 @@ -943,8 +951,8 @@ Path ForAuto. "label": "t", "kind": 22, "tags": [], - "detail": "type t = int", - "documentation": null + "detail": "type t", + "documentation": {"kind": "markdown", "value": "```rescript\ntype t = int\n```"} }] Complete src/Completion.res 179:13 @@ -959,8 +967,8 @@ Path As "label": "Asterix", "kind": 4, "tags": [], - "detail": "Asterix\n\ntype z = Allo | Asterix | Baba", - "documentation": null + "detail": "Asterix", + "documentation": {"kind": "markdown", "value": "```rescript\nAsterix\n```\n\n```rescript\ntype z = Allo | Asterix | Baba\n```"} }] Complete src/Completion.res 182:17 @@ -974,7 +982,7 @@ Path For "label": "ForAuto", "kind": 9, "tags": [], - "detail": "module", + "detail": "module ForAuto", "documentation": null }] @@ -1077,14 +1085,14 @@ Path FAO.forAutoObject "label": "forAuto", "kind": 5, "tags": [], - "detail": "forAuto: ForAuto.t\n\ntype forAutoRecord = {\n forAuto: ForAuto.t,\n something: option,\n}", - "documentation": null + "detail": "ForAuto.t", + "documentation": {"kind": "markdown", "value": "```rescript\nforAuto: ForAuto.t\n```\n\n```rescript\ntype forAutoRecord = {\n forAuto: ForAuto.t,\n something: option,\n}\n```"} }, { "label": "something", "kind": 5, "tags": [], - "detail": "something: option\n\ntype forAutoRecord = {\n forAuto: ForAuto.t,\n something: option,\n}", - "documentation": null + "detail": "option", + "documentation": {"kind": "markdown", "value": "```rescript\nsomething: option\n```\n\n```rescript\ntype forAutoRecord = {\n forAuto: ForAuto.t,\n something: option,\n}\n```"} }] Complete src/Completion.res 227:46 @@ -1185,14 +1193,14 @@ Path _z "label": "x", "kind": 5, "tags": [], - "detail": "x: int\n\ntype r = {x: int, y: string}", - "documentation": null + "detail": "int", + "documentation": {"kind": "markdown", "value": "```rescript\nx: int\n```\n\n```rescript\ntype r = {x: int, y: string}\n```"} }, { "label": "y", "kind": 5, "tags": [], - "detail": "y: string\n\ntype r = {x: int, y: string}", - "documentation": null + "detail": "string", + "documentation": {"kind": "markdown", "value": "```rescript\ny: string\n```\n\n```rescript\ntype r = {x: int, y: string}\n```"} }] Complete src/Completion.res 254:17 @@ -1208,7 +1216,7 @@ Path SomeLo "label": "SomeLocalModule", "kind": 9, "tags": [], - "detail": "module", + "detail": "module SomeLocalModule", "documentation": null }] @@ -1225,8 +1233,8 @@ Path SomeLocalModule. "label": "zz", "kind": 22, "tags": [], - "detail": "type zz = int", - "documentation": null + "detail": "type zz", + "documentation": {"kind": "markdown", "value": "```rescript\ntype zz = int\n```"} }] Complete src/Completion.res 261:33 @@ -1242,8 +1250,8 @@ Path SomeLocalModule. "label": "zz", "kind": 22, "tags": [], - "detail": "type zz = int", - "documentation": null + "detail": "type zz", + "documentation": {"kind": "markdown", "value": "```rescript\ntype zz = int\n```"} }] Complete src/Completion.res 268:21 @@ -1258,13 +1266,13 @@ Path SomeLocal "label": "SomeLocalVariantItem", "kind": 4, "tags": [], - "detail": "SomeLocalVariantItem\n\ntype someLocalVariant = SomeLocalVariantItem", - "documentation": null + "detail": "SomeLocalVariantItem", + "documentation": {"kind": "markdown", "value": "```rescript\nSomeLocalVariantItem\n```\n\n```rescript\ntype someLocalVariant = SomeLocalVariantItem\n```"} }, { "label": "SomeLocalModule", "kind": 9, "tags": [], - "detail": "module", + "detail": "module SomeLocalModule", "documentation": null }] @@ -1282,7 +1290,7 @@ Path SomeLocal "label": "SomeLocalModule", "kind": 9, "tags": [], - "detail": "module", + "detail": "module SomeLocalModule", "documentation": null }] @@ -1319,14 +1327,14 @@ Path s "label": "someType", "kind": 22, "tags": [], - "detail": "type someType = {hello: string}", - "documentation": null + "detail": "type someType", + "documentation": {"kind": "markdown", "value": "```rescript\ntype someType = {hello: string}\n```"} }, { "label": "someLocalVariant", "kind": 22, "tags": [], - "detail": "type someLocalVariant = SomeLocalVariantItem", - "documentation": null + "detail": "type someLocalVariant", + "documentation": {"kind": "markdown", "value": "```rescript\ntype someLocalVariant = SomeLocalVariantItem\n```"} }] Complete src/Completion.res 291:30 @@ -1363,14 +1371,14 @@ Path retAA "label": "x", "kind": 5, "tags": [], - "detail": "x: int\n\ntype aa = {x: int, name: string}", - "documentation": null + "detail": "int", + "documentation": {"kind": "markdown", "value": "```rescript\nx: int\n```\n\n```rescript\ntype aa = {x: int, name: string}\n```"} }, { "label": "name", "kind": 5, "tags": [], - "detail": "name: string\n\ntype aa = {x: int, name: string}", - "documentation": null + "detail": "string", + "documentation": {"kind": "markdown", "value": "```rescript\nname: string\n```\n\n```rescript\ntype aa = {x: int, name: string}\n```"} }] Complete src/Completion.res 301:13 @@ -1647,14 +1655,22 @@ Path Res "label": "RescriptReactErrorBoundary", "kind": 9, "tags": [], - "detail": "file module", - "documentation": null + "detail": "module RescriptReactErrorBoundary", + "documentation": null, + "data": { + "modulePath": "RescriptReactErrorBoundary", + "filePath": "src/Completion.res" + } }, { "label": "RescriptReactRouter", "kind": 9, "tags": [], - "detail": "file module", - "documentation": null + "detail": "module RescriptReactRouter", + "documentation": null, + "data": { + "modulePath": "RescriptReactRouter", + "filePath": "src/Completion.res" + } }] Complete src/Completion.res 343:57 @@ -1752,32 +1768,44 @@ Path T "label": "That", "kind": 4, "tags": [], - "detail": "That\n\ntype v = This | That", - "documentation": null + "detail": "That", + "documentation": {"kind": "markdown", "value": "```rescript\nThat\n```\n\n```rescript\ntype v = This | That\n```"} }, { "label": "This", "kind": 4, "tags": [], - "detail": "This\n\ntype v = This | That", - "documentation": null + "detail": "This", + "documentation": {"kind": "markdown", "value": "```rescript\nThis\n```\n\n```rescript\ntype v = This | That\n```"} }, { "label": "TableclothMap", "kind": 9, "tags": [], - "detail": "file module", - "documentation": null + "detail": "module TableclothMap", + "documentation": null, + "data": { + "modulePath": "TableclothMap", + "filePath": "src/Completion.res" + } }, { "label": "TypeAtPosCompletion", "kind": 9, "tags": [], - "detail": "file module", - "documentation": null + "detail": "module TypeAtPosCompletion", + "documentation": null, + "data": { + "modulePath": "TypeAtPosCompletion", + "filePath": "src/Completion.res" + } }, { "label": "TypeDefinition", "kind": 9, "tags": [], - "detail": "file module", - "documentation": null + "detail": "module TypeDefinition", + "documentation": null, + "data": { + "modulePath": "TypeDefinition", + "filePath": "src/Completion.res" + } }] Complete src/Completion.res 373:21 @@ -1796,8 +1824,8 @@ Path AndThatOther.T "label": "ThatOther", "kind": 4, "tags": [], - "detail": "ThatOther\n\ntype v = And | ThatOther", - "documentation": null + "detail": "ThatOther", + "documentation": {"kind": "markdown", "value": "```rescript\nThatOther\n```\n\n```rescript\ntype v = And | ThatOther\n```"} }] Complete src/Completion.res 378:24 @@ -1873,14 +1901,14 @@ Path funRecord "label": "someFun", "kind": 5, "tags": [], - "detail": "someFun: (~name: string) => unit\n\ntype funRecord = {\n someFun: (~name: string) => unit,\n stuff: string,\n}", - "documentation": null + "detail": "(~name: string) => unit", + "documentation": {"kind": "markdown", "value": "```rescript\nsomeFun: (~name: string) => unit\n```\n\n```rescript\ntype funRecord = {\n someFun: (~name: string) => unit,\n stuff: string,\n}\n```"} }, { "label": "stuff", "kind": 5, "tags": [], - "detail": "stuff: string\n\ntype funRecord = {\n someFun: (~name: string) => unit,\n stuff: string,\n}", - "documentation": null + "detail": "string", + "documentation": {"kind": "markdown", "value": "```rescript\nstuff: string\n```\n\n```rescript\ntype funRecord = {\n someFun: (~name: string) => unit,\n stuff: string,\n}\n```"} }] Complete src/Completion.res 389:12 @@ -1984,7 +2012,7 @@ Path r "kind": 12, "tags": [], "detail": "rAlias", - "documentation": null + "documentation": {"kind": "markdown", "value": "```rescript\ntype r = {x: int, y: string}\n```"} }] Complete src/Completion.res 409:21 @@ -2129,14 +2157,14 @@ Path rWithDepr "label": "someInt", "kind": 5, "tags": [1], - "detail": "someInt: int\n\ntype someRecordWithDeprecatedField = {\n name: string,\n someInt: int,\n someFloat: float,\n}", - "documentation": {"kind": "markdown", "value": "Deprecated: \n\n"} + "detail": "int", + "documentation": {"kind": "markdown", "value": "Deprecated: \n\n```rescript\nsomeInt: int\n```\n\n```rescript\ntype someRecordWithDeprecatedField = {\n name: string,\n someInt: int,\n someFloat: float,\n}\n```"} }, { "label": "someFloat", "kind": 5, "tags": [1], - "detail": "someFloat: float\n\ntype someRecordWithDeprecatedField = {\n name: string,\n someInt: int,\n someFloat: float,\n}", - "documentation": {"kind": "markdown", "value": "Deprecated: Use 'someInt'.\n\n"} + "detail": "float", + "documentation": {"kind": "markdown", "value": "Deprecated: Use 'someInt'.\n\n```rescript\nsomeFloat: float\n```\n\n```rescript\ntype someRecordWithDeprecatedField = {\n name: string,\n someInt: int,\n someFloat: float,\n}\n```"} }] Complete src/Completion.res 450:37 @@ -2151,24 +2179,24 @@ Path someVariantWithDeprecated "label": "DoNotUseMe", "kind": 4, "tags": [1], - "detail": "DoNotUseMe\n\ntype someVariantWithDeprecated =\n | DoNotUseMe\n | UseMeInstead\n | AndNotMe", - "documentation": {"kind": "markdown", "value": "Deprecated: \n\n"}, + "detail": "DoNotUseMe", + "documentation": {"kind": "markdown", "value": "Deprecated: \n\n```rescript\nDoNotUseMe\n```\n\n```rescript\ntype someVariantWithDeprecated =\n | DoNotUseMe\n | UseMeInstead\n | AndNotMe\n```"}, "insertText": "DoNotUseMe", "insertTextFormat": 2 }, { "label": "UseMeInstead", "kind": 4, "tags": [], - "detail": "UseMeInstead\n\ntype someVariantWithDeprecated =\n | DoNotUseMe\n | UseMeInstead\n | AndNotMe", - "documentation": null, + "detail": "UseMeInstead", + "documentation": {"kind": "markdown", "value": "```rescript\nUseMeInstead\n```\n\n```rescript\ntype someVariantWithDeprecated =\n | DoNotUseMe\n | UseMeInstead\n | AndNotMe\n```"}, "insertText": "UseMeInstead", "insertTextFormat": 2 }, { "label": "AndNotMe", "kind": 4, "tags": [1], - "detail": "AndNotMe\n\ntype someVariantWithDeprecated =\n | DoNotUseMe\n | UseMeInstead\n | AndNotMe", - "documentation": {"kind": "markdown", "value": "Deprecated: Use 'UseMeInstead'\n\n"}, + "detail": "AndNotMe", + "documentation": {"kind": "markdown", "value": "Deprecated: Use 'UseMeInstead'\n\n```rescript\nAndNotMe\n```\n\n```rescript\ntype someVariantWithDeprecated =\n | DoNotUseMe\n | UseMeInstead\n | AndNotMe\n```"}, "insertText": "AndNotMe", "insertTextFormat": 2 }] @@ -2226,18 +2254,18 @@ Path FAR. "kind": 12, "tags": [], "detail": "forAutoRecord", - "documentation": null + "documentation": {"kind": "markdown", "value": "```rescript\ntype forAutoRecord = {\n forAuto: ForAuto.t,\n something: option,\n}\n```"} }, { "label": "forAuto", "kind": 5, "tags": [], - "detail": "forAuto: ForAuto.t\n\ntype forAutoRecord = {\n forAuto: ForAuto.t,\n something: option,\n}", - "documentation": null + "detail": "ForAuto.t", + "documentation": {"kind": "markdown", "value": "```rescript\nforAuto: ForAuto.t\n```\n\n```rescript\ntype forAutoRecord = {\n forAuto: ForAuto.t,\n something: option,\n}\n```"} }, { "label": "something", "kind": 5, "tags": [], - "detail": "something: option\n\ntype forAutoRecord = {\n forAuto: ForAuto.t,\n something: option,\n}", - "documentation": null + "detail": "option", + "documentation": {"kind": "markdown", "value": "```rescript\nsomething: option\n```\n\n```rescript\ntype forAutoRecord = {\n forAuto: ForAuto.t,\n something: option,\n}\n```"} }] diff --git a/analysis/tests/src/expected/CompletionAttributes.res.txt b/analysis/tests/src/expected/CompletionAttributes.res.txt index 81fa8b918..989a4c77d 100644 --- a/analysis/tests/src/expected/CompletionAttributes.res.txt +++ b/analysis/tests/src/expected/CompletionAttributes.res.txt @@ -74,20 +74,20 @@ Resolved opens 1 pervasives "label": "version", "kind": 5, "tags": [], - "detail": "version?: int\n\ntype jsxConfig = {version: int, module_: string, mode: string}", - "documentation": null + "detail": "int", + "documentation": {"kind": "markdown", "value": "```rescript\nversion?: int\n```\n\n```rescript\ntype jsxConfig = {version: int, module_: string, mode: string}\n```"} }, { "label": "module_", "kind": 5, "tags": [], - "detail": "module_?: string\n\ntype jsxConfig = {version: int, module_: string, mode: string}", - "documentation": null + "detail": "string", + "documentation": {"kind": "markdown", "value": "```rescript\nmodule_?: string\n```\n\n```rescript\ntype jsxConfig = {version: int, module_: string, mode: string}\n```"} }, { "label": "mode", "kind": 5, "tags": [], - "detail": "mode?: string\n\ntype jsxConfig = {version: int, module_: string, mode: string}", - "documentation": null + "detail": "string", + "documentation": {"kind": "markdown", "value": "```rescript\nmode?: string\n```\n\n```rescript\ntype jsxConfig = {version: int, module_: string, mode: string}\n```"} }] Complete src/CompletionAttributes.res 12:17 @@ -99,14 +99,14 @@ Resolved opens 1 pervasives "label": "module_", "kind": 5, "tags": [], - "detail": "module_?: string\n\ntype jsxConfig = {version: int, module_: string, mode: string}", - "documentation": null + "detail": "string", + "documentation": {"kind": "markdown", "value": "```rescript\nmodule_?: string\n```\n\n```rescript\ntype jsxConfig = {version: int, module_: string, mode: string}\n```"} }, { "label": "mode", "kind": 5, "tags": [], - "detail": "mode?: string\n\ntype jsxConfig = {version: int, module_: string, mode: string}", - "documentation": null + "detail": "string", + "documentation": {"kind": "markdown", "value": "```rescript\nmode?: string\n```\n\n```rescript\ntype jsxConfig = {version: int, module_: string, mode: string}\n```"} }] Complete src/CompletionAttributes.res 15:25 @@ -134,14 +134,14 @@ Resolved opens 1 pervasives "label": "version", "kind": 5, "tags": [], - "detail": "version?: int\n\ntype jsxConfig = {version: int, module_: string, mode: string}", - "documentation": null + "detail": "int", + "documentation": {"kind": "markdown", "value": "```rescript\nversion?: int\n```\n\n```rescript\ntype jsxConfig = {version: int, module_: string, mode: string}\n```"} }, { "label": "mode", "kind": 5, "tags": [], - "detail": "mode?: string\n\ntype jsxConfig = {version: int, module_: string, mode: string}", - "documentation": null + "detail": "string", + "documentation": {"kind": "markdown", "value": "```rescript\nmode?: string\n```\n\n```rescript\ntype jsxConfig = {version: int, module_: string, mode: string}\n```"} }] Complete src/CompletionAttributes.res 21:12 @@ -153,14 +153,14 @@ Resolved opens 1 pervasives "label": "from", "kind": 5, "tags": [], - "detail": "from?: string\n\ntype moduleConfig = {from: string, with: string}", - "documentation": null + "detail": "string", + "documentation": {"kind": "markdown", "value": "```rescript\nfrom?: string\n```\n\n```rescript\ntype moduleConfig = {from: string, with: string}\n```"} }, { "label": "with", "kind": 5, "tags": [], - "detail": "with?: string\n\ntype moduleConfig = {from: string, with: string}", - "documentation": null + "detail": "string", + "documentation": {"kind": "markdown", "value": "```rescript\nwith?: string\n```\n\n```rescript\ntype moduleConfig = {from: string, with: string}\n```"} }] Complete src/CompletionAttributes.res 24:17 @@ -172,8 +172,8 @@ Resolved opens 1 pervasives "label": "{}", "kind": 12, "tags": [], - "detail": "type importAttributesConfig = {type_: string}", - "documentation": null, + "detail": "importAttributesConfig", + "documentation": {"kind": "markdown", "value": "```rescript\ntype importAttributesConfig = {type_: string}\n```"}, "sortText": "A", "insertText": "{$0}", "insertTextFormat": 2 @@ -188,8 +188,8 @@ Resolved opens 1 pervasives "label": "type_", "kind": 5, "tags": [], - "detail": "type_?: string\n\ntype importAttributesConfig = {type_: string}", - "documentation": null + "detail": "string", + "documentation": {"kind": "markdown", "value": "```rescript\ntype_?: string\n```\n\n```rescript\ntype importAttributesConfig = {type_: string}\n```"} }] Complete src/CompletionAttributes.res 30:19 diff --git a/analysis/tests/src/expected/CompletionExpressions.res.txt b/analysis/tests/src/expected/CompletionExpressions.res.txt index 8dd98de70..0ab4a56f8 100644 --- a/analysis/tests/src/expected/CompletionExpressions.res.txt +++ b/analysis/tests/src/expected/CompletionExpressions.res.txt @@ -31,38 +31,38 @@ Path fnTakingRecord "label": "age", "kind": 5, "tags": [], - "detail": "age: int\n\nsomeRecord", - "documentation": null + "detail": "int", + "documentation": {"kind": "markdown", "value": "```rescript\nage: int\n```\n\n```rescript\ntype someRecord = {age: int, offline: bool, online: option, variant: someVariant, polyvariant: somePolyVariant, nested: option}\n```"} }, { "label": "offline", "kind": 5, "tags": [], - "detail": "offline: bool\n\nsomeRecord", - "documentation": null + "detail": "bool", + "documentation": {"kind": "markdown", "value": "```rescript\noffline: bool\n```\n\n```rescript\ntype someRecord = {age: int, offline: bool, online: option, variant: someVariant, polyvariant: somePolyVariant, nested: option}\n```"} }, { "label": "online", "kind": 5, "tags": [], - "detail": "online: option\n\nsomeRecord", - "documentation": null + "detail": "option", + "documentation": {"kind": "markdown", "value": "```rescript\nonline: option\n```\n\n```rescript\ntype someRecord = {age: int, offline: bool, online: option, variant: someVariant, polyvariant: somePolyVariant, nested: option}\n```"} }, { "label": "variant", "kind": 5, "tags": [], - "detail": "variant: someVariant\n\nsomeRecord", - "documentation": null + "detail": "someVariant", + "documentation": {"kind": "markdown", "value": "```rescript\nvariant: someVariant\n```\n\n```rescript\ntype someRecord = {age: int, offline: bool, online: option, variant: someVariant, polyvariant: somePolyVariant, nested: option}\n```"} }, { "label": "polyvariant", "kind": 5, "tags": [], - "detail": "polyvariant: somePolyVariant\n\nsomeRecord", - "documentation": null + "detail": "somePolyVariant", + "documentation": {"kind": "markdown", "value": "```rescript\npolyvariant: somePolyVariant\n```\n\n```rescript\ntype someRecord = {age: int, offline: bool, online: option, variant: someVariant, polyvariant: somePolyVariant, nested: option}\n```"} }, { "label": "nested", "kind": 5, "tags": [], - "detail": "nested: option\n\nsomeRecord", - "documentation": null + "detail": "option", + "documentation": {"kind": "markdown", "value": "```rescript\nnested: option\n```\n\n```rescript\ntype someRecord = {age: int, offline: bool, online: option, variant: someVariant, polyvariant: somePolyVariant, nested: option}\n```"} }] Complete src/CompletionExpressions.res 29:28 @@ -78,8 +78,8 @@ Path fnTakingRecord "label": "nested", "kind": 5, "tags": [], - "detail": "nested: option\n\nsomeRecord", - "documentation": null + "detail": "option", + "documentation": {"kind": "markdown", "value": "```rescript\nnested: option\n```\n\n```rescript\ntype someRecord = {age: int, offline: bool, online: option, variant: someVariant, polyvariant: somePolyVariant, nested: option}\n```"} }] Complete src/CompletionExpressions.res 32:35 @@ -118,32 +118,32 @@ Path fnTakingRecord "label": "offline", "kind": 5, "tags": [], - "detail": "offline: bool\n\nsomeRecord", - "documentation": null + "detail": "bool", + "documentation": {"kind": "markdown", "value": "```rescript\noffline: bool\n```\n\n```rescript\ntype someRecord = {age: int, offline: bool, online: option, variant: someVariant, polyvariant: somePolyVariant, nested: option}\n```"} }, { "label": "online", "kind": 5, "tags": [], - "detail": "online: option\n\nsomeRecord", - "documentation": null + "detail": "option", + "documentation": {"kind": "markdown", "value": "```rescript\nonline: option\n```\n\n```rescript\ntype someRecord = {age: int, offline: bool, online: option, variant: someVariant, polyvariant: somePolyVariant, nested: option}\n```"} }, { "label": "variant", "kind": 5, "tags": [], - "detail": "variant: someVariant\n\nsomeRecord", - "documentation": null + "detail": "someVariant", + "documentation": {"kind": "markdown", "value": "```rescript\nvariant: someVariant\n```\n\n```rescript\ntype someRecord = {age: int, offline: bool, online: option, variant: someVariant, polyvariant: somePolyVariant, nested: option}\n```"} }, { "label": "polyvariant", "kind": 5, "tags": [], - "detail": "polyvariant: somePolyVariant\n\nsomeRecord", - "documentation": null + "detail": "somePolyVariant", + "documentation": {"kind": "markdown", "value": "```rescript\npolyvariant: somePolyVariant\n```\n\n```rescript\ntype someRecord = {age: int, offline: bool, online: option, variant: someVariant, polyvariant: somePolyVariant, nested: option}\n```"} }, { "label": "nested", "kind": 5, "tags": [], - "detail": "nested: option\n\nsomeRecord", - "documentation": null + "detail": "option", + "documentation": {"kind": "markdown", "value": "```rescript\nnested: option\n```\n\n```rescript\ntype someRecord = {age: int, offline: bool, online: option, variant: someVariant, polyvariant: somePolyVariant, nested: option}\n```"} }] Complete src/CompletionExpressions.res 38:37 @@ -159,26 +159,26 @@ Path fnTakingRecord "label": "online", "kind": 5, "tags": [], - "detail": "online: option\n\nsomeRecord", - "documentation": null + "detail": "option", + "documentation": {"kind": "markdown", "value": "```rescript\nonline: option\n```\n\n```rescript\ntype someRecord = {age: int, offline: bool, online: option, variant: someVariant, polyvariant: somePolyVariant, nested: option}\n```"} }, { "label": "variant", "kind": 5, "tags": [], - "detail": "variant: someVariant\n\nsomeRecord", - "documentation": null + "detail": "someVariant", + "documentation": {"kind": "markdown", "value": "```rescript\nvariant: someVariant\n```\n\n```rescript\ntype someRecord = {age: int, offline: bool, online: option, variant: someVariant, polyvariant: somePolyVariant, nested: option}\n```"} }, { "label": "polyvariant", "kind": 5, "tags": [], - "detail": "polyvariant: somePolyVariant\n\nsomeRecord", - "documentation": null + "detail": "somePolyVariant", + "documentation": {"kind": "markdown", "value": "```rescript\npolyvariant: somePolyVariant\n```\n\n```rescript\ntype someRecord = {age: int, offline: bool, online: option, variant: someVariant, polyvariant: somePolyVariant, nested: option}\n```"} }, { "label": "nested", "kind": 5, "tags": [], - "detail": "nested: option\n\nsomeRecord", - "documentation": null + "detail": "option", + "documentation": {"kind": "markdown", "value": "```rescript\nnested: option\n```\n\n```rescript\ntype someRecord = {age: int, offline: bool, online: option, variant: someVariant, polyvariant: somePolyVariant, nested: option}\n```"} }] Complete src/CompletionExpressions.res 41:44 @@ -195,7 +195,7 @@ Path fnTakingRecord "kind": 12, "tags": [], "detail": "otherRecord", - "documentation": null, + "documentation": {"kind": "markdown", "value": "```rescript\ntype otherRecord = {someField: int, otherField: string}\n```"}, "insertText": "Some(nested)$0", "insertTextFormat": 2 }, { @@ -203,7 +203,7 @@ Path fnTakingRecord "kind": 12, "tags": [], "detail": "otherRecord", - "documentation": null, + "documentation": {"kind": "markdown", "value": "```rescript\ntype otherRecord = {someField: int, otherField: string}\n```"}, "insertText": "Some($0)", "insertTextFormat": 2 }, { @@ -211,13 +211,13 @@ Path fnTakingRecord "kind": 12, "tags": [], "detail": "otherRecord", - "documentation": null + "documentation": {"kind": "markdown", "value": "```rescript\ntype otherRecord = {someField: int, otherField: string}\n```"} }, { "label": "Some({})", "kind": 12, "tags": [], "detail": "otherRecord", - "documentation": null, + "documentation": {"kind": "markdown", "value": "```rescript\ntype otherRecord = {someField: int, otherField: string}\n```"}, "insertText": "Some({$0})", "insertTextFormat": 2 }] @@ -246,14 +246,14 @@ Path fnTakingRecord "label": "someField", "kind": 5, "tags": [], - "detail": "someField: int\n\notherRecord", - "documentation": null + "detail": "int", + "documentation": {"kind": "markdown", "value": "```rescript\nsomeField: int\n```\n\n```rescript\ntype otherRecord = {someField: int, otherField: string}\n```"} }, { "label": "otherField", "kind": 5, "tags": [], - "detail": "otherField: string\n\notherRecord", - "documentation": null + "detail": "string", + "documentation": {"kind": "markdown", "value": "```rescript\notherField: string\n```\n\n```rescript\ntype otherRecord = {someField: int, otherField: string}\n```"} }] Complete src/CompletionExpressions.res 50:45 @@ -269,24 +269,24 @@ Path fnTakingRecord "label": "One", "kind": 4, "tags": [], - "detail": "One\n\ntype someVariant = One | Two | Three(int, string)", - "documentation": null, + "detail": "One", + "documentation": {"kind": "markdown", "value": "```rescript\nOne\n```\n\n```rescript\ntype someVariant = One | Two | Three(int, string)\n```"}, "insertText": "One", "insertTextFormat": 2 }, { "label": "Two", "kind": 4, "tags": [], - "detail": "Two\n\ntype someVariant = One | Two | Three(int, string)", - "documentation": null, + "detail": "Two", + "documentation": {"kind": "markdown", "value": "```rescript\nTwo\n```\n\n```rescript\ntype someVariant = One | Two | Three(int, string)\n```"}, "insertText": "Two", "insertTextFormat": 2 }, { "label": "Three(_, _)", "kind": 4, "tags": [], - "detail": "Three(int, string)\n\ntype someVariant = One | Two | Three(int, string)", - "documentation": null, + "detail": "Three(int, string)", + "documentation": {"kind": "markdown", "value": "```rescript\nThree(int, string)\n```\n\n```rescript\ntype someVariant = One | Two | Three(int, string)\n```"}, "insertText": "Three(${1:_}, ${2:_})", "insertTextFormat": 2 }] @@ -304,8 +304,8 @@ Path fnTakingRecord "label": "One", "kind": 4, "tags": [], - "detail": "One\n\ntype someVariant = One | Two | Three(int, string)", - "documentation": null, + "detail": "One", + "documentation": {"kind": "markdown", "value": "```rescript\nOne\n```\n\n```rescript\ntype someVariant = One | Two | Three(int, string)\n```"}, "insertText": "One", "insertTextFormat": 2 }] @@ -324,7 +324,7 @@ Path fnTakingRecord "kind": 12, "tags": [], "detail": "someRecord", - "documentation": null, + "documentation": {"kind": "markdown", "value": "```rescript\ntype someRecord = {age: int, offline: bool, online: option, variant: someVariant, polyvariant: somePolyVariant, nested: option}\n```"}, "sortText": "A", "insertText": "{$0}", "insertTextFormat": 2 @@ -615,7 +615,7 @@ Path fnTakingRecordWithOptVariant "kind": 12, "tags": [], "detail": "someVariant", - "documentation": null, + "documentation": {"kind": "markdown", "value": "```rescript\ntype someVariant = One | Two | Three(int, string)\n```"}, "insertText": "Some(someVariant)$0", "insertTextFormat": 2 }, { @@ -623,7 +623,7 @@ Path fnTakingRecordWithOptVariant "kind": 12, "tags": [], "detail": "someVariant", - "documentation": null, + "documentation": {"kind": "markdown", "value": "```rescript\ntype someVariant = One | Two | Three(int, string)\n```"}, "insertText": "Some($0)", "insertTextFormat": 2 }, { @@ -631,29 +631,29 @@ Path fnTakingRecordWithOptVariant "kind": 12, "tags": [], "detail": "someVariant", - "documentation": null + "documentation": {"kind": "markdown", "value": "```rescript\ntype someVariant = One | Two | Three(int, string)\n```"} }, { "label": "Some(One)", "kind": 4, "tags": [], - "detail": "One\n\ntype someVariant = One | Two | Three(int, string)", - "documentation": null, + "detail": "One", + "documentation": {"kind": "markdown", "value": "```rescript\nOne\n```\n\n```rescript\ntype someVariant = One | Two | Three(int, string)\n```"}, "insertText": "Some(One)", "insertTextFormat": 2 }, { "label": "Some(Two)", "kind": 4, "tags": [], - "detail": "Two\n\ntype someVariant = One | Two | Three(int, string)", - "documentation": null, + "detail": "Two", + "documentation": {"kind": "markdown", "value": "```rescript\nTwo\n```\n\n```rescript\ntype someVariant = One | Two | Three(int, string)\n```"}, "insertText": "Some(Two)", "insertTextFormat": 2 }, { "label": "Some(Three(_, _))", "kind": 4, "tags": [], - "detail": "Three(int, string)\n\ntype someVariant = One | Two | Three(int, string)", - "documentation": null, + "detail": "Three(int, string)", + "documentation": {"kind": "markdown", "value": "```rescript\nThree(int, string)\n```\n\n```rescript\ntype someVariant = One | Two | Three(int, string)\n```"}, "insertText": "Some(Three(${1:_}, ${2:_}))", "insertTextFormat": 2 }] @@ -738,7 +738,7 @@ Path fnTakingInlineRecord "kind": 12, "tags": [], "detail": "otherRecord", - "documentation": null, + "documentation": {"kind": "markdown", "value": "```rescript\ntype otherRecord = {someField: int, otherField: string}\n```"}, "sortText": "A", "insertText": "{$0}", "insertTextFormat": 2 @@ -757,14 +757,14 @@ Path fnTakingInlineRecord "label": "someField", "kind": 5, "tags": [], - "detail": "someField: int\n\notherRecord", - "documentation": null + "detail": "int", + "documentation": {"kind": "markdown", "value": "```rescript\nsomeField: int\n```\n\n```rescript\ntype otherRecord = {someField: int, otherField: string}\n```"} }, { "label": "otherField", "kind": 5, "tags": [], - "detail": "otherField: string\n\notherRecord", - "documentation": null + "detail": "string", + "documentation": {"kind": "markdown", "value": "```rescript\notherField: string\n```\n\n```rescript\ntype otherRecord = {someField: int, otherField: string}\n```"} }] Complete src/CompletionExpressions.res 159:20 @@ -950,8 +950,8 @@ Path fff "label": "someOptField", "kind": 5, "tags": [], - "detail": "someOptField?: bool\n\ntype recordWithOptionalField = {\n someField: int,\n someOptField?: bool,\n}", - "documentation": null + "detail": "bool", + "documentation": {"kind": "markdown", "value": "```rescript\nsomeOptField?: bool\n```\n\n```rescript\ntype recordWithOptionalField = {\n someField: int,\n someOptField?: bool,\n}\n```"} }] Complete src/CompletionExpressions.res 205:11 @@ -1126,8 +1126,8 @@ Path takesExotic "label": "#\"some exotic\"", "kind": 4, "tags": [], - "detail": "#\"some exotic\"\n\n[#\"some exotic\"]", - "documentation": null, + "detail": "#\"some exotic\"", + "documentation": {"kind": "markdown", "value": "```rescript\n#\"some exotic\"\n```\n\n```rescript\n[#\"some exotic\"]\n```"}, "insertText": "#\"some exotic\"", "insertTextFormat": 2 }] @@ -1145,24 +1145,24 @@ Path fnTakingPolyVariant "label": "#one", "kind": 4, "tags": [], - "detail": "#one\n\n[#one | #three(someRecord, bool) | #two(bool)]", - "documentation": null, + "detail": "#one", + "documentation": {"kind": "markdown", "value": "```rescript\n#one\n```\n\n```rescript\n[#one | #three(someRecord, bool) | #two(bool)]\n```"}, "insertText": "#one", "insertTextFormat": 2 }, { "label": "#three(_, _)", "kind": 4, "tags": [], - "detail": "#three(someRecord, bool)\n\n[#one | #three(someRecord, bool) | #two(bool)]", - "documentation": null, + "detail": "#three(someRecord, bool)", + "documentation": {"kind": "markdown", "value": "```rescript\n#three(someRecord, bool)\n```\n\n```rescript\n[#one | #three(someRecord, bool) | #two(bool)]\n```"}, "insertText": "#three(${1:_}, ${2:_})", "insertTextFormat": 2 }, { "label": "#two(_)", "kind": 4, "tags": [], - "detail": "#two(bool)\n\n[#one | #three(someRecord, bool) | #two(bool)]", - "documentation": null, + "detail": "#two(bool)", + "documentation": {"kind": "markdown", "value": "```rescript\n#two(bool)\n```\n\n```rescript\n[#one | #three(someRecord, bool) | #two(bool)]\n```"}, "insertText": "#two($0)", "insertTextFormat": 2 }] @@ -1180,24 +1180,24 @@ Path fnTakingPolyVariant "label": "#one", "kind": 4, "tags": [], - "detail": "#one\n\n[#one | #three(someRecord, bool) | #two(bool)]", - "documentation": null, + "detail": "#one", + "documentation": {"kind": "markdown", "value": "```rescript\n#one\n```\n\n```rescript\n[#one | #three(someRecord, bool) | #two(bool)]\n```"}, "insertText": "one", "insertTextFormat": 2 }, { "label": "#three(_, _)", "kind": 4, "tags": [], - "detail": "#three(someRecord, bool)\n\n[#one | #three(someRecord, bool) | #two(bool)]", - "documentation": null, + "detail": "#three(someRecord, bool)", + "documentation": {"kind": "markdown", "value": "```rescript\n#three(someRecord, bool)\n```\n\n```rescript\n[#one | #three(someRecord, bool) | #two(bool)]\n```"}, "insertText": "three(${1:_}, ${2:_})", "insertTextFormat": 2 }, { "label": "#two(_)", "kind": 4, "tags": [], - "detail": "#two(bool)\n\n[#one | #three(someRecord, bool) | #two(bool)]", - "documentation": null, + "detail": "#two(bool)", + "documentation": {"kind": "markdown", "value": "```rescript\n#two(bool)\n```\n\n```rescript\n[#one | #three(someRecord, bool) | #two(bool)]\n```"}, "insertText": "two($0)", "insertTextFormat": 2 }] @@ -1215,8 +1215,8 @@ Path fnTakingPolyVariant "label": "#one", "kind": 4, "tags": [], - "detail": "#one\n\n[#one | #three(someRecord, bool) | #two(bool)]", - "documentation": null, + "detail": "#one", + "documentation": {"kind": "markdown", "value": "```rescript\n#one\n```\n\n```rescript\n[#one | #three(someRecord, bool) | #two(bool)]\n```"}, "insertText": "one", "insertTextFormat": 2 }] @@ -1234,8 +1234,8 @@ Path fnTakingPolyVariant "label": "#one", "kind": 4, "tags": [], - "detail": "#one\n\n[#one | #three(someRecord, bool) | #two(bool)]", - "documentation": null, + "detail": "#one", + "documentation": {"kind": "markdown", "value": "```rescript\n#one\n```\n\n```rescript\n[#one | #three(someRecord, bool) | #two(bool)]\n```"}, "insertText": "#one", "insertTextFormat": 2 }] @@ -1419,7 +1419,7 @@ Path someTyp "label": "test", "kind": 5, "tags": [], - "detail": "test: bool\n\ntype someTyp = {test: bool}", - "documentation": null + "detail": "bool", + "documentation": {"kind": "markdown", "value": "```rescript\ntest: bool\n```\n\n```rescript\ntype someTyp = {test: bool}\n```"} }] diff --git a/analysis/tests/src/expected/CompletionFunctionArguments.res.txt b/analysis/tests/src/expected/CompletionFunctionArguments.res.txt index cfc0eea85..b84d25a27 100644 --- a/analysis/tests/src/expected/CompletionFunctionArguments.res.txt +++ b/analysis/tests/src/expected/CompletionFunctionArguments.res.txt @@ -125,24 +125,24 @@ Path someFnTakingVariant "label": "One", "kind": 4, "tags": [], - "detail": "One\n\ntype someVariant = One | Two | Three(int, string)", - "documentation": null, + "detail": "One", + "documentation": {"kind": "markdown", "value": "```rescript\nOne\n```\n\n```rescript\ntype someVariant = One | Two | Three(int, string)\n```"}, "insertText": "One", "insertTextFormat": 2 }, { "label": "Two", "kind": 4, "tags": [], - "detail": "Two\n\ntype someVariant = One | Two | Three(int, string)", - "documentation": null, + "detail": "Two", + "documentation": {"kind": "markdown", "value": "```rescript\nTwo\n```\n\n```rescript\ntype someVariant = One | Two | Three(int, string)\n```"}, "insertText": "Two", "insertTextFormat": 2 }, { "label": "Three(_, _)", "kind": 4, "tags": [], - "detail": "Three(int, string)\n\ntype someVariant = One | Two | Three(int, string)", - "documentation": null, + "detail": "Three(int, string)", + "documentation": {"kind": "markdown", "value": "```rescript\nThree(int, string)\n```\n\n```rescript\ntype someVariant = One | Two | Three(int, string)\n```"}, "insertText": "Three(${1:_}, ${2:_})", "insertTextFormat": 2 }] @@ -160,8 +160,8 @@ Path someFnTakingVariant "label": "One", "kind": 4, "tags": [], - "detail": "One\n\ntype someVariant = One | Two | Three(int, string)", - "documentation": null, + "detail": "One", + "documentation": {"kind": "markdown", "value": "```rescript\nOne\n```\n\n```rescript\ntype someVariant = One | Two | Three(int, string)\n```"}, "sortText": "A One", "insertText": "One", "insertTextFormat": 2 @@ -169,20 +169,28 @@ Path someFnTakingVariant "label": "OIncludeMeInCompletions", "kind": 9, "tags": [], - "detail": "module", + "detail": "module OIncludeMeInCompletions", "documentation": null }, { "label": "Obj", "kind": 9, "tags": [], - "detail": "file module", - "documentation": null + "detail": "module Obj", + "documentation": null, + "data": { + "modulePath": "Obj", + "filePath": "src/CompletionFunctionArguments.res" + } }, { "label": "Objects", "kind": 9, "tags": [], - "detail": "file module", - "documentation": null + "detail": "module Objects", + "documentation": null, + "data": { + "modulePath": "Objects", + "filePath": "src/CompletionFunctionArguments.res" + } }] Complete src/CompletionFunctionArguments.res 57:33 @@ -199,7 +207,7 @@ Path someFnTakingVariant "kind": 12, "tags": [], "detail": "someVariant", - "documentation": null, + "documentation": {"kind": "markdown", "value": "```rescript\ntype someVariant = One | Two | Three(int, string)\n```"}, "sortText": "A Some(_)", "insertText": "Some($0)", "insertTextFormat": 2 @@ -207,8 +215,12 @@ Path someFnTakingVariant "label": "Sort", "kind": 9, "tags": [], - "detail": "file module", - "documentation": null + "detail": "module Sort", + "documentation": null, + "data": { + "modulePath": "Sort", + "filePath": "src/CompletionFunctionArguments.res" + } }] Complete src/CompletionFunctionArguments.res 60:44 @@ -224,8 +236,8 @@ Path someFnTakingVariant "label": "One", "kind": 4, "tags": [], - "detail": "One\n\ntype someVariant = One | Two | Three(int, string)", - "documentation": null, + "detail": "One", + "documentation": {"kind": "markdown", "value": "```rescript\nOne\n```\n\n```rescript\ntype someVariant = One | Two | Three(int, string)\n```"}, "sortText": "A One", "insertText": "One", "insertTextFormat": 2 @@ -233,20 +245,28 @@ Path someFnTakingVariant "label": "OIncludeMeInCompletions", "kind": 9, "tags": [], - "detail": "module", + "detail": "module OIncludeMeInCompletions", "documentation": null }, { "label": "Obj", "kind": 9, "tags": [], - "detail": "file module", - "documentation": null + "detail": "module Obj", + "documentation": null, + "data": { + "modulePath": "Obj", + "filePath": "src/CompletionFunctionArguments.res" + } }, { "label": "Objects", "kind": 9, "tags": [], - "detail": "file module", - "documentation": null + "detail": "module Objects", + "documentation": null, + "data": { + "modulePath": "Objects", + "filePath": "src/CompletionFunctionArguments.res" + } }] Complete src/CompletionFunctionArguments.res 63:23 @@ -350,20 +370,20 @@ Path fnTakingRecord "label": "age", "kind": 5, "tags": [], - "detail": "age: int\n\nsomeRecord", - "documentation": null + "detail": "int", + "documentation": {"kind": "markdown", "value": "```rescript\nage: int\n```\n\n```rescript\ntype someRecord = {age: int, offline: bool, online: option}\n```"} }, { "label": "offline", "kind": 5, "tags": [], - "detail": "offline: bool\n\nsomeRecord", - "documentation": null + "detail": "bool", + "documentation": {"kind": "markdown", "value": "```rescript\noffline: bool\n```\n\n```rescript\ntype someRecord = {age: int, offline: bool, online: option}\n```"} }, { "label": "online", "kind": 5, "tags": [], - "detail": "online: option\n\nsomeRecord", - "documentation": null + "detail": "option", + "documentation": {"kind": "markdown", "value": "```rescript\nonline: option\n```\n\n```rescript\ntype someRecord = {age: int, offline: bool, online: option}\n```"} }] Complete src/CompletionFunctionArguments.res 109:29 diff --git a/analysis/tests/src/expected/CompletionInferValues.res.txt b/analysis/tests/src/expected/CompletionInferValues.res.txt index 79789d9ff..356a23819 100644 --- a/analysis/tests/src/expected/CompletionInferValues.res.txt +++ b/analysis/tests/src/expected/CompletionInferValues.res.txt @@ -41,14 +41,14 @@ Path getSomeRecord "label": "name", "kind": 5, "tags": [], - "detail": "name: string\n\ntype someRecord = {name: string, age: int}", - "documentation": null + "detail": "string", + "documentation": {"kind": "markdown", "value": "```rescript\nname: string\n```\n\n```rescript\ntype someRecord = {name: string, age: int}\n```"} }, { "label": "age", "kind": 5, "tags": [], - "detail": "age: int\n\ntype someRecord = {name: string, age: int}", - "documentation": null + "detail": "int", + "documentation": {"kind": "markdown", "value": "```rescript\nage: int\n```\n\n```rescript\ntype someRecord = {name: string, age: int}\n```"} }] Complete src/CompletionInferValues.res 21:53 @@ -69,14 +69,14 @@ Path getSomeRecord "label": "name", "kind": 5, "tags": [], - "detail": "name: string\n\ntype someRecord = {name: string, age: int}", - "documentation": null + "detail": "string", + "documentation": {"kind": "markdown", "value": "```rescript\nname: string\n```\n\n```rescript\ntype someRecord = {name: string, age: int}\n```"} }, { "label": "age", "kind": 5, "tags": [], - "detail": "age: int\n\ntype someRecord = {name: string, age: int}", - "documentation": null + "detail": "int", + "documentation": {"kind": "markdown", "value": "```rescript\nage: int\n```\n\n```rescript\ntype someRecord = {name: string, age: int}\n```"} }] Complete src/CompletionInferValues.res 24:63 @@ -102,14 +102,14 @@ Path someFnWithCallback "label": "name", "kind": 5, "tags": [], - "detail": "name: string\n\ntype someRecord = {name: string, age: int}", - "documentation": null + "detail": "string", + "documentation": {"kind": "markdown", "value": "```rescript\nname: string\n```\n\n```rescript\ntype someRecord = {name: string, age: int}\n```"} }, { "label": "age", "kind": 5, "tags": [], - "detail": "age: int\n\ntype someRecord = {name: string, age: int}", - "documentation": null + "detail": "int", + "documentation": {"kind": "markdown", "value": "```rescript\nage: int\n```\n\n```rescript\ntype someRecord = {name: string, age: int}\n```"} }] Complete src/CompletionInferValues.res 27:90 @@ -137,14 +137,14 @@ Path someFnWithCallback "label": "name", "kind": 5, "tags": [], - "detail": "name: string\n\ntype someRecord = {name: string, age: int}", - "documentation": null + "detail": "string", + "documentation": {"kind": "markdown", "value": "```rescript\nname: string\n```\n\n```rescript\ntype someRecord = {name: string, age: int}\n```"} }, { "label": "age", "kind": 5, "tags": [], - "detail": "age: int\n\ntype someRecord = {name: string, age: int}", - "documentation": null + "detail": "int", + "documentation": {"kind": "markdown", "value": "```rescript\nage: int\n```\n\n```rescript\ntype someRecord = {name: string, age: int}\n```"} }] Complete src/CompletionInferValues.res 30:36 @@ -353,14 +353,14 @@ Path someRecord "label": "name", "kind": 5, "tags": [], - "detail": "name: string\n\ntype someRecord = {name: string, age: int}", - "documentation": null + "detail": "string", + "documentation": {"kind": "markdown", "value": "```rescript\nname: string\n```\n\n```rescript\ntype someRecord = {name: string, age: int}\n```"} }, { "label": "age", "kind": 5, "tags": [], - "detail": "age: int\n\ntype someRecord = {name: string, age: int}", - "documentation": null + "detail": "int", + "documentation": {"kind": "markdown", "value": "```rescript\nage: int\n```\n\n```rescript\ntype someRecord = {name: string, age: int}\n```"} }] Complete src/CompletionInferValues.res 78:78 @@ -381,14 +381,14 @@ Path someRecordWithNestedStuff "label": "name", "kind": 5, "tags": [], - "detail": "name: string\n\ntype someRecord = {name: string, age: int}", - "documentation": null + "detail": "string", + "documentation": {"kind": "markdown", "value": "```rescript\nname: string\n```\n\n```rescript\ntype someRecord = {name: string, age: int}\n```"} }, { "label": "age", "kind": 5, "tags": [], - "detail": "age: int\n\ntype someRecord = {name: string, age: int}", - "documentation": null + "detail": "int", + "documentation": {"kind": "markdown", "value": "```rescript\nage: int\n```\n\n```rescript\ntype someRecord = {name: string, age: int}\n```"} }] Complete src/CompletionInferValues.res 82:86 @@ -409,8 +409,8 @@ Path someRecordWithNestedStuff "label": "someRecord", "kind": 5, "tags": [], - "detail": "someRecord: someRecord\n\ntype someNestedRecord = {someRecord: someRecord}", - "documentation": null + "detail": "someRecord", + "documentation": {"kind": "markdown", "value": "```rescript\nsomeRecord: someRecord\n```\n\n```rescript\ntype someNestedRecord = {someRecord: someRecord}\n```"} }] Complete src/CompletionInferValues.res 86:103 @@ -431,14 +431,14 @@ Path someRecordWithNestedStuff "label": "name", "kind": 5, "tags": [], - "detail": "name: string\n\ntype someRecord = {name: string, age: int}", - "documentation": null + "detail": "string", + "documentation": {"kind": "markdown", "value": "```rescript\nname: string\n```\n\n```rescript\ntype someRecord = {name: string, age: int}\n```"} }, { "label": "age", "kind": 5, "tags": [], - "detail": "age: int\n\ntype someRecord = {name: string, age: int}", - "documentation": null + "detail": "int", + "documentation": {"kind": "markdown", "value": "```rescript\nage: int\n```\n\n```rescript\ntype someRecord = {name: string, age: int}\n```"} }] Complete src/CompletionInferValues.res 90:81 @@ -652,14 +652,14 @@ Path otherNestedRecord "label": "someRecord", "kind": 5, "tags": [], - "detail": "someRecord: someRecord\n\ntype otherNestedRecord = {someRecord: someRecord, someTuple: (someVariant, int, somePolyVariant), optRecord: option}", - "documentation": null + "detail": "someRecord", + "documentation": {"kind": "markdown", "value": "```rescript\nsomeRecord: someRecord\n```\n\n```rescript\ntype otherNestedRecord = {someRecord: someRecord, someTuple: (someVariant, int, somePolyVariant), optRecord: option}\n```"} }, { "label": "someTuple", "kind": 5, "tags": [], - "detail": "someTuple: (someVariant, int, somePolyVariant)\n\ntype otherNestedRecord = {someRecord: someRecord, someTuple: (someVariant, int, somePolyVariant), optRecord: option}", - "documentation": null + "detail": "(someVariant, int, somePolyVariant)", + "documentation": {"kind": "markdown", "value": "```rescript\nsomeTuple: (someVariant, int, somePolyVariant)\n```\n\n```rescript\ntype otherNestedRecord = {someRecord: someRecord, someTuple: (someVariant, int, somePolyVariant), optRecord: option}\n```"} }] Complete src/CompletionInferValues.res 122:53 @@ -701,14 +701,14 @@ Path fnWithRecordCallback "label": "name", "kind": 5, "tags": [], - "detail": "name: string\n\nsomeRecord", - "documentation": null + "detail": "string", + "documentation": {"kind": "markdown", "value": "```rescript\nname: string\n```\n\n```rescript\ntype someRecord = {name: string, age: int}\n```"} }, { "label": "age", "kind": 5, "tags": [], - "detail": "age: int\n\nsomeRecord", - "documentation": null + "detail": "int", + "documentation": {"kind": "markdown", "value": "```rescript\nage: int\n```\n\n```rescript\ntype someRecord = {name: string, age: int}\n```"} }] Complete src/CompletionInferValues.res 137:30 @@ -849,8 +849,8 @@ Path CompletionSupport2.makeRenderer "label": "root", "kind": 5, "tags": [], - "detail": "root: ReactDOM.Client.Root.t\n\ntype config = {root: ReactDOM.Client.Root.t}", - "documentation": null + "detail": "ReactDOM.Client.Root.t", + "documentation": {"kind": "markdown", "value": "```rescript\nroot: ReactDOM.Client.Root.t\n```\n\n```rescript\ntype config = {root: ReactDOM.Client.Root.t}\n```"} }] Complete src/CompletionInferValues.res 162:110 diff --git a/analysis/tests/src/expected/CompletionJsx.res.txt b/analysis/tests/src/expected/CompletionJsx.res.txt index 3760079bb..f860d8a87 100644 --- a/analysis/tests/src/expected/CompletionJsx.res.txt +++ b/analysis/tests/src/expected/CompletionJsx.res.txt @@ -534,16 +534,16 @@ Path MultiPropComp.make "label": "Now", "kind": 4, "tags": [], - "detail": "Now\n\ntype time = Now | Later", - "documentation": null, + "detail": "Now", + "documentation": {"kind": "markdown", "value": "```rescript\nNow\n```\n\n```rescript\ntype time = Now | Later\n```"}, "insertText": "{Now}", "insertTextFormat": 2 }, { "label": "Later", "kind": 4, "tags": [], - "detail": "Later\n\ntype time = Now | Later", - "documentation": null, + "detail": "Later", + "documentation": {"kind": "markdown", "value": "```rescript\nLater\n```\n\n```rescript\ntype time = Now | Later\n```"}, "insertText": "{Later}", "insertTextFormat": 2 }] @@ -560,16 +560,16 @@ Path MultiPropComp.make "label": "Now", "kind": 4, "tags": [], - "detail": "Now\n\ntype time = Now | Later", - "documentation": null, + "detail": "Now", + "documentation": {"kind": "markdown", "value": "```rescript\nNow\n```\n\n```rescript\ntype time = Now | Later\n```"}, "insertText": "{Now}", "insertTextFormat": 2 }, { "label": "Later", "kind": 4, "tags": [], - "detail": "Later\n\ntype time = Now | Later", - "documentation": null, + "detail": "Later", + "documentation": {"kind": "markdown", "value": "```rescript\nLater\n```\n\n```rescript\ntype time = Now | Later\n```"}, "insertText": "{Later}", "insertTextFormat": 2 }] @@ -586,16 +586,16 @@ Path MultiPropComp.make "label": "Now", "kind": 4, "tags": [], - "detail": "Now\n\ntype time = Now | Later", - "documentation": null, + "detail": "Now", + "documentation": {"kind": "markdown", "value": "```rescript\nNow\n```\n\n```rescript\ntype time = Now | Later\n```"}, "insertText": "{Now}", "insertTextFormat": 2 }, { "label": "Later", "kind": 4, "tags": [], - "detail": "Later\n\ntype time = Now | Later", - "documentation": null, + "detail": "Later", + "documentation": {"kind": "markdown", "value": "```rescript\nLater\n```\n\n```rescript\ntype time = Now | Later\n```"}, "insertText": "{Later}", "insertTextFormat": 2 }] diff --git a/analysis/tests/src/expected/CompletionJsxProps.res.txt b/analysis/tests/src/expected/CompletionJsxProps.res.txt index f5aa6685f..1f0b42748 100644 --- a/analysis/tests/src/expected/CompletionJsxProps.res.txt +++ b/analysis/tests/src/expected/CompletionJsxProps.res.txt @@ -48,8 +48,8 @@ Path CompletionSupport.TestComponent.make "label": "Two", "kind": 4, "tags": [], - "detail": "Two\n\ntype testVariant = One | Two | Three(int)", - "documentation": null, + "detail": "Two", + "documentation": {"kind": "markdown", "value": "```rescript\nTwo\n```\n\n```rescript\ntype testVariant = One | Two | Three(int)\n```"}, "sortText": "A Two", "insertText": "{Two}", "insertTextFormat": 2 @@ -57,8 +57,8 @@ Path CompletionSupport.TestComponent.make "label": "Three(_)", "kind": 4, "tags": [], - "detail": "Three(int)\n\ntype testVariant = One | Two | Three(int)", - "documentation": null, + "detail": "Three(int)", + "documentation": {"kind": "markdown", "value": "```rescript\nThree(int)\n```\n\n```rescript\ntype testVariant = One | Two | Three(int)\n```"}, "sortText": "A Three(_)", "insertText": "{Three($0)}", "insertTextFormat": 2 @@ -66,20 +66,32 @@ Path CompletionSupport.TestComponent.make "label": "TableclothMap", "kind": 9, "tags": [], - "detail": "file module", - "documentation": null + "detail": "module TableclothMap", + "documentation": null, + "data": { + "modulePath": "TableclothMap", + "filePath": "src/CompletionJsxProps.res" + } }, { "label": "TypeAtPosCompletion", "kind": 9, "tags": [], - "detail": "file module", - "documentation": null + "detail": "module TypeAtPosCompletion", + "documentation": null, + "data": { + "modulePath": "TypeAtPosCompletion", + "filePath": "src/CompletionJsxProps.res" + } }, { "label": "TypeDefinition", "kind": 9, "tags": [], - "detail": "file module", - "documentation": null + "detail": "module TypeDefinition", + "documentation": null, + "data": { + "modulePath": "TypeDefinition", + "filePath": "src/CompletionJsxProps.res" + } }] Complete src/CompletionJsxProps.res 9:52 @@ -94,32 +106,32 @@ Path CompletionSupport.TestComponent.make "label": "#one", "kind": 4, "tags": [], - "detail": "#one\n\n[#one | #three(int, bool) | #two | #two2]", - "documentation": null, + "detail": "#one", + "documentation": {"kind": "markdown", "value": "```rescript\n#one\n```\n\n```rescript\n[#one | #three(int, bool) | #two | #two2]\n```"}, "insertText": "{#one}", "insertTextFormat": 2 }, { "label": "#three(_, _)", "kind": 4, "tags": [], - "detail": "#three(int, bool)\n\n[#one | #three(int, bool) | #two | #two2]", - "documentation": null, + "detail": "#three(int, bool)", + "documentation": {"kind": "markdown", "value": "```rescript\n#three(int, bool)\n```\n\n```rescript\n[#one | #three(int, bool) | #two | #two2]\n```"}, "insertText": "{#three(${1:_}, ${2:_})}", "insertTextFormat": 2 }, { "label": "#two", "kind": 4, "tags": [], - "detail": "#two\n\n[#one | #three(int, bool) | #two | #two2]", - "documentation": null, + "detail": "#two", + "documentation": {"kind": "markdown", "value": "```rescript\n#two\n```\n\n```rescript\n[#one | #three(int, bool) | #two | #two2]\n```"}, "insertText": "{#two}", "insertTextFormat": 2 }, { "label": "#two2", "kind": 4, "tags": [], - "detail": "#two2\n\n[#one | #three(int, bool) | #two | #two2]", - "documentation": null, + "detail": "#two2", + "documentation": {"kind": "markdown", "value": "```rescript\n#two2\n```\n\n```rescript\n[#one | #three(int, bool) | #two | #two2]\n```"}, "insertText": "{#two2}", "insertTextFormat": 2 }] @@ -136,24 +148,24 @@ Path CompletionSupport.TestComponent.make "label": "#three(_, _)", "kind": 4, "tags": [], - "detail": "#three(int, bool)\n\n[#one | #three(int, bool) | #two | #two2]", - "documentation": null, + "detail": "#three(int, bool)", + "documentation": {"kind": "markdown", "value": "```rescript\n#three(int, bool)\n```\n\n```rescript\n[#one | #three(int, bool) | #two | #two2]\n```"}, "insertText": "{three(${1:_}, ${2:_})}", "insertTextFormat": 2 }, { "label": "#two", "kind": 4, "tags": [], - "detail": "#two\n\n[#one | #three(int, bool) | #two | #two2]", - "documentation": null, + "detail": "#two", + "documentation": {"kind": "markdown", "value": "```rescript\n#two\n```\n\n```rescript\n[#one | #three(int, bool) | #two | #two2]\n```"}, "insertText": "{two}", "insertTextFormat": 2 }, { "label": "#two2", "kind": 4, "tags": [], - "detail": "#two2\n\n[#one | #three(int, bool) | #two | #two2]", - "documentation": null, + "detail": "#two2", + "documentation": {"kind": "markdown", "value": "```rescript\n#two2\n```\n\n```rescript\n[#one | #three(int, bool) | #two | #two2]\n```"}, "insertText": "{two2}", "insertTextFormat": 2 }] @@ -214,7 +226,7 @@ Path CompletionSupport.TestComponent.make "kind": 12, "tags": [], "detail": "testVariant", - "documentation": null, + "documentation": {"kind": "markdown", "value": "```rescript\ntype testVariant = One | Two | Three(int)\n```"}, "sortText": "A", "insertText": "{[$0]}", "insertTextFormat": 2 @@ -232,24 +244,24 @@ Path CompletionSupport.TestComponent.make "label": "One", "kind": 4, "tags": [], - "detail": "One\n\ntype testVariant = One | Two | Three(int)", - "documentation": null, + "detail": "One", + "documentation": {"kind": "markdown", "value": "```rescript\nOne\n```\n\n```rescript\ntype testVariant = One | Two | Three(int)\n```"}, "insertText": "One", "insertTextFormat": 2 }, { "label": "Two", "kind": 4, "tags": [], - "detail": "Two\n\ntype testVariant = One | Two | Three(int)", - "documentation": null, + "detail": "Two", + "documentation": {"kind": "markdown", "value": "```rescript\nTwo\n```\n\n```rescript\ntype testVariant = One | Two | Three(int)\n```"}, "insertText": "Two", "insertTextFormat": 2 }, { "label": "Three(_)", "kind": 4, "tags": [], - "detail": "Three(int)\n\ntype testVariant = One | Two | Three(int)", - "documentation": null, + "detail": "Three(int)", + "documentation": {"kind": "markdown", "value": "```rescript\nThree(int)\n```\n\n```rescript\ntype testVariant = One | Two | Three(int)\n```"}, "insertText": "Three($0)", "insertTextFormat": 2 }] @@ -266,32 +278,32 @@ Path CompletionSupport.TestComponent.make "label": "#one", "kind": 4, "tags": [], - "detail": "#one\n\n[#one | #three(int, bool) | #two | #two2]", - "documentation": null, + "detail": "#one", + "documentation": {"kind": "markdown", "value": "```rescript\n#one\n```\n\n```rescript\n[#one | #three(int, bool) | #two | #two2]\n```"}, "insertText": "#one", "insertTextFormat": 2 }, { "label": "#three(_, _)", "kind": 4, "tags": [], - "detail": "#three(int, bool)\n\n[#one | #three(int, bool) | #two | #two2]", - "documentation": null, + "detail": "#three(int, bool)", + "documentation": {"kind": "markdown", "value": "```rescript\n#three(int, bool)\n```\n\n```rescript\n[#one | #three(int, bool) | #two | #two2]\n```"}, "insertText": "#three(${1:_}, ${2:_})", "insertTextFormat": 2 }, { "label": "#two", "kind": 4, "tags": [], - "detail": "#two\n\n[#one | #three(int, bool) | #two | #two2]", - "documentation": null, + "detail": "#two", + "documentation": {"kind": "markdown", "value": "```rescript\n#two\n```\n\n```rescript\n[#one | #three(int, bool) | #two | #two2]\n```"}, "insertText": "#two", "insertTextFormat": 2 }, { "label": "#two2", "kind": 4, "tags": [], - "detail": "#two2\n\n[#one | #three(int, bool) | #two | #two2]", - "documentation": null, + "detail": "#two2", + "documentation": {"kind": "markdown", "value": "```rescript\n#two2\n```\n\n```rescript\n[#one | #three(int, bool) | #two | #two2]\n```"}, "insertText": "#two2", "insertTextFormat": 2 }] diff --git a/analysis/tests/src/expected/CompletionPattern.res.txt b/analysis/tests/src/expected/CompletionPattern.res.txt index 6cb2a79ba..99b8b188d 100644 --- a/analysis/tests/src/expected/CompletionPattern.res.txt +++ b/analysis/tests/src/expected/CompletionPattern.res.txt @@ -100,7 +100,7 @@ Path f "kind": 22, "tags": [], "detail": "someRecord", - "documentation": null, + "documentation": {"kind": "markdown", "value": "```rescript\ntype someRecord = {first: int, second: (bool, option), optThird: option<[#first | #second(someRecord)]>, nest: nestedRecord}\n```"}, "sortText": "A", "insertText": "{$0}", "insertTextFormat": 2 @@ -117,26 +117,26 @@ Path f "label": "first", "kind": 5, "tags": [], - "detail": "first: int\n\nsomeRecord", - "documentation": null + "detail": "int", + "documentation": {"kind": "markdown", "value": "```rescript\nfirst: int\n```\n\n```rescript\ntype someRecord = {first: int, second: (bool, option), optThird: option<[#first | #second(someRecord)]>, nest: nestedRecord}\n```"} }, { "label": "second", "kind": 5, "tags": [], - "detail": "second: (bool, option)\n\nsomeRecord", - "documentation": null + "detail": "(bool, option)", + "documentation": {"kind": "markdown", "value": "```rescript\nsecond: (bool, option)\n```\n\n```rescript\ntype someRecord = {first: int, second: (bool, option), optThird: option<[#first | #second(someRecord)]>, nest: nestedRecord}\n```"} }, { "label": "optThird", "kind": 5, "tags": [], - "detail": "optThird: option<[#first | #second(someRecord)]>\n\nsomeRecord", - "documentation": null + "detail": "option<[#first | #second(someRecord)]>", + "documentation": {"kind": "markdown", "value": "```rescript\noptThird: option<[#first | #second(someRecord)]>\n```\n\n```rescript\ntype someRecord = {first: int, second: (bool, option), optThird: option<[#first | #second(someRecord)]>, nest: nestedRecord}\n```"} }, { "label": "nest", "kind": 5, "tags": [], - "detail": "nest: nestedRecord\n\nsomeRecord", - "documentation": null + "detail": "nestedRecord", + "documentation": {"kind": "markdown", "value": "```rescript\nnest: nestedRecord\n```\n\n```rescript\ntype someRecord = {first: int, second: (bool, option), optThird: option<[#first | #second(someRecord)]>, nest: nestedRecord}\n```"} }] Complete src/CompletionPattern.res 52:24 @@ -150,14 +150,14 @@ Path f "label": "optThird", "kind": 5, "tags": [], - "detail": "optThird: option<[#first | #second(someRecord)]>\n\nsomeRecord", - "documentation": null + "detail": "option<[#first | #second(someRecord)]>", + "documentation": {"kind": "markdown", "value": "```rescript\noptThird: option<[#first | #second(someRecord)]>\n```\n\n```rescript\ntype someRecord = {first: int, second: (bool, option), optThird: option<[#first | #second(someRecord)]>, nest: nestedRecord}\n```"} }, { "label": "nest", "kind": 5, "tags": [], - "detail": "nest: nestedRecord\n\nsomeRecord", - "documentation": null + "detail": "nestedRecord", + "documentation": {"kind": "markdown", "value": "```rescript\nnest: nestedRecord\n```\n\n```rescript\ntype someRecord = {first: int, second: (bool, option), optThird: option<[#first | #second(someRecord)]>, nest: nestedRecord}\n```"} }] Complete src/CompletionPattern.res 55:19 @@ -172,8 +172,8 @@ Path f "label": "first", "kind": 5, "tags": [], - "detail": "first: int\n\nsomeRecord", - "documentation": null + "detail": "int", + "documentation": {"kind": "markdown", "value": "```rescript\nfirst: int\n```\n\n```rescript\ntype someRecord = {first: int, second: (bool, option), optThird: option<[#first | #second(someRecord)]>, nest: nestedRecord}\n```"} }] Complete src/CompletionPattern.res 58:19 @@ -189,8 +189,8 @@ Path z "label": "optThird", "kind": 5, "tags": [], - "detail": "optThird: option<[#first | #second(someRecord)]>\n\nsomeRecord", - "documentation": null + "detail": "option<[#first | #second(someRecord)]>", + "documentation": {"kind": "markdown", "value": "```rescript\noptThird: option<[#first | #second(someRecord)]>\n```\n\n```rescript\ntype someRecord = {first: int, second: (bool, option), optThird: option<[#first | #second(someRecord)]>, nest: nestedRecord}\n```"} }] Complete src/CompletionPattern.res 61:22 @@ -205,7 +205,7 @@ Path f "kind": 22, "tags": [], "detail": "nestedRecord", - "documentation": null, + "documentation": {"kind": "markdown", "value": "```rescript\ntype nestedRecord = {nested: bool}\n```"}, "sortText": "A", "insertText": "{$0}", "insertTextFormat": 2 @@ -223,8 +223,8 @@ Path f "label": "nested", "kind": 5, "tags": [], - "detail": "nested: bool\n\nnestedRecord", - "documentation": null + "detail": "bool", + "documentation": {"kind": "markdown", "value": "```rescript\nnested: bool\n```\n\n```rescript\ntype nestedRecord = {nested: bool}\n```"} }] Complete src/CompletionPattern.res 70:22 @@ -240,8 +240,8 @@ Path nest "label": "nested", "kind": 5, "tags": [], - "detail": "nested: bool\n\nnestedRecord", - "documentation": null + "detail": "bool", + "documentation": {"kind": "markdown", "value": "```rescript\nnested: bool\n```\n\n```rescript\ntype nestedRecord = {nested: bool}\n```"} }] Complete src/CompletionPattern.res 76:8 @@ -255,26 +255,26 @@ Path f "label": "first", "kind": 5, "tags": [], - "detail": "first: int\n\nsomeRecord", - "documentation": null + "detail": "int", + "documentation": {"kind": "markdown", "value": "```rescript\nfirst: int\n```\n\n```rescript\ntype someRecord = {first: int, second: (bool, option), optThird: option<[#first | #second(someRecord)]>, nest: nestedRecord}\n```"} }, { "label": "second", "kind": 5, "tags": [], - "detail": "second: (bool, option)\n\nsomeRecord", - "documentation": null + "detail": "(bool, option)", + "documentation": {"kind": "markdown", "value": "```rescript\nsecond: (bool, option)\n```\n\n```rescript\ntype someRecord = {first: int, second: (bool, option), optThird: option<[#first | #second(someRecord)]>, nest: nestedRecord}\n```"} }, { "label": "optThird", "kind": 5, "tags": [], - "detail": "optThird: option<[#first | #second(someRecord)]>\n\nsomeRecord", - "documentation": null + "detail": "option<[#first | #second(someRecord)]>", + "documentation": {"kind": "markdown", "value": "```rescript\noptThird: option<[#first | #second(someRecord)]>\n```\n\n```rescript\ntype someRecord = {first: int, second: (bool, option), optThird: option<[#first | #second(someRecord)]>, nest: nestedRecord}\n```"} }, { "label": "nest", "kind": 5, "tags": [], - "detail": "nest: nestedRecord\n\nsomeRecord", - "documentation": null + "detail": "nestedRecord", + "documentation": {"kind": "markdown", "value": "```rescript\nnest: nestedRecord\n```\n\n```rescript\ntype someRecord = {first: int, second: (bool, option), optThird: option<[#first | #second(someRecord)]>, nest: nestedRecord}\n```"} }] Complete src/CompletionPattern.res 79:16 @@ -290,8 +290,8 @@ Path f "label": "nested", "kind": 5, "tags": [], - "detail": "nested: bool\n\nnestedRecord", - "documentation": null + "detail": "bool", + "documentation": {"kind": "markdown", "value": "```rescript\nnested: bool\n```\n\n```rescript\ntype nestedRecord = {nested: bool}\n```"} }] Complete src/CompletionPattern.res 87:20 @@ -348,26 +348,26 @@ Path z "label": "first", "kind": 5, "tags": [], - "detail": "first: int\n\nsomeRecord", - "documentation": null + "detail": "int", + "documentation": {"kind": "markdown", "value": "```rescript\nfirst: int\n```\n\n```rescript\ntype someRecord = {first: int, second: (bool, option), optThird: option<[#first | #second(someRecord)]>, nest: nestedRecord}\n```"} }, { "label": "second", "kind": 5, "tags": [], - "detail": "second: (bool, option)\n\nsomeRecord", - "documentation": null + "detail": "(bool, option)", + "documentation": {"kind": "markdown", "value": "```rescript\nsecond: (bool, option)\n```\n\n```rescript\ntype someRecord = {first: int, second: (bool, option), optThird: option<[#first | #second(someRecord)]>, nest: nestedRecord}\n```"} }, { "label": "optThird", "kind": 5, "tags": [], - "detail": "optThird: option<[#first | #second(someRecord)]>\n\nsomeRecord", - "documentation": null + "detail": "option<[#first | #second(someRecord)]>", + "documentation": {"kind": "markdown", "value": "```rescript\noptThird: option<[#first | #second(someRecord)]>\n```\n\n```rescript\ntype someRecord = {first: int, second: (bool, option), optThird: option<[#first | #second(someRecord)]>, nest: nestedRecord}\n```"} }, { "label": "nest", "kind": 5, "tags": [], - "detail": "nest: nestedRecord\n\nsomeRecord", - "documentation": null + "detail": "nestedRecord", + "documentation": {"kind": "markdown", "value": "```rescript\nnest: nestedRecord\n```\n\n```rescript\ntype someRecord = {first: int, second: (bool, option), optThird: option<[#first | #second(someRecord)]>, nest: nestedRecord}\n```"} }] Complete src/CompletionPattern.res 96:27 @@ -439,26 +439,26 @@ Path b "label": "first", "kind": 5, "tags": [], - "detail": "first: int\n\nsomeRecord", - "documentation": null + "detail": "int", + "documentation": {"kind": "markdown", "value": "```rescript\nfirst: int\n```\n\n```rescript\ntype someRecord = {first: int, second: (bool, option), optThird: option<[#first | #second(someRecord)]>, nest: nestedRecord}\n```"} }, { "label": "second", "kind": 5, "tags": [], - "detail": "second: (bool, option)\n\nsomeRecord", - "documentation": null + "detail": "(bool, option)", + "documentation": {"kind": "markdown", "value": "```rescript\nsecond: (bool, option)\n```\n\n```rescript\ntype someRecord = {first: int, second: (bool, option), optThird: option<[#first | #second(someRecord)]>, nest: nestedRecord}\n```"} }, { "label": "optThird", "kind": 5, "tags": [], - "detail": "optThird: option<[#first | #second(someRecord)]>\n\nsomeRecord", - "documentation": null + "detail": "option<[#first | #second(someRecord)]>", + "documentation": {"kind": "markdown", "value": "```rescript\noptThird: option<[#first | #second(someRecord)]>\n```\n\n```rescript\ntype someRecord = {first: int, second: (bool, option), optThird: option<[#first | #second(someRecord)]>, nest: nestedRecord}\n```"} }, { "label": "nest", "kind": 5, "tags": [], - "detail": "nest: nestedRecord\n\nsomeRecord", - "documentation": null + "detail": "nestedRecord", + "documentation": {"kind": "markdown", "value": "```rescript\nnest: nestedRecord\n```\n\n```rescript\ntype someRecord = {first: int, second: (bool, option), optThird: option<[#first | #second(someRecord)]>, nest: nestedRecord}\n```"} }] Complete src/CompletionPattern.res 112:28 @@ -896,24 +896,24 @@ Path z "label": "One", "kind": 4, "tags": [], - "detail": "One\n\ntype someVariant = One | Two(bool) | Three(someRecord, bool)", - "documentation": null, + "detail": "One", + "documentation": {"kind": "markdown", "value": "```rescript\nOne\n```\n\n```rescript\ntype someVariant = One | Two(bool) | Three(someRecord, bool)\n```"}, "insertText": "One", "insertTextFormat": 2 }, { "label": "Two(_)", "kind": 4, "tags": [], - "detail": "Two(bool)\n\ntype someVariant = One | Two(bool) | Three(someRecord, bool)", - "documentation": null, + "detail": "Two(bool)", + "documentation": {"kind": "markdown", "value": "```rescript\nTwo(bool)\n```\n\n```rescript\ntype someVariant = One | Two(bool) | Three(someRecord, bool)\n```"}, "insertText": "Two(${1:_})", "insertTextFormat": 2 }, { "label": "Three(_, _)", "kind": 4, "tags": [], - "detail": "Three(someRecord, bool)\n\ntype someVariant = One | Two(bool) | Three(someRecord, bool)", - "documentation": null, + "detail": "Three(someRecord, bool)", + "documentation": {"kind": "markdown", "value": "```rescript\nThree(someRecord, bool)\n```\n\n```rescript\ntype someVariant = One | Two(bool) | Three(someRecord, bool)\n```"}, "insertText": "Three(${1:_}, ${2:_})", "insertTextFormat": 2 }] @@ -1083,24 +1083,24 @@ Path getThing "label": "One", "kind": 4, "tags": [], - "detail": "One\n\ntype someVariant = One | Two(bool) | Three(someRecord, bool)", - "documentation": null, + "detail": "One", + "documentation": {"kind": "markdown", "value": "```rescript\nOne\n```\n\n```rescript\ntype someVariant = One | Two(bool) | Three(someRecord, bool)\n```"}, "insertText": "One", "insertTextFormat": 2 }, { "label": "Two(_)", "kind": 4, "tags": [], - "detail": "Two(bool)\n\ntype someVariant = One | Two(bool) | Three(someRecord, bool)", - "documentation": null, + "detail": "Two(bool)", + "documentation": {"kind": "markdown", "value": "```rescript\nTwo(bool)\n```\n\n```rescript\ntype someVariant = One | Two(bool) | Three(someRecord, bool)\n```"}, "insertText": "Two(${1:_})", "insertTextFormat": 2 }, { "label": "Three(_, _)", "kind": 4, "tags": [], - "detail": "Three(someRecord, bool)\n\ntype someVariant = One | Two(bool) | Three(someRecord, bool)", - "documentation": null, + "detail": "Three(someRecord, bool)", + "documentation": {"kind": "markdown", "value": "```rescript\nThree(someRecord, bool)\n```\n\n```rescript\ntype someVariant = One | Two(bool) | Three(someRecord, bool)\n```"}, "insertText": "Three(${1:_}, ${2:_})", "insertTextFormat": 2 }] @@ -1119,24 +1119,24 @@ Path res "label": "One", "kind": 4, "tags": [], - "detail": "One\n\ntype someVariant = One | Two(bool) | Three(someRecord, bool)", - "documentation": null, + "detail": "One", + "documentation": {"kind": "markdown", "value": "```rescript\nOne\n```\n\n```rescript\ntype someVariant = One | Two(bool) | Three(someRecord, bool)\n```"}, "insertText": "One", "insertTextFormat": 2 }, { "label": "Two(_)", "kind": 4, "tags": [], - "detail": "Two(bool)\n\ntype someVariant = One | Two(bool) | Three(someRecord, bool)", - "documentation": null, + "detail": "Two(bool)", + "documentation": {"kind": "markdown", "value": "```rescript\nTwo(bool)\n```\n\n```rescript\ntype someVariant = One | Two(bool) | Three(someRecord, bool)\n```"}, "insertText": "Two(${1:_})", "insertTextFormat": 2 }, { "label": "Three(_, _)", "kind": 4, "tags": [], - "detail": "Three(someRecord, bool)\n\ntype someVariant = One | Two(bool) | Three(someRecord, bool)", - "documentation": null, + "detail": "Three(someRecord, bool)", + "documentation": {"kind": "markdown", "value": "```rescript\nThree(someRecord, bool)\n```\n\n```rescript\ntype someVariant = One | Two(bool) | Three(someRecord, bool)\n```"}, "insertText": "Three(${1:_}, ${2:_})", "insertTextFormat": 2 }] @@ -1155,24 +1155,24 @@ Path res "label": "#one", "kind": 4, "tags": [], - "detail": "#one\n\n[#one | #three(someRecord, bool) | #two(bool)]", - "documentation": null, + "detail": "#one", + "documentation": {"kind": "markdown", "value": "```rescript\n#one\n```\n\n```rescript\n[#one | #three(someRecord, bool) | #two(bool)]\n```"}, "insertText": "#one", "insertTextFormat": 2 }, { "label": "#three(_, _)", "kind": 4, "tags": [], - "detail": "#three(someRecord, bool)\n\n[#one | #three(someRecord, bool) | #two(bool)]", - "documentation": null, + "detail": "#three(someRecord, bool)", + "documentation": {"kind": "markdown", "value": "```rescript\n#three(someRecord, bool)\n```\n\n```rescript\n[#one | #three(someRecord, bool) | #two(bool)]\n```"}, "insertText": "#three(${1:_}, ${2:_})", "insertTextFormat": 2 }, { "label": "#two(_)", "kind": 4, "tags": [], - "detail": "#two(bool)\n\n[#one | #three(someRecord, bool) | #two(bool)]", - "documentation": null, + "detail": "#two(bool)", + "documentation": {"kind": "markdown", "value": "```rescript\n#two(bool)\n```\n\n```rescript\n[#one | #three(someRecord, bool) | #two(bool)]\n```"}, "insertText": "#two(${1:_})", "insertTextFormat": 2 }] @@ -1191,19 +1191,19 @@ Path r "label": "second", "kind": 5, "tags": [], - "detail": "second: (bool, option)\n\nsomeRecord", - "documentation": null + "detail": "(bool, option)", + "documentation": {"kind": "markdown", "value": "```rescript\nsecond: (bool, option)\n```\n\n```rescript\ntype someRecord = {first: int, second: (bool, option), optThird: option<[#first | #second(someRecord)]>, nest: nestedRecord}\n```"} }, { "label": "optThird", "kind": 5, "tags": [], - "detail": "optThird: option<[#first | #second(someRecord)]>\n\nsomeRecord", - "documentation": null + "detail": "option<[#first | #second(someRecord)]>", + "documentation": {"kind": "markdown", "value": "```rescript\noptThird: option<[#first | #second(someRecord)]>\n```\n\n```rescript\ntype someRecord = {first: int, second: (bool, option), optThird: option<[#first | #second(someRecord)]>, nest: nestedRecord}\n```"} }, { "label": "nest", "kind": 5, "tags": [], - "detail": "nest: nestedRecord\n\nsomeRecord", - "documentation": null + "detail": "nestedRecord", + "documentation": {"kind": "markdown", "value": "```rescript\nnest: nestedRecord\n```\n\n```rescript\ntype someRecord = {first: int, second: (bool, option), optThird: option<[#first | #second(someRecord)]>, nest: nestedRecord}\n```"} }] diff --git a/analysis/tests/src/expected/CompletionPipeSubmodules.res.txt b/analysis/tests/src/expected/CompletionPipeSubmodules.res.txt index 26dcf482c..73f9ab4a5 100644 --- a/analysis/tests/src/expected/CompletionPipeSubmodules.res.txt +++ b/analysis/tests/src/expected/CompletionPipeSubmodules.res.txt @@ -15,13 +15,13 @@ Path A.B1. "kind": 12, "tags": [], "detail": "b1", - "documentation": null + "documentation": {"kind": "markdown", "value": "```rescript\ntype b1 = B1\n```"} }, { "label": "A.B1.B1", "kind": 4, "tags": [], - "detail": "B1\n\ntype b1 = B1", - "documentation": null + "detail": "B1", + "documentation": {"kind": "markdown", "value": "```rescript\nB1\n```\n\n```rescript\ntype b1 = B1\n```"} }] Complete src/CompletionPipeSubmodules.res 16:18 @@ -42,13 +42,13 @@ Path A.B1. "kind": 12, "tags": [], "detail": "b1", - "documentation": null + "documentation": {"kind": "markdown", "value": "```rescript\ntype b1 = B1\n```"} }, { "label": "A.B1.B1", "kind": 4, "tags": [], - "detail": "B1\n\ntype b1 = B1", - "documentation": null + "detail": "B1", + "documentation": {"kind": "markdown", "value": "```rescript\nB1\n```\n\n```rescript\ntype b1 = B1\n```"} }] Complete src/CompletionPipeSubmodules.res 38:20 @@ -69,8 +69,8 @@ Path C. "label": "C.C", "kind": 4, "tags": [], - "detail": "C\n\ntype t = C", - "documentation": null + "detail": "C", + "documentation": {"kind": "markdown", "value": "```rescript\nC\n```\n\n```rescript\ntype t = C\n```"} }] Complete src/CompletionPipeSubmodules.res 42:21 @@ -91,7 +91,7 @@ Path D.C2. "label": "D.C2.C2", "kind": 4, "tags": [], - "detail": "C2\n\ntype t2 = C2", - "documentation": null + "detail": "C2", + "documentation": {"kind": "markdown", "value": "```rescript\nC2\n```\n\n```rescript\ntype t2 = C2\n```"} }] diff --git a/analysis/tests/src/expected/CompletionResolve.res.txt b/analysis/tests/src/expected/CompletionResolve.res.txt new file mode 100644 index 000000000..d0492d217 --- /dev/null +++ b/analysis/tests/src/expected/CompletionResolve.res.txt @@ -0,0 +1,6 @@ +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" + +Completion resolve: ModuleStuff +" This is a top level module doc. " + diff --git a/analysis/tests/src/expected/CompletionTypeAnnotation.res.txt b/analysis/tests/src/expected/CompletionTypeAnnotation.res.txt index e2db577b7..7f8f2ea47 100644 --- a/analysis/tests/src/expected/CompletionTypeAnnotation.res.txt +++ b/analysis/tests/src/expected/CompletionTypeAnnotation.res.txt @@ -9,8 +9,8 @@ Path someRecord "label": "{}", "kind": 12, "tags": [], - "detail": "type someRecord = {age: int, name: string}", - "documentation": null, + "detail": "someRecord", + "documentation": {"kind": "markdown", "value": "```rescript\ntype someRecord = {age: int, name: string}\n```"}, "sortText": "A", "insertText": "{$0}", "insertTextFormat": 2 @@ -27,14 +27,14 @@ Path someRecord "label": "age", "kind": 5, "tags": [], - "detail": "age: int\n\ntype someRecord = {age: int, name: string}", - "documentation": null + "detail": "int", + "documentation": {"kind": "markdown", "value": "```rescript\nage: int\n```\n\n```rescript\ntype someRecord = {age: int, name: string}\n```"} }, { "label": "name", "kind": 5, "tags": [], - "detail": "name: string\n\ntype someRecord = {age: int, name: string}", - "documentation": null + "detail": "string", + "documentation": {"kind": "markdown", "value": "```rescript\nname: string\n```\n\n```rescript\ntype someRecord = {age: int, name: string}\n```"} }] Complete src/CompletionTypeAnnotation.res 15:23 @@ -48,16 +48,16 @@ Path someVariant "label": "One", "kind": 4, "tags": [], - "detail": "One\n\ntype someVariant = One | Two(bool)", - "documentation": null, + "detail": "One", + "documentation": {"kind": "markdown", "value": "```rescript\nOne\n```\n\n```rescript\ntype someVariant = One | Two(bool)\n```"}, "insertText": "One", "insertTextFormat": 2 }, { "label": "Two(_)", "kind": 4, "tags": [], - "detail": "Two(bool)\n\ntype someVariant = One | Two(bool)", - "documentation": null, + "detail": "Two(bool)", + "documentation": {"kind": "markdown", "value": "```rescript\nTwo(bool)\n```\n\n```rescript\ntype someVariant = One | Two(bool)\n```"}, "insertText": "Two($0)", "insertTextFormat": 2 }] @@ -73,8 +73,8 @@ Path someVariant "label": "One", "kind": 4, "tags": [], - "detail": "One\n\ntype someVariant = One | Two(bool)", - "documentation": null, + "detail": "One", + "documentation": {"kind": "markdown", "value": "```rescript\nOne\n```\n\n```rescript\ntype someVariant = One | Two(bool)\n```"}, "sortText": "A One", "insertText": "One", "insertTextFormat": 2 @@ -82,14 +82,22 @@ Path someVariant "label": "Obj", "kind": 9, "tags": [], - "detail": "file module", - "documentation": null + "detail": "module Obj", + "documentation": null, + "data": { + "modulePath": "Obj", + "filePath": "src/CompletionTypeAnnotation.res" + } }, { "label": "Objects", "kind": 9, "tags": [], - "detail": "file module", - "documentation": null + "detail": "module Objects", + "documentation": null, + "data": { + "modulePath": "Objects", + "filePath": "src/CompletionTypeAnnotation.res" + } }] Complete src/CompletionTypeAnnotation.res 21:27 @@ -103,16 +111,16 @@ Path somePolyVariant "label": "#one", "kind": 4, "tags": [], - "detail": "#one\n\n[#one | #two(bool)]", - "documentation": null, + "detail": "#one", + "documentation": {"kind": "markdown", "value": "```rescript\n#one\n```\n\n```rescript\n[#one | #two(bool)]\n```"}, "insertText": "#one", "insertTextFormat": 2 }, { "label": "#two(_)", "kind": 4, "tags": [], - "detail": "#two(bool)\n\n[#one | #two(bool)]", - "documentation": null, + "detail": "#two(bool)", + "documentation": {"kind": "markdown", "value": "```rescript\n#two(bool)\n```\n\n```rescript\n[#one | #two(bool)]\n```"}, "insertText": "#two($0)", "insertTextFormat": 2 }] @@ -128,8 +136,8 @@ Path somePolyVariant "label": "#one", "kind": 4, "tags": [], - "detail": "#one\n\n[#one | #two(bool)]", - "documentation": null, + "detail": "#one", + "documentation": {"kind": "markdown", "value": "```rescript\n#one\n```\n\n```rescript\n[#one | #two(bool)]\n```"}, "insertText": "one", "insertTextFormat": 2 }] @@ -216,30 +224,30 @@ Path someVariant "label": "None", "kind": 12, "tags": [], - "detail": "type someVariant = One | Two(bool)", - "documentation": null + "detail": "someVariant", + "documentation": {"kind": "markdown", "value": "```rescript\ntype someVariant = One | Two(bool)\n```"} }, { "label": "Some(_)", "kind": 12, "tags": [], - "detail": "type someVariant = One | Two(bool)", - "documentation": null, + "detail": "someVariant", + "documentation": {"kind": "markdown", "value": "```rescript\ntype someVariant = One | Two(bool)\n```"}, "insertText": "Some($0)", "insertTextFormat": 2 }, { "label": "Some(One)", "kind": 4, "tags": [], - "detail": "One\n\ntype someVariant = One | Two(bool)", - "documentation": null, + "detail": "One", + "documentation": {"kind": "markdown", "value": "```rescript\nOne\n```\n\n```rescript\ntype someVariant = One | Two(bool)\n```"}, "insertText": "Some(One)", "insertTextFormat": 2 }, { "label": "Some(Two(_))", "kind": 4, "tags": [], - "detail": "Two(bool)\n\ntype someVariant = One | Two(bool)", - "documentation": null, + "detail": "Two(bool)", + "documentation": {"kind": "markdown", "value": "```rescript\nTwo(bool)\n```\n\n```rescript\ntype someVariant = One | Two(bool)\n```"}, "insertText": "Some(Two($0))", "insertTextFormat": 2 }] @@ -256,16 +264,16 @@ Path someVariant "label": "One", "kind": 4, "tags": [], - "detail": "One\n\ntype someVariant = One | Two(bool)", - "documentation": null, + "detail": "One", + "documentation": {"kind": "markdown", "value": "```rescript\nOne\n```\n\n```rescript\ntype someVariant = One | Two(bool)\n```"}, "insertText": "One", "insertTextFormat": 2 }, { "label": "Two(_)", "kind": 4, "tags": [], - "detail": "Two(bool)\n\ntype someVariant = One | Two(bool)", - "documentation": null, + "detail": "Two(bool)", + "documentation": {"kind": "markdown", "value": "```rescript\nTwo(bool)\n```\n\n```rescript\ntype someVariant = One | Two(bool)\n```"}, "insertText": "Two($0)", "insertTextFormat": 2 }] @@ -282,8 +290,8 @@ Path someVariant "label": "[]", "kind": 12, "tags": [], - "detail": "type someVariant = One | Two(bool)", - "documentation": null, + "detail": "someVariant", + "documentation": {"kind": "markdown", "value": "```rescript\ntype someVariant = One | Two(bool)\n```"}, "sortText": "A", "insertText": "[$0]", "insertTextFormat": 2 @@ -301,16 +309,16 @@ Path someVariant "label": "One", "kind": 4, "tags": [], - "detail": "One\n\ntype someVariant = One | Two(bool)", - "documentation": null, + "detail": "One", + "documentation": {"kind": "markdown", "value": "```rescript\nOne\n```\n\n```rescript\ntype someVariant = One | Two(bool)\n```"}, "insertText": "One", "insertTextFormat": 2 }, { "label": "Two(_)", "kind": 4, "tags": [], - "detail": "Two(bool)\n\ntype someVariant = One | Two(bool)", - "documentation": null, + "detail": "Two(bool)", + "documentation": {"kind": "markdown", "value": "```rescript\nTwo(bool)\n```\n\n```rescript\ntype someVariant = One | Two(bool)\n```"}, "insertText": "Two($0)", "insertTextFormat": 2 }] @@ -329,7 +337,7 @@ Path someVariant "kind": 12, "tags": [], "detail": "option", - "documentation": null, + "documentation": {"kind": "markdown", "value": "```rescript\noption\n```"}, "sortText": "A", "insertText": "[$0]", "insertTextFormat": 2 @@ -348,16 +356,16 @@ Path someVariant "label": "One", "kind": 4, "tags": [], - "detail": "One\n\ntype someVariant = One | Two(bool)", - "documentation": null, + "detail": "One", + "documentation": {"kind": "markdown", "value": "```rescript\nOne\n```\n\n```rescript\ntype someVariant = One | Two(bool)\n```"}, "insertText": "One", "insertTextFormat": 2 }, { "label": "Two(_)", "kind": 4, "tags": [], - "detail": "Two(bool)\n\ntype someVariant = One | Two(bool)", - "documentation": null, + "detail": "Two(bool)", + "documentation": {"kind": "markdown", "value": "```rescript\nTwo(bool)\n```\n\n```rescript\ntype someVariant = One | Two(bool)\n```"}, "insertText": "Two($0)", "insertTextFormat": 2 }] diff --git a/analysis/tests/src/expected/Destructuring.res.txt b/analysis/tests/src/expected/Destructuring.res.txt index c85f233a6..86b03c313 100644 --- a/analysis/tests/src/expected/Destructuring.res.txt +++ b/analysis/tests/src/expected/Destructuring.res.txt @@ -9,8 +9,8 @@ Path x "label": "age", "kind": 5, "tags": [], - "detail": "age: int\n\nx", - "documentation": null + "detail": "int", + "documentation": {"kind": "markdown", "value": "```rescript\nage: int\n```\n\n```rescript\ntype x = {name: string, age: int}\n```"} }] Complete src/Destructuring.res 7:8 @@ -24,14 +24,14 @@ Path x "label": "name", "kind": 5, "tags": [], - "detail": "name: string\n\nx", - "documentation": null + "detail": "string", + "documentation": {"kind": "markdown", "value": "```rescript\nname: string\n```\n\n```rescript\ntype x = {name: string, age: int}\n```"} }, { "label": "age", "kind": 5, "tags": [], - "detail": "age: int\n\nx", - "documentation": null + "detail": "int", + "documentation": {"kind": "markdown", "value": "```rescript\nage: int\n```\n\n```rescript\ntype x = {name: string, age: int}\n```"} }] Complete src/Destructuring.res 11:13 @@ -48,8 +48,8 @@ Path x "label": "age", "kind": 5, "tags": [], - "detail": "age: int\n\nx", - "documentation": null + "detail": "int", + "documentation": {"kind": "markdown", "value": "```rescript\nage: int\n```\n\n```rescript\ntype x = {name: string, age: int}\n```"} }] Complete src/Destructuring.res 17:10 @@ -66,14 +66,14 @@ Path x "label": "name", "kind": 5, "tags": [], - "detail": "name: string\n\nx", - "documentation": null + "detail": "string", + "documentation": {"kind": "markdown", "value": "```rescript\nname: string\n```\n\n```rescript\ntype x = {name: string, age: int}\n```"} }, { "label": "age", "kind": 5, "tags": [], - "detail": "age: int\n\nx", - "documentation": null + "detail": "int", + "documentation": {"kind": "markdown", "value": "```rescript\nage: int\n```\n\n```rescript\ntype x = {name: string, age: int}\n```"} }] Complete src/Destructuring.res 31:8 @@ -87,13 +87,13 @@ Path x "label": "someField", "kind": 5, "tags": [], - "detail": "someField: int\n\nrecordWithOptField", - "documentation": null + "detail": "int", + "documentation": {"kind": "markdown", "value": "```rescript\nsomeField: int\n```\n\n```rescript\ntype recordWithOptField = {someField: int, someOptField: option}\n```"} }, { "label": "?someOptField", "kind": 5, "tags": [], - "detail": "?someOptField: option\n\nrecordWithOptField", - "documentation": {"kind": "markdown", "value": "someOptField is an optional field, and needs to be destructured using '?'."} + "detail": "option", + "documentation": {"kind": "markdown", "value": "someOptField is an optional field, and needs to be destructured using '?'.\n\n```rescript\n?someOptField: option\n```\n\n```rescript\ntype recordWithOptField = {someField: int, someOptField: option}\n```"} }] diff --git a/analysis/tests/src/expected/EnvCompletion.res.txt b/analysis/tests/src/expected/EnvCompletion.res.txt index f512374c2..0c8ebef34 100644 --- a/analysis/tests/src/expected/EnvCompletion.res.txt +++ b/analysis/tests/src/expected/EnvCompletion.res.txt @@ -9,16 +9,16 @@ Path res "label": "Okay(_)", "kind": 4, "tags": [], - "detail": "Okay('a)\n\ntype someResult<'a, 'b> = Okay('a) | Failure('b)", - "documentation": null, + "detail": "Okay('a)", + "documentation": {"kind": "markdown", "value": "```rescript\nOkay('a)\n```\n\n```rescript\ntype someResult<'a, 'b> = Okay('a) | Failure('b)\n```"}, "insertText": "Okay(${1:_})", "insertTextFormat": 2 }, { "label": "Failure(_)", "kind": 4, "tags": [], - "detail": "Failure('b)\n\ntype someResult<'a, 'b> = Okay('a) | Failure('b)", - "documentation": null, + "detail": "Failure('b)", + "documentation": {"kind": "markdown", "value": "```rescript\nFailure('b)\n```\n\n```rescript\ntype someResult<'a, 'b> = Okay('a) | Failure('b)\n```"}, "insertText": "Failure(${1:_})", "insertTextFormat": 2 }] @@ -37,16 +37,16 @@ Path res "label": "One", "kind": 4, "tags": [], - "detail": "One\n\ntype things = One | Two", - "documentation": null, + "detail": "One", + "documentation": {"kind": "markdown", "value": "```rescript\nOne\n```\n\n```rescript\ntype things = One | Two\n```"}, "insertText": "One", "insertTextFormat": 2 }, { "label": "Two", "kind": 4, "tags": [], - "detail": "Two\n\ntype things = One | Two", - "documentation": null, + "detail": "Two", + "documentation": {"kind": "markdown", "value": "```rescript\nTwo\n```\n\n```rescript\ntype things = One | Two\n```"}, "insertText": "Two", "insertTextFormat": 2 }] @@ -85,7 +85,7 @@ Path use "kind": 22, "tags": [], "detail": "EnvCompletionOtherFile.response", - "documentation": null, + "documentation": {"kind": "markdown", "value": "```rescript\ntype EnvCompletionOtherFile.response = {stuff: theVariant, res: someResult}\n```"}, "sortText": "A", "insertText": "{$0}", "insertTextFormat": 2 @@ -103,14 +103,14 @@ Path use "label": "stuff", "kind": 5, "tags": [], - "detail": "stuff: theVariant\n\nEnvCompletionOtherFile.response", - "documentation": null + "detail": "theVariant", + "documentation": {"kind": "markdown", "value": "```rescript\nstuff: theVariant\n```\n\n```rescript\ntype EnvCompletionOtherFile.response = {stuff: theVariant, res: someResult}\n```"} }, { "label": "res", "kind": 5, "tags": [], - "detail": "res: someResult\n\nEnvCompletionOtherFile.response", - "documentation": null + "detail": "someResult", + "documentation": {"kind": "markdown", "value": "```rescript\nres: someResult\n```\n\n```rescript\ntype EnvCompletionOtherFile.response = {stuff: theVariant, res: someResult}\n```"} }] Complete src/EnvCompletion.res 25:27 @@ -125,16 +125,16 @@ Path use "label": "First", "kind": 4, "tags": [], - "detail": "First\n\ntype theVariant = First | Second(r1)", - "documentation": null, + "detail": "First", + "documentation": {"kind": "markdown", "value": "```rescript\nFirst\n```\n\n```rescript\ntype theVariant = First | Second(r1)\n```"}, "insertText": "First", "insertTextFormat": 2 }, { "label": "Second(_)", "kind": 4, "tags": [], - "detail": "Second(r1)\n\ntype theVariant = First | Second(r1)", - "documentation": null, + "detail": "Second(r1)", + "documentation": {"kind": "markdown", "value": "```rescript\nSecond(r1)\n```\n\n```rescript\ntype theVariant = First | Second(r1)\n```"}, "insertText": "Second(${1:_})", "insertTextFormat": 2 }] @@ -156,7 +156,7 @@ Path use "kind": 22, "tags": [], "detail": "r1", - "documentation": null, + "documentation": {"kind": "markdown", "value": "```rescript\ntype r1 = {age: int}\n```"}, "sortText": "A", "insertText": "{$0}", "insertTextFormat": 2 @@ -177,8 +177,8 @@ Path use "label": "age", "kind": 5, "tags": [], - "detail": "age: int\n\nr1", - "documentation": null + "detail": "int", + "documentation": {"kind": "markdown", "value": "```rescript\nage: int\n```\n\n```rescript\ntype r1 = {age: int}\n```"} }] Complete src/EnvCompletion.res 34:25 @@ -193,16 +193,16 @@ Path use "label": "Okay(_)", "kind": 4, "tags": [], - "detail": "Okay('a)\n\ntype someResult<'a, 'b> = Okay('a) | Failure('b)", - "documentation": null, + "detail": "Okay('a)", + "documentation": {"kind": "markdown", "value": "```rescript\nOkay('a)\n```\n\n```rescript\ntype someResult<'a, 'b> = Okay('a) | Failure('b)\n```"}, "insertText": "Okay(${1:_})", "insertTextFormat": 2 }, { "label": "Failure(_)", "kind": 4, "tags": [], - "detail": "Failure('b)\n\ntype someResult<'a, 'b> = Okay('a) | Failure('b)", - "documentation": null, + "detail": "Failure('b)", + "documentation": {"kind": "markdown", "value": "```rescript\nFailure('b)\n```\n\n```rescript\ntype someResult<'a, 'b> = Okay('a) | Failure('b)\n```"}, "insertText": "Failure(${1:_})", "insertTextFormat": 2 }] @@ -223,16 +223,16 @@ Path use "label": "First", "kind": 4, "tags": [], - "detail": "First\n\ntype theVariant = First | Second(r1)", - "documentation": null, + "detail": "First", + "documentation": {"kind": "markdown", "value": "```rescript\nFirst\n```\n\n```rescript\ntype theVariant = First | Second(r1)\n```"}, "insertText": "First", "insertTextFormat": 2 }, { "label": "Second(_)", "kind": 4, "tags": [], - "detail": "Second(r1)\n\ntype theVariant = First | Second(r1)", - "documentation": null, + "detail": "Second(r1)", + "documentation": {"kind": "markdown", "value": "```rescript\nSecond(r1)\n```\n\n```rescript\ntype theVariant = First | Second(r1)\n```"}, "insertText": "Second(${1:_})", "insertTextFormat": 2 }] @@ -256,7 +256,7 @@ Path use "kind": 22, "tags": [], "detail": "r1", - "documentation": null, + "documentation": {"kind": "markdown", "value": "```rescript\ntype r1 = {age: int}\n```"}, "sortText": "A", "insertText": "{$0}", "insertTextFormat": 2 @@ -279,8 +279,8 @@ Path use "label": "age", "kind": 5, "tags": [], - "detail": "age: int\n\nr1", - "documentation": null + "detail": "int", + "documentation": {"kind": "markdown", "value": "```rescript\nage: int\n```\n\n```rescript\ntype r1 = {age: int}\n```"} }] Complete src/EnvCompletion.res 52:18 @@ -294,8 +294,8 @@ Path res2 "label": "{}", "kind": 22, "tags": [], - "detail": "EnvCompletionOtherFile.someRecord", - "documentation": null, + "detail": "EnvCompletionOtherFile.someRecord", + "documentation": {"kind": "markdown", "value": "```rescript\ntype EnvCompletionOtherFile.someRecord = {name: string, theThing: 'thing, theVariant: theVariant}\n```"}, "sortText": "A", "insertText": "{$0}", "insertTextFormat": 2 @@ -312,20 +312,20 @@ Path res2 "label": "name", "kind": 5, "tags": [], - "detail": "name: string\n\nEnvCompletionOtherFile.someRecord", - "documentation": null + "detail": "string", + "documentation": {"kind": "markdown", "value": "```rescript\nname: string\n```\n\n```rescript\ntype EnvCompletionOtherFile.someRecord = {name: string, theThing: 'thing, theVariant: theVariant}\n```"} }, { "label": "theThing", "kind": 5, "tags": [], - "detail": "theThing: 'thing\n\nEnvCompletionOtherFile.someRecord", - "documentation": null + "detail": "'thing", + "documentation": {"kind": "markdown", "value": "```rescript\ntheThing: 'thing\n```\n\n```rescript\ntype EnvCompletionOtherFile.someRecord = {name: string, theThing: 'thing, theVariant: theVariant}\n```"} }, { "label": "theVariant", "kind": 5, "tags": [], - "detail": "theVariant: theVariant\n\nEnvCompletionOtherFile.someRecord", - "documentation": null + "detail": "theVariant", + "documentation": {"kind": "markdown", "value": "```rescript\ntheVariant: theVariant\n```\n\n```rescript\ntype EnvCompletionOtherFile.someRecord = {name: string, theThing: 'thing, theVariant: theVariant}\n```"} }] Complete src/EnvCompletion.res 58:29 @@ -339,16 +339,16 @@ Path res2 "label": "Four", "kind": 4, "tags": [], - "detail": "Four\n\ntype things2 = Four | Five", - "documentation": null, + "detail": "Four", + "documentation": {"kind": "markdown", "value": "```rescript\nFour\n```\n\n```rescript\ntype things2 = Four | Five\n```"}, "insertText": "Four", "insertTextFormat": 2 }, { "label": "Five", "kind": 4, "tags": [], - "detail": "Five\n\ntype things2 = Four | Five", - "documentation": null, + "detail": "Five", + "documentation": {"kind": "markdown", "value": "```rescript\nFive\n```\n\n```rescript\ntype things2 = Four | Five\n```"}, "insertText": "Five", "insertTextFormat": 2 }] @@ -364,16 +364,16 @@ Path res2 "label": "First", "kind": 4, "tags": [], - "detail": "First\n\ntype theVariant = First | Second(r1)", - "documentation": null, + "detail": "First", + "documentation": {"kind": "markdown", "value": "```rescript\nFirst\n```\n\n```rescript\ntype theVariant = First | Second(r1)\n```"}, "insertText": "First", "insertTextFormat": 2 }, { "label": "Second(_)", "kind": 4, "tags": [], - "detail": "Second(r1)\n\ntype theVariant = First | Second(r1)", - "documentation": null, + "detail": "Second(r1)", + "documentation": {"kind": "markdown", "value": "```rescript\nSecond(r1)\n```\n\n```rescript\ntype theVariant = First | Second(r1)\n```"}, "insertText": "Second(${1:_})", "insertTextFormat": 2 }] diff --git a/analysis/tests/src/expected/ExhaustiveSwitch.res.txt b/analysis/tests/src/expected/ExhaustiveSwitch.res.txt index 71285318b..6aba8c923 100644 --- a/analysis/tests/src/expected/ExhaustiveSwitch.res.txt +++ b/analysis/tests/src/expected/ExhaustiveSwitch.res.txt @@ -10,7 +10,7 @@ Path withSomeVarian "kind": 12, "tags": [], "detail": "someVariant", - "documentation": null + "documentation": {"kind": "markdown", "value": "```rescript\ntype someVariant = One | Two | Three(option)\n```"} }, { "label": "withSomeVariant (exhaustive switch)", "kind": 15, diff --git a/analysis/tests/src/expected/Hover.res.txt b/analysis/tests/src/expected/Hover.res.txt index 8139c1527..5f3fbcd02 100644 --- a/analysis/tests/src/expected/Hover.res.txt +++ b/analysis/tests/src/expected/Hover.res.txt @@ -128,8 +128,8 @@ Path x1 "label": "age", "kind": 5, "tags": [], - "detail": "age: int\n\ntype bar = {age: int}", - "documentation": null + "detail": "int", + "documentation": {"kind": "markdown", "value": "```rescript\nage: int\n```\n\n```rescript\ntype bar = {age: int}\n```"} }] Complete src/Hover.res 173:16 @@ -146,8 +146,8 @@ Path x2 "label": "age", "kind": 5, "tags": [], - "detail": "age: int\n\ntype bar = {age: int}", - "documentation": null + "detail": "int", + "documentation": {"kind": "markdown", "value": "```rescript\nage: int\n```\n\n```rescript\ntype bar = {age: int}\n```"} }] Complete src/Hover.res 182:16 @@ -164,8 +164,8 @@ Path y1 "label": "age", "kind": 5, "tags": [], - "detail": "age: int\n\ntype bar = {age: int}", - "documentation": null + "detail": "int", + "documentation": {"kind": "markdown", "value": "```rescript\nage: int\n```\n\n```rescript\ntype bar = {age: int}\n```"} }] Complete src/Hover.res 185:16 @@ -182,8 +182,8 @@ Path y2 "label": "age", "kind": 5, "tags": [], - "detail": "age: int\n\ntype bar = {age: int}", - "documentation": null + "detail": "int", + "documentation": {"kind": "markdown", "value": "```rescript\nage: int\n```\n\n```rescript\ntype bar = {age: int}\n```"} }] Hover src/Hover.res 197:4 diff --git a/analysis/tests/src/expected/Jsx2.res.txt b/analysis/tests/src/expected/Jsx2.res.txt index 82ea87673..d566a3bdd 100644 --- a/analysis/tests/src/expected/Jsx2.res.txt +++ b/analysis/tests/src/expected/Jsx2.res.txt @@ -46,26 +46,48 @@ Path M "label": "M", "kind": 9, "tags": [], - "detail": "module", + "detail": "module M", "documentation": null }, { "label": "Map", "kind": 9, "tags": [], - "detail": "file module", - "documentation": null + "detail": "module Map", + "documentation": null, + "data": { + "modulePath": "Map", + "filePath": "src/Jsx2.res" + } }, { "label": "MapLabels", "kind": 9, "tags": [], - "detail": "file module", - "documentation": null + "detail": "module MapLabels", + "documentation": null, + "data": { + "modulePath": "MapLabels", + "filePath": "src/Jsx2.res" + } + }, { + "label": "ModuleStuff", + "kind": 9, + "tags": [], + "detail": "module ModuleStuff", + "documentation": null, + "data": { + "modulePath": "ModuleStuff", + "filePath": "src/Jsx2.res" + } }, { "label": "MoreLabels", "kind": 9, "tags": [], - "detail": "file module", - "documentation": null + "detail": "module MoreLabels", + "documentation": null, + "data": { + "modulePath": "MoreLabels", + "filePath": "src/Jsx2.res" + } }] Complete src/Jsx2.res 22:19 @@ -334,7 +356,7 @@ Path WithChildren "label": "WithChildren", "kind": 9, "tags": [], - "detail": "module", + "detail": "module WithChildren", "documentation": null }] @@ -366,8 +388,8 @@ Path React.e "label": "element", "kind": 22, "tags": [], - "detail": "type element = Jsx.element", - "documentation": null + "detail": "type element", + "documentation": {"kind": "markdown", "value": "```rescript\ntype element = Jsx.element\n```"} }] Complete src/Jsx2.res 96:20 @@ -383,8 +405,12 @@ Path ReactDOMR "label": "ReactDOMRe", "kind": 9, "tags": [], - "detail": "file module", - "documentation": null + "detail": "module ReactDOMRe", + "documentation": null, + "data": { + "modulePath": "ReactDOMRe", + "filePath": "src/Jsx2.res" + } }] Complete src/Jsx2.res 102:21 @@ -430,14 +456,14 @@ Path DefineSomeFields.th "label": "thisField", "kind": 5, "tags": [], - "detail": "thisField: int\n\ntype r = {thisField: int, thatField: string}", - "documentation": null + "detail": "int", + "documentation": {"kind": "markdown", "value": "```rescript\nthisField: int\n```\n\n```rescript\ntype r = {thisField: int, thatField: string}\n```"} }, { "label": "thatField", "kind": 5, "tags": [], - "detail": "thatField: string\n\ntype r = {thisField: int, thatField: string}", - "documentation": null + "detail": "string", + "documentation": {"kind": "markdown", "value": "```rescript\nthatField: string\n```\n\n```rescript\ntype r = {thisField: int, thatField: string}\n```"} }] Complete src/Jsx2.res 122:20 @@ -508,7 +534,7 @@ Path Nested.Co "label": "Comp", "kind": 9, "tags": [], - "detail": "module", + "detail": "module Comp", "documentation": null }] @@ -524,7 +550,7 @@ Path Nested. "label": "Comp", "kind": 9, "tags": [], - "detail": "module", + "detail": "module Comp", "documentation": null }] diff --git a/analysis/tests/src/expected/Jsx2.resi.txt b/analysis/tests/src/expected/Jsx2.resi.txt index 1dc85a0e9..5c2c276de 100644 --- a/analysis/tests/src/expected/Jsx2.resi.txt +++ b/analysis/tests/src/expected/Jsx2.resi.txt @@ -18,8 +18,8 @@ Path React.e "label": "element", "kind": 22, "tags": [], - "detail": "type element = Jsx.element", - "documentation": null + "detail": "type element", + "documentation": {"kind": "markdown", "value": "```rescript\ntype element = Jsx.element\n```"} }] Complete src/Jsx2.resi 10:18 @@ -34,7 +34,7 @@ Path React.e "label": "element", "kind": 22, "tags": [], - "detail": "type element = Jsx.element", - "documentation": null + "detail": "type element", + "documentation": {"kind": "markdown", "value": "```rescript\ntype element = Jsx.element\n```"} }] diff --git a/analysis/tests/src/expected/ModuleStuff.res.txt b/analysis/tests/src/expected/ModuleStuff.res.txt new file mode 100644 index 000000000..e69de29bb diff --git a/analysis/tests/src/expected/RecordCompletion.res.txt b/analysis/tests/src/expected/RecordCompletion.res.txt index f42087ca5..90787363b 100644 --- a/analysis/tests/src/expected/RecordCompletion.res.txt +++ b/analysis/tests/src/expected/RecordCompletion.res.txt @@ -61,8 +61,8 @@ Path R. "label": "name", "kind": 5, "tags": [], - "detail": "name: string\n\ntype t = {name: string}", - "documentation": null + "detail": "string", + "documentation": {"kind": "markdown", "value": "```rescript\nname: string\n```\n\n```rescript\ntype t = {name: string}\n```"} }] Complete src/RecordCompletion.res 22:7 @@ -77,7 +77,7 @@ Path R. "label": "name", "kind": 5, "tags": [], - "detail": "name: string\n\ntype t = {name: string}", - "documentation": null + "detail": "string", + "documentation": {"kind": "markdown", "value": "```rescript\nname: string\n```\n\n```rescript\ntype t = {name: string}\n```"} }] diff --git a/analysis/tests/src/expected/RecoveryOnProp.res.txt b/analysis/tests/src/expected/RecoveryOnProp.res.txt index b8f163ba5..59b9e8f8e 100644 --- a/analysis/tests/src/expected/RecoveryOnProp.res.txt +++ b/analysis/tests/src/expected/RecoveryOnProp.res.txt @@ -19,13 +19,21 @@ Path Res "label": "RescriptReactErrorBoundary", "kind": 9, "tags": [], - "detail": "file module", - "documentation": null + "detail": "module RescriptReactErrorBoundary", + "documentation": null, + "data": { + "modulePath": "RescriptReactErrorBoundary", + "filePath": "src/RecoveryOnProp.res" + } }, { "label": "RescriptReactRouter", "kind": 9, "tags": [], - "detail": "file module", - "documentation": null + "detail": "module RescriptReactRouter", + "documentation": null, + "data": { + "modulePath": "RescriptReactRouter", + "filePath": "src/RecoveryOnProp.res" + } }] diff --git a/analysis/tests/src/expected/Reprod.res.txt b/analysis/tests/src/expected/Reprod.res.txt index fff7807f8..d0be9994c 100644 --- a/analysis/tests/src/expected/Reprod.res.txt +++ b/analysis/tests/src/expected/Reprod.res.txt @@ -12,7 +12,7 @@ Path Query.use "kind": 12, "tags": [], "detail": "input_ByAddress", - "documentation": null, + "documentation": {"kind": "markdown", "value": "```rescript\ntype input_ByAddress = {city: string}\n```"}, "sortText": "A", "insertText": "{$0}", "insertTextFormat": 2 @@ -29,24 +29,24 @@ Path record "label": "One", "kind": 4, "tags": [], - "detail": "One\n\ntype someVariant = One | Two(bool) | Three(someRecord, bool)", - "documentation": null, + "detail": "One", + "documentation": {"kind": "markdown", "value": "```rescript\nOne\n```\n\n```rescript\ntype someVariant = One | Two(bool) | Three(someRecord, bool)\n```"}, "insertText": "One", "insertTextFormat": 2 }, { "label": "Two(_)", "kind": 4, "tags": [], - "detail": "Two(bool)\n\ntype someVariant = One | Two(bool) | Three(someRecord, bool)", - "documentation": null, + "detail": "Two(bool)", + "documentation": {"kind": "markdown", "value": "```rescript\nTwo(bool)\n```\n\n```rescript\ntype someVariant = One | Two(bool) | Three(someRecord, bool)\n```"}, "insertText": "Two(${1:_})", "insertTextFormat": 2 }, { "label": "Three(_, _)", "kind": 4, "tags": [], - "detail": "Three(someRecord, bool)\n\ntype someVariant = One | Two(bool) | Three(someRecord, bool)", - "documentation": null, + "detail": "Three(someRecord, bool)", + "documentation": {"kind": "markdown", "value": "```rescript\nThree(someRecord, bool)\n```\n\n```rescript\ntype someVariant = One | Two(bool) | Three(someRecord, bool)\n```"}, "insertText": "Three(${1:_}, ${2:_})", "insertTextFormat": 2 }] @@ -63,7 +63,7 @@ Path record "kind": 22, "tags": [], "detail": "SchemaAssets.input_ByAddress", - "documentation": null, + "documentation": {"kind": "markdown", "value": "```rescript\ntype SchemaAssets.input_ByAddress = {city: string}\n```"}, "sortText": "A", "insertText": "{$0}", "insertTextFormat": 2 @@ -83,24 +83,24 @@ Path res "label": "One", "kind": 4, "tags": [], - "detail": "One\n\ntype someVariant = One | Two(bool) | Three(someRecord, bool)", - "documentation": null, + "detail": "One", + "documentation": {"kind": "markdown", "value": "```rescript\nOne\n```\n\n```rescript\ntype someVariant = One | Two(bool) | Three(someRecord, bool)\n```"}, "insertText": "One", "insertTextFormat": 2 }, { "label": "Two(_)", "kind": 4, "tags": [], - "detail": "Two(bool)\n\ntype someVariant = One | Two(bool) | Three(someRecord, bool)", - "documentation": null, + "detail": "Two(bool)", + "documentation": {"kind": "markdown", "value": "```rescript\nTwo(bool)\n```\n\n```rescript\ntype someVariant = One | Two(bool) | Three(someRecord, bool)\n```"}, "insertText": "Two(${1:_})", "insertTextFormat": 2 }, { "label": "Three(_, _)", "kind": 4, "tags": [], - "detail": "Three(someRecord, bool)\n\ntype someVariant = One | Two(bool) | Three(someRecord, bool)", - "documentation": null, + "detail": "Three(someRecord, bool)", + "documentation": {"kind": "markdown", "value": "```rescript\nThree(someRecord, bool)\n```\n\n```rescript\ntype someVariant = One | Two(bool) | Three(someRecord, bool)\n```"}, "insertText": "Three(${1:_}, ${2:_})", "insertTextFormat": 2 }] @@ -119,24 +119,24 @@ Path res "label": "#one", "kind": 4, "tags": [], - "detail": "#one\n\n[#one | #three(someRecord, bool) | #two(bool)]", - "documentation": null, + "detail": "#one", + "documentation": {"kind": "markdown", "value": "```rescript\n#one\n```\n\n```rescript\n[#one | #three(someRecord, bool) | #two(bool)]\n```"}, "insertText": "#one", "insertTextFormat": 2 }, { "label": "#three(_, _)", "kind": 4, "tags": [], - "detail": "#three(someRecord, bool)\n\n[#one | #three(someRecord, bool) | #two(bool)]", - "documentation": null, + "detail": "#three(someRecord, bool)", + "documentation": {"kind": "markdown", "value": "```rescript\n#three(someRecord, bool)\n```\n\n```rescript\n[#one | #three(someRecord, bool) | #two(bool)]\n```"}, "insertText": "#three(${1:_}, ${2:_})", "insertTextFormat": 2 }, { "label": "#two(_)", "kind": 4, "tags": [], - "detail": "#two(bool)\n\n[#one | #three(someRecord, bool) | #two(bool)]", - "documentation": null, + "detail": "#two(bool)", + "documentation": {"kind": "markdown", "value": "```rescript\n#two(bool)\n```\n\n```rescript\n[#one | #three(someRecord, bool) | #two(bool)]\n```"}, "insertText": "#two(${1:_})", "insertTextFormat": 2 }] @@ -156,37 +156,37 @@ Path resOpt "kind": 12, "tags": [], "detail": "someVariant", - "documentation": null + "documentation": {"kind": "markdown", "value": "```rescript\ntype someVariant = One | Two(bool) | Three(someRecord, bool)\n```"} }, { "label": "Some(_)", "kind": 12, "tags": [], "detail": "someVariant", - "documentation": null, + "documentation": {"kind": "markdown", "value": "```rescript\ntype someVariant = One | Two(bool) | Three(someRecord, bool)\n```"}, "insertText": "Some(${1:_})", "insertTextFormat": 2 }, { "label": "Some(One)", "kind": 4, "tags": [], - "detail": "One\n\ntype someVariant = One | Two(bool) | Three(someRecord, bool)", - "documentation": null, + "detail": "One", + "documentation": {"kind": "markdown", "value": "```rescript\nOne\n```\n\n```rescript\ntype someVariant = One | Two(bool) | Three(someRecord, bool)\n```"}, "insertText": "Some(One)", "insertTextFormat": 2 }, { "label": "Some(Two(_))", "kind": 4, "tags": [], - "detail": "Two(bool)\n\ntype someVariant = One | Two(bool) | Three(someRecord, bool)", - "documentation": null, + "detail": "Two(bool)", + "documentation": {"kind": "markdown", "value": "```rescript\nTwo(bool)\n```\n\n```rescript\ntype someVariant = One | Two(bool) | Three(someRecord, bool)\n```"}, "insertText": "Some(Two(${1:_}))", "insertTextFormat": 2 }, { "label": "Some(Three(_, _))", "kind": 4, "tags": [], - "detail": "Three(someRecord, bool)\n\ntype someVariant = One | Two(bool) | Three(someRecord, bool)", - "documentation": null, + "detail": "Three(someRecord, bool)", + "documentation": {"kind": "markdown", "value": "```rescript\nThree(someRecord, bool)\n```\n\n```rescript\ntype someVariant = One | Two(bool) | Three(someRecord, bool)\n```"}, "insertText": "Some(Three(${1:_}, ${2:_}))", "insertTextFormat": 2 }] @@ -207,24 +207,24 @@ Path resOpt "label": "One", "kind": 4, "tags": [], - "detail": "One\n\ntype someVariant = One | Two(bool) | Three(someRecord, bool)", - "documentation": null, + "detail": "One", + "documentation": {"kind": "markdown", "value": "```rescript\nOne\n```\n\n```rescript\ntype someVariant = One | Two(bool) | Three(someRecord, bool)\n```"}, "insertText": "One", "insertTextFormat": 2 }, { "label": "Two(_)", "kind": 4, "tags": [], - "detail": "Two(bool)\n\ntype someVariant = One | Two(bool) | Three(someRecord, bool)", - "documentation": null, + "detail": "Two(bool)", + "documentation": {"kind": "markdown", "value": "```rescript\nTwo(bool)\n```\n\n```rescript\ntype someVariant = One | Two(bool) | Three(someRecord, bool)\n```"}, "insertText": "Two(${1:_})", "insertTextFormat": 2 }, { "label": "Three(_, _)", "kind": 4, "tags": [], - "detail": "Three(someRecord, bool)\n\ntype someVariant = One | Two(bool) | Three(someRecord, bool)", - "documentation": null, + "detail": "Three(someRecord, bool)", + "documentation": {"kind": "markdown", "value": "```rescript\nThree(someRecord, bool)\n```\n\n```rescript\ntype someVariant = One | Two(bool) | Three(someRecord, bool)\n```"}, "insertText": "Three(${1:_}, ${2:_})", "insertTextFormat": 2 }] diff --git a/analysis/tests/src/expected/TypeAtPosCompletion.res.txt b/analysis/tests/src/expected/TypeAtPosCompletion.res.txt index 3aa2e61e3..377ec83f1 100644 --- a/analysis/tests/src/expected/TypeAtPosCompletion.res.txt +++ b/analysis/tests/src/expected/TypeAtPosCompletion.res.txt @@ -8,14 +8,14 @@ ContextPath CTypeAtPos() "label": "age", "kind": 5, "tags": [], - "detail": "age?: int\n\noptRecord", - "documentation": null + "detail": "int", + "documentation": {"kind": "markdown", "value": "```rescript\nage?: int\n```\n\n```rescript\ntype optRecord = {name: string, age: option, online: option}\n```"} }, { "label": "online", "kind": 5, "tags": [], - "detail": "online?: bool\n\noptRecord", - "documentation": null + "detail": "bool", + "documentation": {"kind": "markdown", "value": "```rescript\nonline?: bool\n```\n\n```rescript\ntype optRecord = {name: string, age: option, online: option}\n```"} }] Complete src/TypeAtPosCompletion.res 16:18 @@ -30,14 +30,14 @@ ContextPath CTypeAtPos() "label": "age", "kind": 5, "tags": [], - "detail": "age?: int\n\noptRecord", - "documentation": null + "detail": "int", + "documentation": {"kind": "markdown", "value": "```rescript\nage?: int\n```\n\n```rescript\ntype optRecord = {name: string, age: option, online: option}\n```"} }, { "label": "online", "kind": 5, "tags": [], - "detail": "online?: bool\n\noptRecord", - "documentation": null + "detail": "bool", + "documentation": {"kind": "markdown", "value": "```rescript\nonline?: bool\n```\n\n```rescript\ntype optRecord = {name: string, age: option, online: option}\n```"} }] Complete src/TypeAtPosCompletion.res 22:12 @@ -51,7 +51,7 @@ ContextPath CTypeAtPos() "kind": 12, "tags": [], "detail": "optRecord", - "documentation": null, + "documentation": {"kind": "markdown", "value": "```rescript\ntype optRecord = {name: string, age: option, online: option}\n```"}, "sortText": "A", "insertText": "{$0}", "insertTextFormat": 2 diff --git a/server/src/server.ts b/server/src/server.ts index 944d3e22c..87549b20f 100644 --- a/server/src/server.ts +++ b/server/src/server.ts @@ -660,6 +660,28 @@ function completion(msg: p.RequestMessage) { return response; } +function completionResolve(msg: p.RequestMessage) { + const item = msg.params as p.CompletionItem; + let response: p.ResponseMessage = { + jsonrpc: c.jsonrpcVersion, + id: msg.id, + result: "", + }; + + if (item.documentation == null && item.data != null) { + const data = item.data as { filePath: string; modulePath: string }; + let result = utils.runAnalysisAfterSanityCheck( + data.filePath, + ["completionResolve", data.filePath, data.modulePath], + true + ); + item.documentation = { kind: "markdown", value: result }; + response.result = item; + } + + return response; +} + function codeAction(msg: p.RequestMessage): p.ResponseMessage { let params = msg.params as p.CodeActionParams; let filePath = fileURLToPath(params.textDocument.uri); @@ -1101,6 +1123,7 @@ function onMessage(msg: p.Message) { documentSymbolProvider: true, completionProvider: { triggerCharacters: [".", ">", "@", "~", '"', "=", "("], + resolveProvider: true, }, semanticTokensProvider: { legend: { @@ -1201,6 +1224,8 @@ function onMessage(msg: p.Message) { send(documentSymbol(msg)); } else if (msg.method === p.CompletionRequest.method) { send(completion(msg)); + } else if (msg.method === p.CompletionResolveRequest.method) { + send(completionResolve(msg)); } else if (msg.method === p.SemanticTokensRequest.method) { send(semanticTokens(msg)); } else if (msg.method === p.CodeActionRequest.method) {