diff --git a/CHANGELOG.md b/CHANGELOG.md index d6d6cb43e..50c1dd84d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ ## master +#### :rocket: New Feature + +- Greatly extend completion abilities for unsaved code. WARNING: Might be a bit unstable initially. Report any issues you see. https://github.com/rescript-lang/rescript-vscode/pull/712 + ## 1.14.0 #### :rocket: New Feature diff --git a/analysis/src/Cfg.ml b/analysis/src/Cfg.ml index 28b92aaf7..38b3e9aa7 100644 --- a/analysis/src/Cfg.ml +++ b/analysis/src/Cfg.ml @@ -1 +1,3 @@ let supportsSnippets = ref false + +let debugFollowCtxPath = ref false diff --git a/analysis/src/Commands.ml b/analysis/src/Commands.ml index db671ca08..aa4b766ad 100644 --- a/analysis/src/Commands.ml +++ b/analysis/src/Commands.ml @@ -1,29 +1,13 @@ -let getCompletions ~debug ~path ~pos ~currentFile ~forHover = - let textOpt = Files.readFile currentFile in - match textOpt with - | None | Some "" -> [] - | Some text -> ( +let completion ~debug ~path ~pos ~currentFile = + let completions = match - CompletionFrontEnd.completionWithParser ~debug ~path ~posCursor:pos - ~currentFile ~text + Completions.getCompletions ~debug ~path ~pos ~currentFile ~forHover:false with | None -> [] - | Some (completable, scope) -> ( - if debug then - Printf.printf "Completable: %s\n" - (SharedTypes.Completable.toString completable); - (* Only perform expensive ast operations if there are completables *) - match Cmt.loadFullCmtFromPath ~path with - | None -> [] - | Some full -> - let env = SharedTypes.QueryEnv.fromFile full.file in - completable - |> CompletionBackEnd.processCompletable ~debug ~full ~pos ~scope ~env - ~forHover)) - -let completion ~debug ~path ~pos ~currentFile = + | Some (completions, _) -> completions + in print_endline - (getCompletions ~debug ~path ~pos ~currentFile ~forHover:false + (completions |> List.map CompletionBackEnd.completionToItem |> List.map Protocol.stringifyCompletionItem |> Protocol.array) diff --git a/analysis/src/CompletionBackEnd.ml b/analysis/src/CompletionBackEnd.ml index 421986ddb..89a1e3bd6 100644 --- a/analysis/src/CompletionBackEnd.ml +++ b/analysis/src/CompletionBackEnd.ml @@ -243,6 +243,7 @@ let kindToDetail name (kind : Completion.kind) = ^ ")") ^ "\n\n" ^ s | Snippet s -> s + | FollowContextPath _ -> "" | ExtractedType (extractedType, _) -> TypeUtils.extractedTypeToString extractedType @@ -262,7 +263,7 @@ let findAllCompletions ~(env : QueryEnv.t) ~prefix ~exact ~namesUsed completionForExportedFields ~env ~prefix ~exact ~namesUsed @ completionForExportedModules ~env ~prefix ~exact ~namesUsed -let processLocalValue name loc ~prefix ~exact ~env +let processLocalValue name loc contextPath ~prefix ~exact ~env ~(localTables : LocalTables.t) = if Utils.checkName name ~prefix ~exact then match Hashtbl.find_opt localTables.valueTable (name, Loc.start loc) with @@ -284,10 +285,13 @@ let processLocalValue name loc ~prefix ~exact ~env localTables.resultRev <- Completion.create name ~env ~kind: - (Value - (Ctype.newconstr - (Path.Pident (Ident.create "Type Not Known")) - [])) + (match contextPath with + | Some contextPath -> FollowContextPath contextPath + | None -> + Value + (Ctype.newconstr + (Path.Pident (Ident.create "Type Not Known")) + [])) :: localTables.resultRev let processLocalConstructor name loc ~prefix ~exact ~env @@ -506,8 +510,9 @@ let getComplementaryCompletionsForTypedValue ~opens ~allFiles ~scope ~env prefix in localCompletionsWithOpens @ fileModules -let getCompletionsForPath ~package ~opens ~allFiles ~pos ~exact ~scope +let getCompletionsForPath ~debug ~package ~opens ~allFiles ~pos ~exact ~scope ~completionContext ~env path = + if debug then Printf.printf "Path %s\n" (path |> String.concat "."); match path with | [] -> [] | [prefix] -> @@ -600,6 +605,8 @@ let completionsGetTypeEnv = function | {Completion.kind = Field ({typ}, _); env} :: _ -> Some (typ, env) | _ -> None +type getCompletionsForContextPathMode = Regular | Pipe + let completionsGetCompletionType ~full = function | {Completion.kind = Value typ; env} :: _ | {Completion.kind = ObjLabel typ; env} :: _ @@ -614,29 +621,71 @@ let completionsGetCompletionType ~full = function | {Completion.kind = ExtractedType (typ, _); env} :: _ -> Some (typ, env) | _ -> None -type getCompletionsForContextPathMode = Regular | Pipe +let rec completionsGetCompletionType2 ~debug ~full ~opens ~rawOpens ~allFiles + ~pos ~scope = function + | {Completion.kind = Value typ; env} :: _ + | {Completion.kind = ObjLabel typ; env} :: _ + | {Completion.kind = Field ({typ}, _); env} :: _ -> + Some (TypeExpr typ, env) + | {Completion.kind = FollowContextPath ctxPath; env} :: _ -> + ctxPath + |> getCompletionsForContextPath ~debug ~full ~env ~exact:true ~opens + ~rawOpens ~allFiles ~pos ~scope + |> completionsGetCompletionType2 ~debug ~full ~opens ~rawOpens ~allFiles + ~pos ~scope + | {Completion.kind = Type typ; env} :: _ -> ( + match TypeUtils.extractTypeFromResolvedType typ ~env ~full with + | None -> None + | Some extractedType -> Some (ExtractedType extractedType, env)) + | {Completion.kind = ExtractedType (typ, _); env} :: _ -> + Some (ExtractedType typ, env) + | _ -> None + +and completionsGetTypeEnv2 ~debug (completions : Completion.t list) ~full ~opens + ~rawOpens ~allFiles ~pos ~scope = + match completions with + | {Completion.kind = Value typ; env} :: _ -> Some (typ, env) + | {Completion.kind = ObjLabel typ; env} :: _ -> Some (typ, env) + | {Completion.kind = Field ({typ}, _); env} :: _ -> Some (typ, env) + | {Completion.kind = FollowContextPath ctxPath; env} :: _ -> + ctxPath + |> getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~allFiles ~pos + ~env ~exact:true ~scope + |> completionsGetTypeEnv2 ~debug ~full ~opens ~rawOpens ~allFiles ~pos + ~scope + | _ -> None -let rec getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env - ~exact ~scope ?(mode = Regular) (contextPath : Completable.contextPath) = +and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~allFiles ~pos + ~env ~exact ~scope ?(mode = Regular) contextPath = + if debug then + Printf.printf "ContextPath %s\n" + (Completable.contextPathToString contextPath); let package = full.package in match contextPath with | CPString -> [ - Completion.create "string" ~env + Completion.create "dummy" ~env ~kind: (Completion.Value (Ctype.newconstr (Path.Pident (Ident.create "string")) [])); ] + | CPBool -> + [ + Completion.create "dummy" ~env + ~kind: + (Completion.Value + (Ctype.newconstr (Path.Pident (Ident.create "bool")) [])); + ] | CPInt -> [ - Completion.create "int" ~env + Completion.create "dummy" ~env ~kind: (Completion.Value (Ctype.newconstr (Path.Pident (Ident.create "int")) [])); ] | CPFloat -> [ - Completion.create "float" ~env + Completion.create "dummy" ~env ~kind: (Completion.Value (Ctype.newconstr (Path.Pident (Ident.create "float")) [])); @@ -653,21 +702,22 @@ let rec getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env | Regular -> ( match cp - |> getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos - ~env ~exact:true ~scope + |> getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~allFiles + ~pos ~env ~exact:true ~scope |> completionsGetCompletionType ~full with | None -> [] | Some (typ, env) -> [ Completion.create "dummy" ~env - ~kind:(Completion.ExtractedType (Tarray (env, typ), `Type)); + ~kind: + (Completion.ExtractedType (Tarray (env, ExtractedType typ), `Type)); ]) | Pipe -> (* Pipe completion with array just needs to know that it's an array, not what inner type it has. *) [ - Completion.create "array" ~env + Completion.create "dummy" ~env ~kind: (Completion.Value (Ctype.newconstr (Path.Pident (Ident.create "array")) [])); @@ -675,28 +725,30 @@ let rec getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env | CPOption cp -> ( match cp - |> getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env - ~exact:true ~scope + |> getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~allFiles + ~pos ~env ~exact:true ~scope |> completionsGetCompletionType ~full with | None -> [] | Some (typ, env) -> [ Completion.create "dummy" ~env - ~kind:(Completion.ExtractedType (Toption (env, typ), `Type)); + ~kind: + (Completion.ExtractedType (Toption (env, ExtractedType typ), `Type)); ]) | CPId (path, completionContext) -> path - |> getCompletionsForPath ~package ~opens ~allFiles ~pos ~exact + |> getCompletionsForPath ~debug ~package ~opens ~allFiles ~pos ~exact ~completionContext ~env ~scope | CPApply (cp, labels) -> ( match cp - |> getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env - ~exact:true ~scope - |> completionsGetTypeEnv + |> getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~allFiles + ~pos ~env ~exact:true ~scope + |> completionsGetCompletionType2 ~debug ~full ~opens ~rawOpens ~allFiles + ~pos ~scope with - | Some (typ, env) -> ( + | Some ((TypeExpr typ | ExtractedType (Tfunction {typ})), env) -> ( let rec reconstructFunctionType args tRet = match args with | [] -> tRet @@ -729,42 +781,58 @@ let rec getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env let retType = reconstructFunctionType args tRet in [Completion.create "dummy" ~env ~kind:(Completion.Value retType)] | _ -> []) - | None -> []) + | _ -> []) | CPField (CPId (path, Module), fieldName) -> (* M.field *) path @ [fieldName] - |> getCompletionsForPath ~package ~opens ~allFiles ~pos ~exact + |> getCompletionsForPath ~debug ~package ~opens ~allFiles ~pos ~exact ~completionContext:Field ~env ~scope | CPField (cp, fieldName) -> ( - match + let completionsForCtxPath = cp - |> getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env - ~exact:true ~scope - |> completionsGetTypeEnv - with - | Some (typ, env) -> ( - match typ |> TypeUtils.extractRecordType ~env ~package with - | Some (env, fields, typDecl) -> - fields - |> Utils.filterMap (fun field -> - if Utils.checkName field.fname.txt ~prefix:fieldName ~exact then - Some - (Completion.create field.fname.txt ~env - ~docstring:field.docstring ?deprecated:field.deprecated - ~kind: - (Completion.Field - ( field, - typDecl.item.decl - |> Shared.declToString typDecl.name.txt ))) - else None) - | None -> []) - | None -> []) + |> getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~allFiles + ~pos ~env ~exact:true ~scope + in + let extracted = + match + completionsForCtxPath + |> completionsGetCompletionType2 ~debug ~full ~opens ~rawOpens ~allFiles + ~pos ~scope + with + | Some (TypeExpr typ, env) -> ( + match typ |> TypeUtils.extractRecordType ~env ~package with + | Some (env, fields, typDecl) -> + Some + ( env, + fields, + typDecl.item.decl |> Shared.declToString typDecl.name.txt ) + | None -> None) + | Some (ExtractedType typ, env) -> ( + match typ with + | Trecord {fields} -> + Some (env, fields, typ |> TypeUtils.extractedTypeToString) + | _ -> None) + | None -> None + in + match extracted with + | None -> [] + | Some (env, fields, recordAsString) -> + fields + |> Utils.filterMap (fun field -> + if Utils.checkName field.fname.txt ~prefix:fieldName ~exact then + Some + (Completion.create field.fname.txt ~env + ?deprecated:field.deprecated ~docstring:field.docstring + ~kind:(Completion.Field (field, recordAsString))) + else None)) | CPObj (cp, label) -> ( + (* TODO: Also needs to support ExtractedType *) match cp - |> getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env - ~exact:true ~scope - |> completionsGetTypeEnv + |> getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~allFiles + ~pos ~env ~exact:true ~scope + |> completionsGetTypeEnv2 ~debug ~full ~opens ~rawOpens ~allFiles ~pos + ~scope with | Some (typ, env) -> ( match typ |> TypeUtils.extractObjectType ~env ~package with @@ -789,9 +857,10 @@ let rec getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env | CPPipe {contextPath = cp; id = funNamePrefix; lhsLoc; inJsx} -> ( match cp - |> getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env - ~exact:true ~scope ~mode:Pipe - |> completionsGetTypeEnv + |> getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~allFiles + ~pos ~env ~exact:true ~scope ~mode:Pipe + |> completionsGetTypeEnv2 ~debug ~full ~opens ~rawOpens ~allFiles ~pos + ~scope with | None -> [] | Some (typ, envFromCompletionItem) -> ( @@ -799,6 +868,12 @@ let rec getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env typ |> TypeUtils.resolveTypeForPipeCompletion ~env ~package ~full ~lhsLoc in + if debug then + if env <> envFromCompletionItem then + Printf.printf "CPPipe env:%s envFromCompletionItem:%s\n" + (QueryEnv.toString env) + (QueryEnv.toString envFromCompletionItem) + else Printf.printf "CPPipe env:%s\n" (QueryEnv.toString env); let completionPath = match typ with | Builtin (builtin, _) -> @@ -832,21 +907,26 @@ let rec getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env | Tlink {desc = Tconstr (path, _typeArgs, _)} | Tsubst {desc = Tconstr (path, _typeArgs, _)} | Tpoly ({desc = Tconstr (path, _typeArgs, _)}, []) -> ( + if debug then Printf.printf "CPPipe type path:%s\n" (Path.name path); match Utils.expandPath path with | _ :: pathRev -> (* type path is relative to the completion environment express it from the root of the file *) - let pathFromEnv_ = + let found, pathFromEnv = QueryEnv.pathFromEnv envFromCompletionItem (List.rev pathRev) in - if pathFromEnv_ = [] then None - else - let pathFromEnv = - if env.file.moduleName = envFromCompletionItem.file.moduleName - then pathFromEnv_ - else envFromCompletionItem.file.moduleName :: pathFromEnv_ - in - Some pathFromEnv + if debug then + Printf.printf "CPPipe pathFromEnv:%s found:%b\n" + (pathFromEnv |> String.concat ".") + found; + if pathFromEnv = [] then None + else if + env.file.moduleName <> envFromCompletionItem.file.moduleName + && found + (* If the module names are different, then one needs to qualify the path. + But only if the path belongs to the env from completion *) + then Some (envFromCompletionItem.file.moduleName :: pathFromEnv) + else Some pathFromEnv | _ -> None) | _ -> None) in @@ -879,7 +959,7 @@ let rec getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env in let completions = completionPath @ [funNamePrefix] - |> getCompletionsForPath ~completionContext:Value ~exact:false + |> getCompletionsForPath ~debug ~completionContext:Value ~exact:false ~package ~opens ~allFiles ~pos ~env ~scope in let completions = @@ -927,8 +1007,8 @@ let rec getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env ctxPaths |> List.map (fun contextPath -> contextPath - |> getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles - ~pos ~env ~exact:true ~scope) + |> getCompletionsForContextPath ~debug ~full ~opens ~rawOpens + ~allFiles ~pos ~env ~exact:true ~scope) |> List.filter_map (fun completionItems -> match completionItems with | {Completion.kind = Value typ} :: _ -> Some typ @@ -943,9 +1023,10 @@ let rec getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env | CJsxPropValue {pathToComponent; propName} -> ( let findTypeOfValue path = path - |> getCompletionsForPath ~completionContext:Value ~exact:true ~package - ~opens ~allFiles ~pos ~env ~scope - |> completionsGetTypeEnv + |> getCompletionsForPath ~debug ~completionContext:Value ~exact:true + ~package ~opens ~allFiles ~pos ~env ~scope + |> completionsGetTypeEnv2 ~debug ~full ~opens ~rawOpens ~allFiles ~pos + ~scope in let lowercaseComponent = match pathToComponent with @@ -954,25 +1035,25 @@ let rec getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env in let targetLabel = if lowercaseComponent then - let rec digToTypeForCompletion path ~env = + let rec digToTypeForCompletion path = match path - |> getCompletionsForPath ~completionContext:Type ~exact:true + |> getCompletionsForPath ~debug ~completionContext:Type ~exact:true ~package ~opens ~allFiles ~pos ~env ~scope with - | {kind = Type {kind = Abstract (Some (p, _))}; env} :: _ -> + | {kind = Type {kind = Abstract (Some (p, _))}} :: _ -> (* This case happens when what we're looking for is a type alias. This is the case in newer rescript-react versions where ReactDOM.domProps is an alias for JsxEvent.t. *) let pathRev = p |> Utils.expandPath in - pathRev |> List.rev |> digToTypeForCompletion ~env - | {kind = Type {kind = Record fields}; env} :: _ -> ( + pathRev |> List.rev |> digToTypeForCompletion + | {kind = Type {kind = Record fields}} :: _ -> ( match fields |> List.find_opt (fun f -> f.fname.txt = propName) with | None -> None | Some f -> Some (f.fname.txt, f.typ, env)) | _ -> None in - ["ReactDOM"; "domProps"] |> digToTypeForCompletion ~env + ["ReactDOM"; "domProps"] |> digToTypeForCompletion else CompletionJsx.getJsxLabels ~componentPath:pathToComponent ~findTypeOfValue ~package @@ -989,22 +1070,26 @@ let rec getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env let labels, env = match functionContextPath - |> getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos - ~env ~exact:true ~scope - |> completionsGetTypeEnv + |> getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~allFiles + ~pos ~env ~exact:true ~scope + |> completionsGetCompletionType2 ~debug ~full ~opens ~rawOpens ~allFiles + ~pos ~scope with - | Some (typ, env) -> (typ |> TypeUtils.getArgs ~full ~env, env) - | None -> ([], env) + | Some ((TypeExpr typ | ExtractedType (Tfunction {typ})), env) -> + (typ |> TypeUtils.getArgs ~full ~env, env) + | _ -> ([], env) in let targetLabel = labels |> List.find_opt (fun (label, _) -> - match argumentLabel with - | Unlabelled _ -> label = argumentLabel - | Labelled name | Optional name -> ( - match label with - | (Labelled n | Optional n) when name = n -> true - | _ -> false)) + match (argumentLabel, label) with + | ( Unlabelled {argumentPosition = pos1}, + Completable.Unlabelled {argumentPosition = pos2} ) -> + pos1 = pos2 + | ( (Labelled name1 | Optional name1), + (Labelled name2 | Optional name2) ) -> + name1 = name2 + | _ -> false) in let expandOption = match targetLabel with @@ -1020,6 +1105,20 @@ let rec getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env (Completion.Value (if expandOption then Utils.unwrapIfOption typ else typ)); ]) + | CPatternPath {rootCtxPath; nested} -> ( + match + rootCtxPath + |> getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~allFiles + ~pos ~env ~exact:true ~scope + |> completionsGetCompletionType2 ~debug ~full ~opens ~rawOpens ~allFiles + ~pos ~scope + with + | Some (typ, env) -> ( + match typ |> TypeUtils.resolveNestedPatternPath ~env ~full ~nested with + | Some (typ, env) -> + [Completion.create "dummy" ~env ~kind:(kindFromInnerType typ)] + | None -> []) + | None -> []) let getOpens ~debug ~rawOpens ~package ~env = if debug && rawOpens <> [] then @@ -1115,27 +1214,31 @@ let rec completeTypedValue ~full ~prefix ~completionContext ~mode ~env ()) |> filterItems ~prefix | Toption (env, t) -> - let innerType = TypeUtils.unwrapCompletionTypeIfOption t in + let innerType = + match t with + | ExtractedType t -> Some t + | TypeExpr t -> t |> TypeUtils.extractType ~env ~package:full.package + in let expandedCompletions = - innerType - |> completeTypedValue ~full ~prefix ~completionContext ~mode - |> List.map (fun (c : Completion.t) -> - { - c with - name = "Some(" ^ c.name ^ ")"; - sortText = None; - insertText = - (match c.insertText with - | None -> None - | Some insertText -> Some ("Some(" ^ insertText ^ ")")); - }) + match innerType with + | None -> [] + | Some innerType -> + innerType + |> completeTypedValue ~full ~prefix ~completionContext ~mode + |> List.map (fun (c : Completion.t) -> + { + c with + name = "Some(" ^ c.name ^ ")"; + sortText = None; + insertText = + (match c.insertText with + | None -> None + | Some insertText -> Some ("Some(" ^ insertText ^ ")")); + }) in [ - Completion.create "None" - ~kind:(Label (t |> TypeUtils.extractedTypeToString)) - ~env; - Completion.createWithSnippet ~name:"Some(_)" - ~kind:(Label (t |> TypeUtils.extractedTypeToString)) + Completion.create "None" ~kind:(kindFromInnerType t) ~env; + Completion.createWithSnippet ~name:"Some(_)" ~kind:(kindFromInnerType t) ~env ~insertText:"Some(${1:_})" (); ] @ expandedCompletions @@ -1217,11 +1320,14 @@ let rec completeTypedValue ~full ~prefix ~completionContext ~mode ~insertText:(if !Cfg.supportsSnippets then "[$0]" else "[]") ~sortText:"A" ~kind: - (ExtractedType - ( typ, - match mode with - | Pattern _ -> `Type - | Expression -> `Value )) + (match typ with + | ExtractedType typ -> + ExtractedType + ( typ, + match mode with + | Pattern _ -> `Type + | Expression -> `Value ) + | TypeExpr typ -> Value typ) ~env (); ] else [] @@ -1304,24 +1410,26 @@ let rec completeTypedValue ~full ~prefix ~completionContext ~mode ~env; ] -let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover - (completable : Completable.t) = +let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover completable = + if debug then + Printf.printf "Completable: %s\n" (Completable.toString completable); let package = full.package in let rawOpens = Scope.getRawOpens scope in let opens = getOpens ~debug ~rawOpens ~package ~env in let allFiles = FileSet.union package.projectFiles package.dependenciesFiles in let findTypeOfValue path = path - |> getCompletionsForPath ~completionContext:Value ~exact:true ~package - ~opens ~allFiles ~pos ~env ~scope - |> completionsGetTypeEnv + |> getCompletionsForPath ~debug ~completionContext:Value ~exact:true + ~package ~opens ~allFiles ~pos ~env ~scope + |> completionsGetTypeEnv2 ~debug ~full ~opens ~rawOpens ~allFiles ~pos + ~scope in match completable with | Cnone -> [] | Cpath contextPath -> contextPath - |> getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env - ~exact:forHover ~scope + |> getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~allFiles ~pos + ~env ~exact:forHover ~scope | Cjsx ([id], prefix, identsSeen) when String.uncapitalize_ascii id = id -> (* Lowercase JSX tag means builtin *) let mkLabel (name, typString) = @@ -1378,9 +1486,10 @@ let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover let labels = match cp - |> getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos - ~env ~exact:true ~scope - |> completionsGetTypeEnv + |> getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~allFiles + ~pos ~env ~exact:true ~scope + |> completionsGetTypeEnv2 ~debug ~full ~opens ~rawOpens ~allFiles ~pos + ~scope with | Some (typ, _env) -> if debug then @@ -1414,9 +1523,10 @@ let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover in match contextPath - |> getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env - ~exact:true ~scope - |> completionsGetTypeEnv + |> getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~allFiles + ~pos ~env ~exact:true ~scope + |> completionsGetTypeEnv2 ~debug ~full ~opens ~rawOpens ~allFiles ~pos + ~scope with | Some (typ, env) -> ( match @@ -1447,8 +1557,8 @@ let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover in match contextPath - |> getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env - ~exact:true ~scope + |> getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~allFiles + ~pos ~env ~exact:true ~scope |> completionsGetCompletionType ~full with | None -> regularCompletions @@ -1527,8 +1637,8 @@ let rec processCompletable ~debug ~full ~scope ~env ~pos ~forHover in let completionsForContextPath = contextPath - |> getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env - ~exact:forHover ~scope + |> getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~allFiles + ~pos ~env ~exact:forHover ~scope in completionsForContextPath |> List.map (fun (c : Completion.t) -> diff --git a/analysis/src/CompletionFrontEnd.ml b/analysis/src/CompletionFrontEnd.ml index e0d79bccf..470becc5e 100644 --- a/analysis/src/CompletionFrontEnd.ml +++ b/analysis/src/CompletionFrontEnd.ml @@ -141,12 +141,14 @@ let rec exprToContextPath (e : Parsetree.expression) = | Pexp_constant (Pconst_string _) -> Some Completable.CPString | Pexp_constant (Pconst_integer _) -> Some CPInt | Pexp_constant (Pconst_float _) -> Some CPFloat + | Pexp_construct ({txt = Lident ("true" | "false")}, None) -> Some CPBool | Pexp_array exprs -> Some (CPArray (match exprs with | [] -> None | exp :: _ -> exprToContextPath exp)) + | Pexp_ident {txt = Lident "|."} -> None | Pexp_ident {txt} -> Some (CPId (Utils.flattenLongIdent txt, Value)) | Pexp_field (e1, {txt = Lident name}) -> ( match exprToContextPath e1 with @@ -159,6 +161,33 @@ let rec exprToContextPath (e : Parsetree.expression) = match exprToContextPath e1 with | None -> None | Some contexPath -> Some (CPObj (contexPath, txt))) + | Pexp_apply + ( {pexp_desc = Pexp_ident {txt = Lident "|."}}, + [ + (_, lhs); + (_, {pexp_desc = Pexp_apply (d, args); pexp_loc; pexp_attributes}); + ] ) -> + (* Transform away pipe with apply call *) + exprToContextPath + { + pexp_desc = Pexp_apply (d, (Nolabel, lhs) :: args); + pexp_loc; + pexp_attributes; + } + | Pexp_apply + ( {pexp_desc = Pexp_ident {txt = Lident "|."}}, + [(_, lhs); (_, {pexp_desc = Pexp_ident id; pexp_loc; pexp_attributes})] + ) -> + (* Transform away pipe with identifier *) + exprToContextPath + { + pexp_desc = + Pexp_apply + ( {pexp_desc = Pexp_ident id; pexp_loc; pexp_attributes}, + [(Nolabel, lhs)] ); + pexp_loc; + pexp_attributes; + } | Pexp_apply (e1, args) -> ( match exprToContextPath e1 with | None -> None @@ -170,7 +199,7 @@ let rec exprToContextPath (e : Parsetree.expression) = else None | _ -> None -let completePipeChain ~(lhs : Parsetree.expression) = +let completePipeChain (exp : Parsetree.expression) = (* Complete the end of pipe chains by reconstructing the pipe chain as a single pipe, so it can be completed. Example: @@ -178,38 +207,19 @@ let completePipeChain ~(lhs : Parsetree.expression) = will complete as: Js.Array2.map(someArray->Js.Array2.filter(v => v > 10), v => v + 2)-> *) - match lhs.pexp_desc with + match exp.pexp_desc with (* When the left side of the pipe we're completing is a function application. Example: someArray->Js.Array2.map(v => v + 2)-> *) | Pexp_apply ( {pexp_desc = Pexp_ident {txt = Lident "|."}}, - [ - (_, lhs); - (_, {pexp_desc = Pexp_apply (d, args); pexp_loc; pexp_attributes}); - ] ) -> - exprToContextPath - { - pexp_desc = Pexp_apply (d, (Nolabel, lhs) :: args); - pexp_loc; - pexp_attributes; - } - |> Option.map (fun ctxPath -> (ctxPath, d.pexp_loc)) + [_; (_, {pexp_desc = Pexp_apply (d, _)})] ) -> + exprToContextPath exp |> Option.map (fun ctxPath -> (ctxPath, d.pexp_loc)) (* When the left side of the pipe we're completing is an identifier application. Example: someArray->filterAllTheGoodStuff-> *) | Pexp_apply ( {pexp_desc = Pexp_ident {txt = Lident "|."}}, - [(_, lhs); (_, {pexp_desc = Pexp_ident id; pexp_loc; pexp_attributes})] - ) -> - exprToContextPath - { - pexp_desc = - Pexp_apply - ( {pexp_desc = Pexp_ident id; pexp_loc; pexp_attributes}, - [(Nolabel, lhs)] ); - pexp_loc; - pexp_attributes; - } - |> Option.map (fun ctxPath -> (ctxPath, pexp_loc)) + [_; (_, {pexp_desc = Pexp_ident _; pexp_loc})] ) -> + exprToContextPath exp |> Option.map (fun ctxPath -> (ctxPath, pexp_loc)) | _ -> None let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor ~text = @@ -257,6 +267,26 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor ~text = Utils.flattenLongIdent ~cutAtOffset ~jsx lid.txt in + let currentCtxPath = ref None in + let processingFun = ref None in + let setCurrentCtxPath ctxPath = + if !Cfg.debugFollowCtxPath then + Printf.printf "setting current ctxPath: %s\n" + (Completable.contextPathToString ctxPath); + currentCtxPath := Some ctxPath + in + let resetCurrentCtxPath ctxPath = + (match (!currentCtxPath, ctxPath) with + | None, None -> () + | _ -> + if !Cfg.debugFollowCtxPath then + Printf.printf "resetting current ctxPath to: %s\n" + (match ctxPath with + | None -> "None" + | Some ctxPath -> Completable.contextPathToString ctxPath)); + currentCtxPath := ctxPath + in + let found = ref false in let result = ref None in let scope = ref (Scope.create ()) in @@ -271,43 +301,114 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor ~text = scope := !scope |> Scope.addValue ~name:vd.pval_name.txt ~loc:vd.pval_name.loc in - let rec scopePattern (pat : Parsetree.pattern) = + let rec scopePattern ?contextPath + ?(patternPath : Completable.nestedPath list = []) + (pat : Parsetree.pattern) = + let contextPathToSave = + match (contextPath, patternPath) with + | maybeContextPath, [] -> maybeContextPath + | Some contextPath, patternPath -> + Some + (Completable.CPatternPath + {rootCtxPath = contextPath; nested = List.rev patternPath}) + | _ -> None + in match pat.ppat_desc with | Ppat_any -> () - | Ppat_var {txt; loc} -> scope := !scope |> Scope.addValue ~name:txt ~loc + | Ppat_var {txt; loc} -> + scope := + !scope |> Scope.addValue ~name:txt ~loc ?contextPath:contextPathToSave | Ppat_alias (p, asA) -> - scopePattern p; - scope := !scope |> Scope.addValue ~name:asA.txt ~loc:asA.loc + scopePattern p ~patternPath ?contextPath; + let ctxPath = + if contextPathToSave = None then + match p with + | {ppat_desc = Ppat_var {txt}} -> + Some (Completable.CPId ([txt], Value)) + | _ -> None + else None + in + scope := + !scope |> Scope.addValue ~name:asA.txt ~loc:asA.loc ?contextPath:ctxPath | Ppat_constant _ | Ppat_interval _ -> () - | Ppat_tuple pl -> pl |> List.iter scopePattern + | Ppat_tuple pl -> + pl + |> List.iteri (fun index p -> + scopePattern p + ~patternPath:(NTupleItem {itemNum = index} :: patternPath) + ?contextPath) | Ppat_construct (_, None) -> () - | Ppat_construct (_, Some p) -> scopePattern p + | Ppat_construct ({txt}, Some {ppat_desc = Ppat_tuple pl}) -> + pl + |> List.iteri (fun index p -> + scopePattern p + ~patternPath: + (NVariantPayload + { + itemNum = index; + constructorName = Utils.getUnqualifiedName txt; + } + :: patternPath) + ?contextPath) + | Ppat_construct ({txt}, Some p) -> + scopePattern + ~patternPath: + (NVariantPayload + {itemNum = 0; constructorName = Utils.getUnqualifiedName txt} + :: patternPath) + ?contextPath p | Ppat_variant (_, None) -> () - | Ppat_variant (_, Some p) -> scopePattern p + | Ppat_variant (txt, Some {ppat_desc = Ppat_tuple pl}) -> + pl + |> List.iteri (fun index p -> + scopePattern p + ~patternPath: + (NPolyvariantPayload {itemNum = index; constructorName = txt} + :: patternPath) + ?contextPath) + | Ppat_variant (txt, Some p) -> + scopePattern + ~patternPath: + (NPolyvariantPayload {itemNum = 0; constructorName = txt} + :: patternPath) + ?contextPath p | Ppat_record (fields, _) -> - fields |> List.iter (fun (_, p) -> scopePattern p) - | Ppat_array pl -> pl |> List.iter scopePattern - | Ppat_or (p1, _) -> scopePattern p1 - | Ppat_constraint (p, _) -> scopePattern p + fields + |> List.iter (fun (fname, p) -> + match fname with + | {Location.txt = Longident.Lident fname} -> + scopePattern + ~patternPath: + (Completable.NFollowRecordField {fieldName = fname} + :: patternPath) + ?contextPath p + | _ -> ()) + | Ppat_array pl -> + pl + |> List.iter + (scopePattern ~patternPath:(NArray :: patternPath) ?contextPath) + | Ppat_or (p1, _) -> scopePattern ~patternPath ?contextPath p1 + | Ppat_constraint (p, coreType) -> + scopePattern ~patternPath + ?contextPath:(TypeUtils.contextPathFromCoreType coreType) + p | Ppat_type _ -> () - | Ppat_lazy p -> scopePattern p - | Ppat_unpack {txt; loc} -> scope := !scope |> Scope.addValue ~name:txt ~loc - | Ppat_exception p -> scopePattern p + | Ppat_lazy p -> scopePattern ~patternPath ?contextPath p + | Ppat_unpack {txt; loc} -> + scope := + !scope |> Scope.addValue ~name:txt ~loc ?contextPath:contextPathToSave + | Ppat_exception p -> scopePattern ~patternPath ?contextPath p | Ppat_extension _ -> () - | Ppat_open (_, p) -> scopePattern p + | Ppat_open (_, p) -> scopePattern ~patternPath ?contextPath p in - - let lookingForPat = ref None in - let locHasCursor = CursorPosition.locHasCursor ~pos:posBeforeCursor in let locIsEmpty = CursorPosition.locIsEmpty ~pos:posBeforeCursor in - - let completePattern (pat : Parsetree.pattern) = + let completePattern ?contextPath (pat : Parsetree.pattern) = match ( pat |> CompletionPatterns.traversePattern ~patternPath:[] ~locHasCursor ~firstCharBeforeCursorNoWhite ~posBeforeCursor, - !lookingForPat ) + contextPath ) with | Some (prefix, nestedPattern), Some ctxPath -> setResult @@ -322,7 +423,15 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor ~text = | _ -> () in let scopeValueBinding (vb : Parsetree.value_binding) = - scopePattern vb.pvb_pat + let contextPath = + (* Pipe chains get special treatment here, because when assigning values + we want the return of the entire pipe chain as a function call, rather + than as a pipe completion call. *) + match completePipeChain vb.pvb_expr with + | Some (ctxPath, _) -> Some ctxPath + | None -> exprToContextPath vb.pvb_expr + in + scopePattern ?contextPath vb.pvb_pat in let scopeTypeKind (tk : Parsetree.type_kind) = match tk with @@ -352,10 +461,7 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor ~text = scope := !scope |> Scope.addModule ~name:md.pmd_name.txt ~loc:md.pmd_name.loc in - let setLookingForPat ctxPath = lookingForPat := Some ctxPath in let inJsxContext = ref false in - - let unsetLookingForPat () = lookingForPat := None in (* Identifies expressions where we can do typed pattern or expr completion. *) let typedCompletionExpr (exp : Parsetree.expression) = if exp.pexp_loc |> CursorPosition.locHasCursor ~pos:posBeforeCursor then @@ -415,7 +521,7 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor ~text = match (hasCaseWithEmptyLoc, hasCaseWithCursor) with | _, true -> (* Always continue if there's a case with the cursor *) - setLookingForPat ctxPath + () | true, false -> (* If there's no case with the cursor, but a broken parser case, complete for the top level. *) setResult @@ -428,15 +534,7 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor ~text = patternMode = Default; }) | false, false -> ())) - | _ -> unsetLookingForPat () - in - - let case (iterator : Ast_iterator.iterator) (case : Parsetree.case) = - let oldScope = !scope in - scopePattern case.pc_lhs; - completePattern case.pc_lhs; - Ast_iterator.default_iterator.case iterator case; - scope := oldScope + | _ -> () in let structure (iterator : Ast_iterator.iterator) (structure : Parsetree.structure) = @@ -446,7 +544,6 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor ~text = in let structure_item (iterator : Ast_iterator.iterator) (item : Parsetree.structure_item) = - unsetLookingForPat (); let processed = ref false in (match item.pstr_desc with | Pstr_open {popen_lid} -> @@ -609,7 +706,47 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor ~text = | _ -> ()); Ast_iterator.default_iterator.attribute iterator (id, payload) in - let expr (iterator : Ast_iterator.iterator) (expr : Parsetree.expression) = + let rec iterateFnArguments ~args ~iterator ~isPipe + (argCompletable : Completable.t option) = + match argCompletable with + | None -> ( + match !currentCtxPath with + | None -> () + | Some functionContextPath -> + let currentUnlabelledCount = ref (if isPipe then 1 else 0) in + args + |> List.iter (fun (arg : arg) -> + let previousCtxPath = !currentCtxPath in + setCurrentCtxPath + (CArgument + { + functionContextPath; + argumentLabel = + (match arg with + | {label = None} -> + let current = !currentUnlabelledCount in + currentUnlabelledCount := current + 1; + Unlabelled {argumentPosition = current} + | {label = Some {name; opt = true}} -> Optional name + | {label = Some {name; opt = false}} -> Labelled name); + }); + expr iterator arg.exp; + resetCurrentCtxPath previousCtxPath)) + | Some argCompletable -> setResult argCompletable + and iterateJsxProps ~iterator (props : CompletionJsx.jsxProps) = + props.props + |> List.iter (fun (prop : CompletionJsx.prop) -> + let previousCtxPath = !currentCtxPath in + setCurrentCtxPath + (CJsxPropValue + { + pathToComponent = + Utils.flattenLongIdent ~jsx:true props.compName.txt; + propName = prop.name; + }); + expr iterator prop.exp; + resetCurrentCtxPath previousCtxPath) + and expr (iterator : Ast_iterator.iterator) (expr : Parsetree.expression) = let oldInJsxContext = !inJsxContext in let processed = ref false in let setFound () = @@ -620,7 +757,7 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor ~text = (Loc.toString expr.pexp_loc) in let setPipeResult ~(lhs : Parsetree.expression) ~id = - match completePipeChain ~lhs with + match completePipeChain lhs with | None -> ( match exprToContextPath lhs with | Some pipe -> @@ -643,6 +780,17 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor ~text = in typedCompletionExpr expr; match expr.pexp_desc with + | Pexp_match (expr, cases) when cases <> [] -> + let ctxPath = exprToContextPath expr in + let oldCtxPath = !currentCtxPath in + cases + |> List.iter (fun (case : Parsetree.case) -> + let oldScope = !scope in + completePattern ?contextPath:ctxPath case.pc_lhs; + scopePattern ?contextPath:ctxPath case.pc_lhs; + Ast_iterator.default_iterator.case iterator case; + scope := oldScope); + resetCurrentCtxPath oldCtxPath | Pexp_apply ( {pexp_desc = Pexp_ident {txt = Lident "|."; loc = opLoc}}, [ @@ -653,7 +801,7 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor ~text = (* Case foo-> when the parser adds a ghost expression to the rhs so the apply expression does not include the cursor *) if setPipeResult ~lhs ~id:"" then setFound () - | _ -> + | _ -> ( if expr.pexp_loc |> Loc.hasPos ~pos:posNoWhite && !result = None then ( setFound (); match expr.pexp_desc with @@ -740,6 +888,7 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor ~text = | [prefix] when Char.lowercase_ascii prefix.[0] = prefix.[0] -> ChtmlElement {prefix} | _ -> Cpath (CPId (compNamePath, Module))) + else iterateJsxProps ~iterator jsxProps | Pexp_apply ( {pexp_desc = Pexp_ident {txt = Lident "|."}}, [ @@ -763,11 +912,12 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor ~text = But it should not fire in foo(~a)<---there *) not (Loc.end_ expr.pexp_loc = posCursor - && charBeforeCursor = Some ')') -> + && charBeforeCursor = Some ')') -> ( (* Complete fn argument values and named args when the fn call is piped. E.g. someVar->someFn(). *) let args = extractExpApplyArgs ~args in + let funCtxPath = exprToContextPath funExpr in let argCompletable = - match exprToContextPath funExpr with + match funCtxPath with | Some contextPath -> findArgCompletables ~contextPath ~args ~endPos:(Loc.end_ expr.pexp_loc) ~posBeforeCursor @@ -776,15 +926,23 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor ~text = ~firstCharBeforeCursorNoWhite | None -> None in - - setResultOpt argCompletable + match argCompletable with + | None -> ( + match funCtxPath with + | None -> () + | Some funCtxPath -> + let oldCtxPath = !currentCtxPath in + setCurrentCtxPath funCtxPath; + argCompletable |> iterateFnArguments ~isPipe:true ~args ~iterator; + resetCurrentCtxPath oldCtxPath) + | Some argCompletable -> setResult argCompletable) | Pexp_apply ({pexp_desc = Pexp_ident {txt = Lident "|."}}, [_; _]) -> (* Ignore any other pipe. *) () | Pexp_apply (funExpr, args) when not (Loc.end_ expr.pexp_loc = posCursor - && charBeforeCursor = Some ')') -> + && charBeforeCursor = Some ')') -> ( (* Complete fn argument values and named args when the fn call is _not_ piped. E.g. someFn(). *) let args = extractExpApplyArgs ~args in if debug then @@ -802,8 +960,9 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor ~text = (Loc.toString exp.pexp_loc)) |> String.concat ", "); + let funCtxPath = exprToContextPath funExpr in let argCompletable = - match exprToContextPath funExpr with + match funCtxPath with | Some contextPath -> findArgCompletables ~contextPath ~args ~endPos:(Loc.end_ expr.pexp_loc) ~posBeforeCursor @@ -812,8 +971,16 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor ~text = ~firstCharBeforeCursorNoWhite | None -> None in - - setResultOpt argCompletable + match argCompletable with + | None -> ( + match funCtxPath with + | None -> () + | Some funCtxPath -> + let oldCtxPath = !currentCtxPath in + setCurrentCtxPath funCtxPath; + argCompletable |> iterateFnArguments ~isPipe:false ~args ~iterator; + resetCurrentCtxPath oldCtxPath) + | Some argCompletable -> setResult argCompletable) | Pexp_send (lhs, {txt; loc}) -> ( (* e["txt"] If the string for txt is not closed, it could go over several lines. @@ -840,13 +1007,36 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor ~text = match exprToContextPath lhs with | Some contextPath -> setResult (Cpath (CPObj (contextPath, label))) | None -> ()) - | Pexp_fun (_lbl, defaultExpOpt, pat, e) -> + | Pexp_fun (lbl, defaultExpOpt, pat, e) -> let oldScope = !scope in + (match (!processingFun, !currentCtxPath) with + | None, Some ctxPath -> processingFun := Some (ctxPath, 0) + | _ -> ()); + let argContextPath = + match !processingFun with + | None -> None + | Some (ctxPath, currentUnlabelledCount) -> + (processingFun := + match lbl with + | Nolabel -> Some (ctxPath, currentUnlabelledCount + 1) + | _ -> Some (ctxPath, currentUnlabelledCount)); + Some + (Completable.CArgument + { + functionContextPath = ctxPath; + argumentLabel = + (match lbl with + | Nolabel -> + Unlabelled {argumentPosition = currentUnlabelledCount} + | Optional name -> Optional name + | Labelled name -> Labelled name); + }) + in (match defaultExpOpt with | None -> () | Some defaultExp -> iterator.expr iterator defaultExp); - scopePattern pat; - completePattern pat; + completePattern ?contextPath:argContextPath pat; + scopePattern ?contextPath:argContextPath pat; iterator.pat iterator pat; iterator.expr iterator e; scope := oldScope; @@ -876,7 +1066,10 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor ~text = processed := true | _ -> ()); if not !processed then Ast_iterator.default_iterator.expr iterator expr; - inJsxContext := oldInJsxContext + inJsxContext := oldInJsxContext; + match expr.pexp_desc with + | Pexp_fun _ -> () + | _ -> processingFun := None) in let typ (iterator : Ast_iterator.iterator) (core_type : Parsetree.core_type) = if core_type.ptyp_loc |> Loc.hasPos ~pos:posNoWhite then ( @@ -973,7 +1166,6 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor ~text = { Ast_iterator.default_iterator with attribute; - case; expr; location; module_expr; diff --git a/analysis/src/Completions.ml b/analysis/src/Completions.ml new file mode 100644 index 000000000..3b455817b --- /dev/null +++ b/analysis/src/Completions.ml @@ -0,0 +1,22 @@ +let getCompletions ~debug ~path ~pos ~currentFile ~forHover = + let textOpt = Files.readFile currentFile in + match textOpt with + | None | Some "" -> None + | Some text -> ( + match + CompletionFrontEnd.completionWithParser ~debug ~path ~posCursor:pos + ~currentFile ~text + with + | None -> None + | Some (completable, scope) -> ( + (* Only perform expensive ast operations if there are completables *) + match Cmt.loadFullCmtFromPath ~path with + | None -> None + | Some full -> + let env = SharedTypes.QueryEnv.fromFile full.file in + let completables = + completable + |> CompletionBackEnd.processCompletable ~debug ~full ~pos ~scope ~env + ~forHover + in + Some (completables, full))) diff --git a/analysis/src/Hover.ml b/analysis/src/Hover.ml index 307f6155a..3ab1a0c74 100644 --- a/analysis/src/Hover.ml +++ b/analysis/src/Hover.ml @@ -123,54 +123,33 @@ let hoverWithExpandedTypes ~file ~package ~supportsMarkdownLinks typ = makes it (most often) work with unsaved content. *) let getHoverViaCompletions ~debug ~path ~pos ~currentFile ~forHover ~supportsMarkdownLinks = - let textOpt = Files.readFile currentFile in - match textOpt with - | None | Some "" -> None - | Some text -> ( - match - CompletionFrontEnd.completionWithParser ~debug ~path ~posCursor:pos - ~currentFile ~text - with - | None -> None - | Some (completable, scope) -> ( - if debug then - Printf.printf "Completable: %s\n" - (SharedTypes.Completable.toString completable); - (* Only perform expensive ast operations if there are completables *) - match Cmt.loadFullCmtFromPath ~path with - | None -> None - | Some full -> ( - let {file; package} = full in - let env = SharedTypes.QueryEnv.fromFile file in - let completions = - completable - |> CompletionBackEnd.processCompletable ~debug ~full ~pos ~scope ~env - ~forHover + match Completions.getCompletions ~debug ~path ~pos ~currentFile ~forHover with + | None -> None + | Some (completions, {file; package}) -> ( + match completions with + | {kind = Label typString; docstring} :: _ -> + let parts = + (if typString = "" then [] else [Markdown.codeBlock typString]) + @ docstring + in + Some (Protocol.stringifyHover (String.concat "\n\n" parts)) + | {kind = Field _; docstring} :: _ -> ( + match CompletionBackEnd.completionsGetTypeEnv completions with + | Some (typ, _env) -> + let typeString = + hoverWithExpandedTypes ~file ~package ~supportsMarkdownLinks typ in - match completions with - | {kind = Label typString; docstring} :: _ -> - let parts = - (if typString = "" then [] else [Markdown.codeBlock typString]) - @ docstring - in - Some (Protocol.stringifyHover (String.concat "\n\n" parts)) - | {kind = Field _; docstring} :: _ -> ( - match CompletionBackEnd.completionsGetTypeEnv completions with - | Some (typ, _env) -> - let typeString = - hoverWithExpandedTypes ~file ~package ~supportsMarkdownLinks typ - in - let parts = typeString :: docstring in - Some (Protocol.stringifyHover (String.concat "\n\n" parts)) - | None -> None) - | _ -> ( - match CompletionBackEnd.completionsGetTypeEnv completions with - | Some (typ, _env) -> - let typeString = - hoverWithExpandedTypes ~file ~package ~supportsMarkdownLinks typ - in - Some (Protocol.stringifyHover typeString) - | None -> None)))) + let parts = typeString :: docstring in + Some (Protocol.stringifyHover (String.concat "\n\n" parts)) + | None -> None) + | _ -> ( + match CompletionBackEnd.completionsGetTypeEnv completions with + | Some (typ, _env) -> + let typeString = + hoverWithExpandedTypes ~file ~package ~supportsMarkdownLinks typ + in + Some (Protocol.stringifyHover typeString) + | None -> None)) let newHover ~full:{file; package} ~supportsMarkdownLinks locItem = match locItem.locType with diff --git a/analysis/src/Scope.ml b/analysis/src/Scope.ml index abd44a360..5251486f8 100644 --- a/analysis/src/Scope.ml +++ b/analysis/src/Scope.ml @@ -4,7 +4,7 @@ type item = | Module of string * Location.t | Open of string list | Type of string * Location.t - | Value of string * Location.t + | Value of string * Location.t * SharedTypes.Completable.contextPath option type t = item list @@ -16,7 +16,7 @@ let itemToString item = | Field (s, loc) -> "Field " ^ s ^ " " ^ Loc.toString loc | Open sl -> "Open " ^ list sl | Module (s, loc) -> "Module " ^ s ^ " " ^ Loc.toString loc - | Value (s, loc) -> "Value " ^ s ^ " " ^ Loc.toString loc + | Value (s, loc, _) -> "Value " ^ s ^ " " ^ Loc.toString loc | Type (s, loc) -> "Type " ^ s ^ " " ^ Loc.toString loc [@@live] @@ -25,14 +25,23 @@ let addConstructor ~name ~loc x = Constructor (name, loc) :: x let addField ~name ~loc x = Field (name, loc) :: x let addModule ~name ~loc x = Module (name, loc) :: x let addOpen ~lid x = Open (Utils.flattenLongIdent lid @ ["place holder"]) :: x -let addValue ~name ~loc x = Value (name, loc) :: x +let addValue ~name ~loc ?contextPath x = + let showDebug = !Cfg.debugFollowCtxPath in + (if showDebug then + match contextPath with + | None -> Printf.printf "adding value '%s', no ctxPath\n" name + | Some contextPath -> + if showDebug then + Printf.printf "adding value '%s' with ctxPath: %s\n" name + (SharedTypes.Completable.contextPathToString contextPath)); + Value (name, loc, contextPath) :: x let addType ~name ~loc x = Type (name, loc) :: x let iterValuesBeforeFirstOpen f x = let rec loop items = match items with - | Value (s, loc) :: rest -> - f s loc; + | Value (s, loc, contextPath) :: rest -> + f s loc contextPath; loop rest | Open _ :: _ -> () | _ :: rest -> loop rest @@ -43,8 +52,8 @@ let iterValuesBeforeFirstOpen f x = let iterValuesAfterFirstOpen f x = let rec loop foundOpen items = match items with - | Value (s, loc) :: rest -> - if foundOpen then f s loc; + | Value (s, loc, contextPath) :: rest -> + if foundOpen then f s loc contextPath; loop foundOpen rest | Open _ :: rest -> loop true rest | _ :: rest -> loop foundOpen rest diff --git a/analysis/src/SharedTypes.ml b/analysis/src/SharedTypes.ml index 524661503..27448c0b8 100644 --- a/analysis/src/SharedTypes.ml +++ b/analysis/src/SharedTypes.ml @@ -266,43 +266,48 @@ module QueryEnv : sig E.g. the env is at A.B.C and the path is D. The result is A.B.C.D if D is inside C. Or A.B.D or A.D or D if it's in one of its parents. *) - val pathFromEnv : t -> path -> path + val pathFromEnv : t -> path -> bool * path + + val toString : t -> string end = struct type t = {file: File.t; exported: Exported.t; pathRev: path; parent: t option} + let toString {file; pathRev} = + file.moduleName :: List.rev pathRev |> String.concat "." + let fromFile (file : File.t) = {file; exported = file.structure.exported; pathRev = []; parent = None} (* Prune a path and find a parent environment that contains the module name *) let rec prunePath pathRev env name = - if Exported.find env.exported Module name <> None then pathRev + if Exported.find env.exported Module name <> None then (true, pathRev) else match (pathRev, env.parent) with | _ :: rest, Some env -> prunePath rest env name - | _ -> [] + | _ -> (false, []) let pathFromEnv env path = match path with - | [] -> env.pathRev |> List.rev + | [] -> (true, env.pathRev |> List.rev) | name :: _ -> - let prunedPathRev = prunePath env.pathRev env name in - List.rev_append prunedPathRev path + let found, prunedPathRev = prunePath env.pathRev env name in + (found, List.rev_append prunedPathRev path) let enterStructure env (structure : Module.structure) = let name = structure.name in - let pathRev = name :: prunePath env.pathRev env name in + let pathRev = name :: snd (prunePath env.pathRev env name) in {env with exported = structure.exported; pathRev; parent = Some env} end type polyVariantConstructor = {name: string; args: Types.type_expr list} -(** An type that can be used to drive completion *) -type completionType = +type innerType = TypeExpr of Types.type_expr | ExtractedType of completionType +and completionType = | Tuple of QueryEnv.t * Types.type_expr list * Types.type_expr - | Toption of QueryEnv.t * completionType | Texn of QueryEnv.t + | Toption of QueryEnv.t * innerType | Tbool of QueryEnv.t - | Tarray of QueryEnv.t * completionType + | Tarray of QueryEnv.t * innerType | Tstring of QueryEnv.t | Tvariant of { env: QueryEnv.t; @@ -327,77 +332,6 @@ type completionType = | TinlineRecord of {env: QueryEnv.t; fields: field list} | Tfunction of {env: QueryEnv.t; args: typedFnArg list; typ: Types.type_expr} -module Completion = struct - type kind = - | Module of Module.t - | Value of Types.type_expr - | ObjLabel of Types.type_expr - | Label of string - | Type of Type.t - | Constructor of Constructor.t * string - | PolyvariantConstructor of polyVariantConstructor * string - | Field of field * string - | FileModule of string - | Snippet of string - | ExtractedType of completionType * [`Value | `Type] - - type t = { - name: string; - sortText: string option; - insertText: string option; - filterText: string option; - insertTextFormat: Protocol.insertTextFormat option; - env: QueryEnv.t; - deprecated: string option; - docstring: string list; - kind: kind; - detail: string option; - } - - let create ~kind ~env ?(docstring = []) ?insertText ?deprecated ?detail name = - { - name; - env; - deprecated; - docstring; - kind; - sortText = None; - insertText; - insertTextFormat = None; - filterText = None; - detail; - } - - let createWithSnippet ~name ?insertText ~kind ~env ?sortText ?deprecated - ?(docstring = []) () = - { - name; - env; - deprecated; - docstring; - kind; - sortText; - insertText; - insertTextFormat = Some Protocol.Snippet; - filterText = None; - detail = None; - } - - (* https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_completion *) - (* https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#completionItemKind *) - let kindToInt kind = - match kind with - | Module _ -> 9 - | FileModule _ -> 9 - | Constructor (_, _) | PolyvariantConstructor (_, _) -> 4 - | ObjLabel _ -> 4 - | Label _ -> 4 - | Field (_, _) -> 5 - | Type _ | ExtractedType (_, `Type) -> 22 - | Value _ | ExtractedType (_, `Value) -> 12 - | Snippet _ -> 15 -end - module Env = struct type t = {stamps: Stamps.t; modulePath: ModulePath.t} let addExportedModule ~name ~isType env = @@ -591,11 +525,35 @@ module Completable = struct | Labelled of string | Optional of string + (** Additional context for nested completion where needed. *) + type nestedContext = RecordField of {seenFields: string list} + + type nestedPath = + | NTupleItem of {itemNum: int} + | NFollowRecordField of {fieldName: string} + | NRecordBody of {seenFields: string list} + | NVariantPayload of {constructorName: string; itemNum: int} + | NPolyvariantPayload of {constructorName: string; itemNum: int} + | NArray + + let nestedPathToString p = + match p with + | NTupleItem {itemNum} -> "tuple($" ^ string_of_int itemNum ^ ")" + | NFollowRecordField {fieldName} -> "recordField(" ^ fieldName ^ ")" + | NRecordBody _ -> "recordBody" + | NVariantPayload {constructorName; itemNum} -> + "variantPayload::" ^ constructorName ^ "($" ^ string_of_int itemNum ^ ")" + | NPolyvariantPayload {constructorName; itemNum} -> + "polyvariantPayload::" ^ constructorName ^ "($" ^ string_of_int itemNum + ^ ")" + | NArray -> "array" + type contextPath = | CPString | CPArray of contextPath option | CPInt | CPFloat + | CPBool | CPOption of contextPath | CPApply of contextPath * Asttypes.arg_label list | CPId of string list * completionContext @@ -614,29 +572,7 @@ module Completable = struct argumentLabel: argumentLabel; } | CJsxPropValue of {pathToComponent: string list; propName: string} - - (** Additional context for nested completion where needed. *) - type nestedContext = RecordField of {seenFields: string list} - - type nestedPath = - | NTupleItem of {itemNum: int} - | NFollowRecordField of {fieldName: string} - | NRecordBody of {seenFields: string list} - | NVariantPayload of {constructorName: string; itemNum: int} - | NPolyvariantPayload of {constructorName: string; itemNum: int} - | NArray - - let nestedPathToString p = - match p with - | NTupleItem {itemNum} -> "tuple($" ^ string_of_int itemNum ^ ")" - | NFollowRecordField {fieldName} -> "recordField(" ^ fieldName ^ ")" - | NRecordBody _ -> "recordBody" - | NVariantPayload {constructorName; itemNum} -> - "variantPayload::" ^ constructorName ^ "($" ^ string_of_int itemNum ^ ")" - | NPolyvariantPayload {constructorName; itemNum} -> - "polyvariantPayload::" ^ constructorName ^ "($" ^ string_of_int itemNum - ^ ")" - | NArray -> "array" + | CPatternPath of {rootCtxPath: contextPath; nested: nestedPath list} type patternMode = Default | Destructuring @@ -663,56 +599,61 @@ module Completable = struct | CexhaustiveSwitch of {contextPath: contextPath; exprLoc: Location.t} | ChtmlElement of {prefix: string} - let toString = - let completionContextToString = function - | Value -> "Value" - | Type -> "Type" - | Module -> "Module" - | Field -> "Field" - in - let rec contextPathToString = function - | CPString -> "string" - | CPInt -> "int" - | CPFloat -> "float" - | CPOption ctxPath -> "option<" ^ contextPathToString ctxPath ^ ">" - | CPApply (cp, labels) -> - contextPathToString cp ^ "(" - ^ (labels - |> List.map (function - | Asttypes.Nolabel -> "Nolabel" - | Labelled s -> "~" ^ s - | Optional s -> "?" ^ s) - |> String.concat ", ") - ^ ")" - | CPArray (Some ctxPath) -> "array<" ^ contextPathToString ctxPath ^ ">" - | CPArray None -> "array" - | CPId (sl, completionContext) -> - completionContextToString completionContext ^ list sl - | CPField (cp, s) -> contextPathToString cp ^ "." ^ str s - | CPObj (cp, s) -> contextPathToString cp ^ "[\"" ^ s ^ "\"]" - | CPPipe {contextPath; id; inJsx} -> - contextPathToString contextPath - ^ "->" ^ id - ^ if inJsx then " <>" else "" - | CTuple ctxPaths -> - "CTuple(" - ^ (ctxPaths |> List.map contextPathToString |> String.concat ", ") - ^ ")" - | CArgument {functionContextPath; argumentLabel} -> - "CArgument " - ^ contextPathToString functionContextPath - ^ "(" - ^ (match argumentLabel with - | Unlabelled {argumentPosition} -> - "$" ^ string_of_int argumentPosition - | Labelled name -> "~" ^ name - | Optional name -> "~" ^ name ^ "=?") - ^ ")" - | CJsxPropValue {pathToComponent; propName} -> - "CJsxPropValue " ^ (pathToComponent |> list) ^ " " ^ propName - in - - function + let completionContextToString = function + | Value -> "Value" + | Type -> "Type" + | Module -> "Module" + | Field -> "Field" + + let rec contextPathToString = function + | CPString -> "string" + | CPInt -> "int" + | CPFloat -> "float" + | CPBool -> "bool" + | CPOption ctxPath -> "option<" ^ contextPathToString ctxPath ^ ">" + | CPApply (cp, labels) -> + contextPathToString cp ^ "(" + ^ (labels + |> List.map (function + | Asttypes.Nolabel -> "Nolabel" + | Labelled s -> "~" ^ s + | Optional s -> "?" ^ s) + |> String.concat ", ") + ^ ")" + | CPArray (Some ctxPath) -> "array<" ^ contextPathToString ctxPath ^ ">" + | CPArray None -> "array" + | CPId (sl, completionContext) -> + completionContextToString completionContext ^ list sl + | CPField (cp, s) -> contextPathToString cp ^ "." ^ str s + | CPObj (cp, s) -> contextPathToString cp ^ "[\"" ^ s ^ "\"]" + | CPPipe {contextPath; id; inJsx} -> + contextPathToString contextPath + ^ "->" ^ id + ^ if inJsx then " <>" else "" + | CTuple ctxPaths -> + "CTuple(" + ^ (ctxPaths |> List.map contextPathToString |> String.concat ", ") + ^ ")" + | CArgument {functionContextPath; argumentLabel} -> + "CArgument " + ^ contextPathToString functionContextPath + ^ "(" + ^ (match argumentLabel with + | Unlabelled {argumentPosition} -> "$" ^ string_of_int argumentPosition + | Labelled name -> "~" ^ name + | Optional name -> "~" ^ name ^ "=?") + ^ ")" + | CJsxPropValue {pathToComponent; propName} -> + "CJsxPropValue " ^ (pathToComponent |> list) ^ " " ^ propName + | CPatternPath {rootCtxPath; nested} -> + "CPatternPath(" + ^ contextPathToString rootCtxPath + ^ ")" ^ "->" + ^ (nested + |> List.map (fun nestedPath -> nestedPathToString nestedPath) + |> String.concat "->") + + let toString = function | Cpath cp -> "Cpath " ^ contextPathToString cp | Cdecorator s -> "Cdecorator(" ^ str s ^ ")" | CnamedArg (cp, s, sl2) -> @@ -751,6 +692,85 @@ module Completable = struct | ChtmlElement {prefix} -> "ChtmlElement <" ^ prefix end +module Completion = struct + type kind = + | Module of Module.t + | Value of Types.type_expr + | ObjLabel of Types.type_expr + | Label of string + | Type of Type.t + | Constructor of Constructor.t * string + | PolyvariantConstructor of polyVariantConstructor * string + | Field of field * string + | FileModule of string + | Snippet of string + | ExtractedType of completionType * [`Value | `Type] + | FollowContextPath of Completable.contextPath + + type t = { + name: string; + sortText: string option; + insertText: string option; + filterText: string option; + insertTextFormat: Protocol.insertTextFormat option; + env: QueryEnv.t; + deprecated: string option; + docstring: string list; + kind: kind; + detail: string option; + } + + let create ~kind ~env ?(docstring = []) ?filterText ?detail ?deprecated + ?insertText name = + { + name; + env; + deprecated; + docstring; + kind; + sortText = None; + insertText; + insertTextFormat = None; + filterText; + detail; + } + + let createWithSnippet ~name ?insertText ~kind ~env ?sortText ?deprecated + ?filterText ?detail ?(docstring = []) () = + { + name; + env; + deprecated; + docstring; + kind; + sortText; + insertText; + insertTextFormat = Some Protocol.Snippet; + filterText; + detail; + } + + (* https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_completion *) + (* https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#completionItemKind *) + let kindToInt kind = + match kind with + | Module _ -> 9 + | FileModule _ -> 9 + | Constructor (_, _) | PolyvariantConstructor (_, _) -> 4 + | ObjLabel _ -> 4 + | Label _ -> 4 + | Field (_, _) -> 5 + | Type _ | ExtractedType (_, `Type) -> 22 + | Value _ | ExtractedType (_, `Value) -> 12 + | Snippet _ | FollowContextPath _ -> 15 +end + +let kindFromInnerType (t : innerType) = + match t with + | ExtractedType extractedType -> + Completion.ExtractedType (extractedType, `Value) + | TypeExpr typ -> Value typ + module CursorPosition = struct type t = NoCursor | HasCursor | EmptyLoc diff --git a/analysis/src/TypeUtils.ml b/analysis/src/TypeUtils.ml index 95de5fb55..4911e4abb 100644 --- a/analysis/src/TypeUtils.ml +++ b/analysis/src/TypeUtils.ml @@ -112,11 +112,9 @@ let rec extractType ~env ~package (t : Types.type_expr) = match t.desc with | Tlink t1 | Tsubst t1 | Tpoly (t1, []) -> extractType ~env ~package t1 | Tconstr (Path.Pident {name = "option"}, [payloadTypeExpr], _) -> - payloadTypeExpr |> extractType ~env ~package - |> Option.map (fun payloadTyp -> Toption (env, payloadTyp)) + Some (Toption (env, TypeExpr payloadTypeExpr)) | Tconstr (Path.Pident {name = "array"}, [payloadTypeExpr], _) -> - payloadTypeExpr |> extractType ~env ~package - |> Option.map (fun payloadTyp -> Tarray (env, payloadTyp)) + Some (Tarray (env, TypeExpr payloadTypeExpr)) | Tconstr (Path.Pident {name = "bool"}, [], _) -> Some (Tbool env) | Tconstr (Path.Pident {name = "string"}, [], _) -> Some (Tstring env) | Tconstr (Path.Pident {name = "exn"}, [], _) -> Some (Texn env) @@ -300,9 +298,14 @@ let rec resolveNested (typ : completionType) ~env ~full ~nested = ( TinlineRecord {fields; env}, env, Some (Completable.RecordField {seenFields}) ) - | NVariantPayload {constructorName = "Some"; itemNum = 0}, Toption (env, typ) - -> + | ( NVariantPayload {constructorName = "Some"; itemNum = 0}, + Toption (env, ExtractedType typ) ) -> typ |> resolveNested ~env ~full ~nested + | ( NVariantPayload {constructorName = "Some"; itemNum = 0}, + Toption (env, TypeExpr typ) ) -> + typ + |> extractType ~env ~package:full.package + |> Utils.Option.flatMap (fun t -> t |> resolveNested ~env ~full ~nested) | NVariantPayload {constructorName; itemNum}, Tvariant {env; constructors} -> ( match @@ -337,9 +340,140 @@ let rec resolveNested (typ : completionType) ~env ~full ~nested = |> extractType ~env ~package:full.package |> Utils.Option.flatMap (fun typ -> typ |> resolveNested ~env ~full ~nested))) - | NArray, Tarray (env, typ) -> typ |> resolveNested ~env ~full ~nested + | NArray, Tarray (env, ExtractedType typ) -> + typ |> resolveNested ~env ~full ~nested + | NArray, Tarray (env, TypeExpr typ) -> + typ + |> extractType ~env ~package:full.package + |> Utils.Option.flatMap (fun typ -> + typ |> resolveNested ~env ~full ~nested) | _ -> None) +let findTypeOfRecordField fields ~fieldName = + match + fields |> List.find_opt (fun (field : field) -> field.fname.txt = fieldName) + with + | None -> None + | Some {typ; optional} -> + let typ = if optional then Utils.unwrapIfOption typ else typ in + Some typ + +let findTypeOfConstructorArg constructors ~constructorName ~payloadNum ~env = + match + constructors + |> List.find_opt (fun (c : Constructor.t) -> c.cname.txt = constructorName) + with + | Some {args = Args args} -> ( + match List.nth_opt args payloadNum with + | None -> None + | Some (typ, _) -> Some (TypeExpr typ)) + | Some {args = InlineRecord fields} when payloadNum = 0 -> + Some (ExtractedType (TinlineRecord {env; fields})) + | _ -> None + +let findTypeOfPolyvariantArg constructors ~constructorName ~payloadNum = + match + constructors + |> List.find_opt (fun (c : polyVariantConstructor) -> + c.name = constructorName) + with + | Some {args} -> ( + match List.nth_opt args payloadNum with + | None -> None + | Some typ -> Some typ) + | None -> None + +let rec resolveNestedPatternPath (typ : innerType) ~env ~full ~nested = + let t = + match typ with + | TypeExpr t -> t |> extractType ~env ~package:full.package + | ExtractedType t -> Some t + in + match nested with + | [] -> None + | [finalPatternPath] -> ( + match t with + | None -> None + | Some completionType -> ( + match (finalPatternPath, completionType) with + | ( Completable.NFollowRecordField {fieldName}, + (TinlineRecord {fields} | Trecord {fields}) ) -> ( + match fields |> findTypeOfRecordField ~fieldName with + | None -> None + | Some typ -> Some (TypeExpr typ, env)) + | NTupleItem {itemNum}, Tuple (env, tupleItems, _) -> ( + match List.nth_opt tupleItems itemNum with + | None -> None + | Some typ -> Some (TypeExpr typ, env)) + | NVariantPayload {constructorName; itemNum}, Tvariant {env; constructors} + -> ( + match + constructors + |> findTypeOfConstructorArg ~constructorName ~payloadNum:itemNum ~env + with + | Some typ -> Some (typ, env) + | None -> None) + | ( NPolyvariantPayload {constructorName; itemNum}, + Tpolyvariant {env; constructors} ) -> ( + match + constructors + |> findTypeOfPolyvariantArg ~constructorName ~payloadNum:itemNum + with + | Some typ -> Some (TypeExpr typ, env) + | None -> None) + | ( NVariantPayload {constructorName = "Some"; itemNum = 0}, + Toption (env, typ) ) -> + Some (typ, env) + | NArray, Tarray (env, typ) -> Some (typ, env) + | _ -> None)) + | patternPath :: nested -> ( + match t with + | None -> None + | Some completionType -> ( + match (patternPath, completionType) with + | ( Completable.NFollowRecordField {fieldName}, + (TinlineRecord {env; fields} | Trecord {env; fields}) ) -> ( + match fields |> findTypeOfRecordField ~fieldName with + | None -> None + | Some typ -> + typ + |> extractType ~env ~package:full.package + |> Utils.Option.flatMap (fun typ -> + ExtractedType typ + |> resolveNestedPatternPath ~env ~full ~nested)) + | NTupleItem {itemNum}, Tuple (env, tupleItems, _) -> ( + match List.nth_opt tupleItems itemNum with + | None -> None + | Some typ -> + typ + |> extractType ~env ~package:full.package + |> Utils.Option.flatMap (fun typ -> + ExtractedType typ + |> resolveNestedPatternPath ~env ~full ~nested)) + | NVariantPayload {constructorName; itemNum}, Tvariant {env; constructors} + -> ( + match + constructors + |> findTypeOfConstructorArg ~constructorName ~payloadNum:itemNum ~env + with + | Some typ -> typ |> resolveNestedPatternPath ~env ~full ~nested + | None -> None) + | ( NPolyvariantPayload {constructorName; itemNum}, + Tpolyvariant {env; constructors} ) -> ( + match + constructors + |> findTypeOfPolyvariantArg ~constructorName ~payloadNum:itemNum + with + | Some typ -> + TypeExpr typ |> resolveNestedPatternPath ~env ~full ~nested + | None -> None) + | ( NVariantPayload {constructorName = "Some"; itemNum = 0}, + Toption (env, typ) ) -> + typ |> resolveNestedPatternPath ~env ~full ~nested + | NArray, Tarray (env, typ) -> + typ |> resolveNestedPatternPath ~env ~full ~nested + | _ -> None)) + let getArgs ~env (t : Types.type_expr) ~full = let rec getArgsLoop ~env (t : Types.type_expr) ~full ~currentArgumentPosition = @@ -413,9 +547,13 @@ let rec extractedTypeToString ?(inner = false) = function else Shared.typeToString typ | Tbool _ -> "bool" | Tstring _ -> "string" - | Tarray (_, innerTyp) -> + | Tarray (_, TypeExpr innerTyp) -> + "array<" ^ Shared.typeToString innerTyp ^ ">" + | Tarray (_, ExtractedType innerTyp) -> "array<" ^ extractedTypeToString ~inner:true innerTyp ^ ">" - | Toption (_, innerTyp) -> + | Toption (_, TypeExpr innerTyp) -> + "option<" ^ Shared.typeToString innerTyp ^ ">" + | Toption (_, ExtractedType innerTyp) -> "option<" ^ extractedTypeToString ~inner:true innerTyp ^ ">" | Tvariant {variantDecl; variantName} -> if inner then variantName else Shared.declToString variantName variantDecl @@ -426,5 +564,5 @@ let rec extractedTypeToString ?(inner = false) = function let unwrapCompletionTypeIfOption (t : SharedTypes.completionType) = match t with - | Toption (_, unwrapped) -> unwrapped + | Toption (_, ExtractedType unwrapped) -> unwrapped | _ -> t diff --git a/analysis/tests/src/CompletionInferValues.res b/analysis/tests/src/CompletionInferValues.res new file mode 100644 index 000000000..829c26032 --- /dev/null +++ b/analysis/tests/src/CompletionInferValues.res @@ -0,0 +1,164 @@ +let getBool = () => true +let getInt = () => 123 + +type someRecord = {name: string, age: int} + +let someFnWithCallback = (cb: (~num: int, ~someRecord: someRecord, ~isOn: bool) => unit) => { + let _ = cb +} + +let reactEventFn = (cb: ReactEvent.Mouse.t => unit) => { + let _ = cb +} + +@val external getSomeRecord: unit => someRecord = "getSomeRecord" + +// let x = 123; let aliased = x; aliased->f +// ^com + +// let x = getSomeRecord(); x. +// ^com + +// let x = getSomeRecord(); let aliased = x; aliased. +// ^com + +// someFnWithCallback((~someRecord, ~num, ~isOn) => someRecord.) +// ^com + +// let aliasedFn = someFnWithCallback; aliasedFn((~num, ~someRecord, ~isOn) => someRecord.) +// ^com + +// reactEventFn(event => { event->pr }); +// ^com + +module Div = { + @react.component + let make = (~onMouseEnter: option unit>=?) => { + let _ = onMouseEnter + React.null + } +} + +// let _ =
{ event->pr }} /> +// ^com + +// let _ =
{ event->pr }} /> +// ^com + +// let _ =
{ let btn = event->JsxEvent.Mouse.button; btn->t }} /> +// ^com + +// let _ =
{ let btn = event->JsxEvent.Mouse.button->Belt.Int.toString; btn->spl }} /> +// ^com + +// let _ =
{ let btn = event->JsxEvent.Mouse.button->Belt.Int.toString->Js.String2.split("/"); btn->ma }} /> +// ^com + +// let x: someRecord = {name: "Hello", age: 123}; x. +// ^com + +type someVariant = One | Two | Three(int, string) +type somePolyVariant = [#one | #two | #three(int, string)] +type someNestedRecord = {someRecord: someRecord} + +type someRecordWithNestedStuff = { + things: string, + someInt: int, + srecord: someRecord, + nested: someNestedRecord, + someStuff: bool, +} + +type otherNestedRecord = { + someRecord: someRecord, + someTuple: (someVariant, int, somePolyVariant), + optRecord: option, +} + +// Destructure record +// let x: someRecordWithNestedStuff = Obj.magic(); let {srecord} = x; srecord. +// ^com + +// Follow aliased +// let x: someRecordWithNestedStuff = Obj.magic(); let {nested: aliased} = x; aliased. +// ^com + +// Follow nested record +// let x: someRecordWithNestedStuff = Obj.magic(); let {srecord, nested: {someRecord}} = x; someRecord. +// ^com + +// Destructure string +// let x: someRecordWithNestedStuff = Obj.magic(); let {things} = x; things->slic +// ^com + +// Destructure int +// let x: someRecordWithNestedStuff = Obj.magic(); let {someInt} = x; someInt->toS +// ^com + +// Follow tuples +// let x: otherNestedRecord = Obj.magic(); let {someTuple} = x; let (_, someInt, _) = someTuple; someInt->toS +// ^com + +// Same as above, but follow in switch case +// let x: otherNestedRecord; switch x { | {someTuple} => let (_, someInt, _) = someTuple; someInt->toS } +// ^com + +// Follow variant payloads +// let x: otherNestedRecord; switch x { | {someTuple:(Three(_, str), _, _)} => str->slic } +// ^com + +// Follow polyvariant payloads +// let x: otherNestedRecord; switch x { | {someTuple:(_, _, #three(_, str))} => str->slic } +// ^com + +// Follow options +// let x: otherNestedRecord; switch x { | {optRecord:Some({name})} => name->slic } +// ^com + +// Follow arrays +// let x: array; switch x { | [inner] => inner.s } +// ^com + +// Infer top level return +// let x = 123; switch x { | 123 => () | v => v->toSt } +// ^com + +let fnWithRecordCallback = (cb: someRecord => unit) => { + let _ = cb +} + +// Complete pattern of function parameter +// fnWithRecordCallback(({}) => {()}) +// ^com + +let fn2 = (~cb: CompletionSupport.Nested.config => unit) => { + let _ = cb +} + +// fn2(~cb=({root}) => {root-> }) +// ^com + +type sameFileRecord = {root: CompletionSupport.Test.t, test: int} + +let fn3 = (~cb: sameFileRecord => unit) => { + let _ = cb +} + +// fn3(~cb=({root}) => {root-> }) +// ^com + +// Handles pipe chains as input for switch +// let x = 123; switch x->Belt.Int.toString { | } +// ^com + +// Handles pipe chains as input for switch +// let x = 123; switch x->Belt.Int.toString->Js.String2.split("/") { | } +// ^com + +// Regular completion works +// let renderer = CompletionSupport2.makeRenderer(~prepare=() => "hello",~render=({support}) => {support.},()) +// ^com + +// But pipe completion gets the wrong completion path. Should be `ReactDOM.Client.Root.t`, but ends up being `CompletionSupport2.ReactDOM.Client.Root.t`. +// let renderer = CompletionSupport2.makeRenderer(~prepare=() => "hello",~render=({support:{root}}) => {root->},()) +// ^com diff --git a/analysis/tests/src/CompletionPipeChain.res b/analysis/tests/src/CompletionPipeChain.res index 813bc1a85..b6b177173 100644 --- a/analysis/tests/src/CompletionPipeChain.res +++ b/analysis/tests/src/CompletionPipeChain.res @@ -73,3 +73,22 @@ let notAliased: CompletionSupport.Test.t = {name: 123} // notAliased-> // ^com + +let renderer = CompletionSupport2.makeRenderer( + ~prepare=() => "hello", + ~render=props => { + ignore(props) + + // Doesn't work when tried through this chain. Presumably because it now goes through multiple different files. + // props.support.root->ren + // ^com + let root = props.support.root + ignore(root) + + // Works here though when it's lifted out. Probably because it only goes through one file...? + // root->ren + // ^com + React.null + }, + (), +) diff --git a/analysis/tests/src/CompletionSupport.res b/analysis/tests/src/CompletionSupport.res index a51b88c87..1d93fe878 100644 --- a/analysis/tests/src/CompletionSupport.res +++ b/analysis/tests/src/CompletionSupport.res @@ -22,3 +22,7 @@ module TestComponent = { React.null } } + +module Nested = { + type config = {root: ReactDOM.Client.Root.t} +} diff --git a/analysis/tests/src/CompletionSupport2.res b/analysis/tests/src/CompletionSupport2.res new file mode 100644 index 000000000..925fc5d57 --- /dev/null +++ b/analysis/tests/src/CompletionSupport2.res @@ -0,0 +1,17 @@ +module Internal = { + type prepareProps<'prepared> = { + someName: string, + support: CompletionSupport.Nested.config, + prepared: 'prepared, + } +} + +let makeRenderer = ( + ~prepare: unit => 'prepared, + ~render: Internal.prepareProps<'prepared> => React.element, + (), +) => { + let _ = prepare + let _ = render + "123" +} diff --git a/analysis/tests/src/expected/BrokenParserCases.res.txt b/analysis/tests/src/expected/BrokenParserCases.res.txt index 1c1134ac2..0c558e994 100644 --- a/analysis/tests/src/expected/BrokenParserCases.res.txt +++ b/analysis/tests/src/expected/BrokenParserCases.res.txt @@ -2,19 +2,23 @@ Complete src/BrokenParserCases.res 2:24 posCursor:[2:24] posNoWhite:[2:23] Found expr:[2:11->2:30] Pexp_apply ...[2:11->2:17] (~isOff2:19->2:24=...[2:27->2:29]) Completable: CnamedArg(Value[someFn], isOff, [isOff]) +ContextPath Value[someFn] +Path someFn [] Complete src/BrokenParserCases.res 6:17 -posCursor:[6:17] posNoWhite:[6:16] Found expr:[6:3->6:21] posCursor:[6:17] posNoWhite:[6:16] Found pattern:[6:16->6:19] Completable: Cpattern Value[s]=t +ContextPath Value[s] +Path s [] Complete src/BrokenParserCases.res 10:29 -posCursor:[10:29] posNoWhite:[10:27] Found expr:[10:11->10:41] posCursor:[10:29] posNoWhite:[10:27] Found pattern:[10:24->10:39] posCursor:[10:29] posNoWhite:[10:27] Found pattern:[10:24->10:28] Ppat_construct None:[10:24->10:28] Completable: Cpath Value[None] +ContextPath Value[None] +Path None [] diff --git a/analysis/tests/src/expected/CompletePrioritize1.res.txt b/analysis/tests/src/expected/CompletePrioritize1.res.txt index 3f5485410..f011ba5c9 100644 --- a/analysis/tests/src/expected/CompletePrioritize1.res.txt +++ b/analysis/tests/src/expected/CompletePrioritize1.res.txt @@ -1,6 +1,13 @@ Complete src/CompletePrioritize1.res 5:6 posCursor:[5:6] posNoWhite:[5:5] Found expr:[5:3->0:-1] Completable: Cpath Value[a]-> +ContextPath Value[a]-> +ContextPath Value[a] +Path a +CPPipe env:CompletePrioritize1 +CPPipe type path:Test.t +CPPipe pathFromEnv:Test found:true +Path Test. [{ "label": "Test.add", "kind": 12, diff --git a/analysis/tests/src/expected/CompletePrioritize2.res.txt b/analysis/tests/src/expected/CompletePrioritize2.res.txt index b3b9674e1..6831be426 100644 --- a/analysis/tests/src/expected/CompletePrioritize2.res.txt +++ b/analysis/tests/src/expected/CompletePrioritize2.res.txt @@ -1,6 +1,13 @@ Complete src/CompletePrioritize2.res 9:7 posCursor:[9:7] posNoWhite:[9:6] Found expr:[9:3->0:-1] Completable: Cpath Value[ax]-> +ContextPath Value[ax]-> +ContextPath Value[ax] +Path ax +CPPipe env:CompletePrioritize2 +CPPipe type path:Test.t +CPPipe pathFromEnv:Test found:true +Path Test. [{ "label": "Test.add", "kind": 12, @@ -13,6 +20,8 @@ Complete src/CompletePrioritize2.res 12:5 posCursor:[12:5] posNoWhite:[12:4] Found expr:[12:3->12:5] Pexp_ident ax:[12:3->12:5] Completable: Cpath Value[ax] +ContextPath Value[ax] +Path ax [{ "label": "ax", "kind": 12, diff --git a/analysis/tests/src/expected/Completion.res.txt b/analysis/tests/src/expected/Completion.res.txt index c98e1a2c8..409d7b7b8 100644 --- a/analysis/tests/src/expected/Completion.res.txt +++ b/analysis/tests/src/expected/Completion.res.txt @@ -2,6 +2,8 @@ Complete src/Completion.res 1:11 posCursor:[1:11] posNoWhite:[1:10] Found expr:[1:3->1:11] Pexp_ident MyList.m:[1:3->1:11] Completable: Cpath Value[MyList, m] +ContextPath Value[MyList, m] +Path MyList.m [{ "label": "mapReverse", "kind": 12, @@ -74,6 +76,8 @@ Complete src/Completion.res 3:9 posCursor:[3:9] posNoWhite:[3:8] Found expr:[3:3->3:9] Pexp_ident Array.:[3:3->3:9] Completable: Cpath Value[Array, ""] +ContextPath Value[Array, ""] +Path Array. [{ "label": "fold_left", "kind": 12, @@ -296,6 +300,8 @@ Complete src/Completion.res 5:10 posCursor:[5:10] posNoWhite:[5:9] Found expr:[5:3->5:10] Pexp_ident Array.m:[5:3->5:10] Completable: Cpath Value[Array, m] +ContextPath Value[Array, m] +Path Array.m [{ "label": "mapi", "kind": 12, @@ -350,6 +356,8 @@ Complete src/Completion.res 15:17 posCursor:[15:17] posNoWhite:[15:16] Found expr:[15:12->15:17] Pexp_ident Dep.c:[15:12->15:17] Completable: Cpath Value[Dep, c] +ContextPath Value[Dep, c] +Path Dep.c [{ "label": "customDouble", "kind": 12, @@ -362,6 +370,8 @@ Complete src/Completion.res 23:20 posCursor:[23:20] posNoWhite:[23:19] Found expr:[23:11->23:20] Pexp_apply ...[23:11->23:18] () Completable: CnamedArg(Value[Lib, foo], "", []) +ContextPath Value[Lib, foo] +Path Lib.foo Found type for function (~age: int, ~name: string) => string [{ "label": "age", @@ -380,6 +390,10 @@ Found type for function (~age: int, ~name: string) => string Complete src/Completion.res 26:13 posCursor:[26:13] posNoWhite:[26:12] Found expr:[26:3->26:13] Completable: Cpath array->m +ContextPath array->m +ContextPath array +CPPipe env:Completion +Path Js.Array2.m [{ "label": "Js.Array2.mapi", "kind": 12, @@ -397,6 +411,10 @@ Completable: Cpath array->m Complete src/Completion.res 29:13 posCursor:[29:13] posNoWhite:[29:12] Found expr:[29:3->29:13] Completable: Cpath string->toU +ContextPath string->toU +ContextPath string +CPPipe env:Completion +Path Js.String2.toU [{ "label": "Js.String2.toUpperCase", "kind": 12, @@ -408,6 +426,11 @@ Completable: Cpath string->toU Complete src/Completion.res 34:8 posCursor:[34:8] posNoWhite:[34:7] Found expr:[34:3->34:8] Completable: Cpath Value[op]->e +ContextPath Value[op]->e +ContextPath Value[op] +Path op +CPPipe env:Completion +Path Belt.Option.e [{ "label": "Belt.Option.eqU", "kind": 12, @@ -427,6 +450,13 @@ posCursor:[44:7] posNoWhite:[44:6] Found expr:[44:3->54:3] Pexp_apply ...[50:9->50:10] (...[44:3->50:8], ...[51:2->54:3]) posCursor:[44:7] posNoWhite:[44:6] Found expr:[44:3->50:8] Completable: Cpath Value[fa]-> +ContextPath Value[fa]-> +ContextPath Value[fa] +Path fa +CPPipe env:Completion +CPPipe type path:ForAuto.t +CPPipe pathFromEnv:ForAuto found:true +Path ForAuto. [{ "label": "ForAuto.abc", "kind": 12, @@ -446,6 +476,8 @@ posCursor:[47:21] posNoWhite:[47:20] Found expr:[47:3->47:21] posCursor:[47:21] posNoWhite:[47:20] Found expr:[47:12->47:21] Pexp_ident Js.Dict.u:[47:12->47:21] Completable: Cpath Value[Js, Dict, u] +ContextPath Value[Js, Dict, u] +Path Js.Dict.u [{ "label": "unsafeGet", "kind": 12, @@ -464,6 +496,8 @@ Complete src/Completion.res 59:30 posCursor:[59:30] posNoWhite:[59:29] Found expr:[59:15->59:30] JSX 59:21] second[59:22->59:28]=...[59:29->59:30]> _children:None Completable: Cexpression CJsxPropValue [O, Comp] second=z +ContextPath CJsxPropValue [O, Comp] second +Path O.Comp.make [{ "label": "zzz", "kind": 12, @@ -476,6 +510,7 @@ Complete src/Completion.res 62:23 posCursor:[62:23] posNoWhite:[62:22] Found expr:[62:15->62:23] JSX 62:21] z[62:22->62:23]=...[62:22->62:23]> _children:None Completable: Cjsx([O, Comp], z, [z]) +Path O.Comp.make [{ "label": "zoo", "kind": 4, @@ -512,6 +547,8 @@ Complete src/Completion.res 71:27 posCursor:[71:27] posNoWhite:[71:26] Found expr:[71:11->71:27] Pexp_apply ...[71:11->71:18] (~name71:20->71:24=...[71:20->71:24]) Completable: CnamedArg(Value[Lib, foo], "", [name]) +ContextPath Value[Lib, foo] +Path Lib.foo Found type for function (~age: int, ~name: string) => string [{ "label": "age", @@ -525,6 +562,8 @@ Complete src/Completion.res 74:26 posCursor:[74:26] posNoWhite:[74:25] Found expr:[74:11->74:26] Pexp_apply ...[74:11->74:18] (~age74:20->74:23=...[74:20->74:23]) Completable: CnamedArg(Value[Lib, foo], "", [age]) +ContextPath Value[Lib, foo] +Path Lib.foo Found type for function (~age: int, ~name: string) => string [{ "label": "name", @@ -538,6 +577,8 @@ Complete src/Completion.res 77:32 posCursor:[77:32] posNoWhite:[77:31] Found expr:[77:11->77:32] Pexp_apply ...[77:11->77:18] (~age77:20->77:23=...[77:25->77:28]) Completable: CnamedArg(Value[Lib, foo], "", [age]) +ContextPath Value[Lib, foo] +Path Lib.foo Found type for function (~age: int, ~name: string) => string [{ "label": "name", @@ -551,6 +592,8 @@ Complete src/Completion.res 82:5 posCursor:[82:5] posNoWhite:[82:4] Found expr:[80:8->86:1] Pexp_apply ...[80:8->80:15] (~age84:3->84:6=...[84:7->84:8], ~name85:3->85:7=...[85:8->85:10]) Completable: CnamedArg(Value[Lib, foo], "", [age, name]) +ContextPath Value[Lib, foo] +Path Lib.foo Found type for function (~age: int, ~name: string) => string [] @@ -558,6 +601,9 @@ Complete src/Completion.res 90:13 posCursor:[90:13] posNoWhite:[90:12] Found expr:[90:3->93:18] Pexp_send a[90:12->90:13] e:[90:3->90:10] Completable: Cpath Value[someObj]["a"] +ContextPath Value[someObj]["a"] +ContextPath Value[someObj] +Path someObj [{ "label": "age", "kind": 4, @@ -570,6 +616,11 @@ Complete src/Completion.res 95:24 posCursor:[95:24] posNoWhite:[95:23] Found expr:[95:3->99:6] Pexp_send [95:24->95:24] e:[95:3->95:22] Completable: Cpath Value[nestedObj]["x"]["y"][""] +ContextPath Value[nestedObj]["x"]["y"][""] +ContextPath Value[nestedObj]["x"]["y"] +ContextPath Value[nestedObj]["x"] +ContextPath Value[nestedObj] +Path nestedObj [{ "label": "age", "kind": 4, @@ -588,6 +639,9 @@ Complete src/Completion.res 99:7 posCursor:[99:7] posNoWhite:[99:6] Found expr:[99:3->102:20] Pexp_send a[99:6->99:7] e:[99:3->99:4] Completable: Cpath Value[o]["a"] +ContextPath Value[o]["a"] +ContextPath Value[o] +Path o [{ "label": "age", "kind": 4, @@ -600,6 +654,11 @@ Complete src/Completion.res 104:17 posCursor:[104:17] posNoWhite:[104:16] Found expr:[104:3->125:18] Pexp_send [104:17->104:17] e:[104:3->104:15] Completable: Cpath Value[no]["x"]["y"][""] +ContextPath Value[no]["x"]["y"][""] +ContextPath Value[no]["x"]["y"] +ContextPath Value[no]["x"] +ContextPath Value[no] +Path no [{ "label": "name", "kind": 4, @@ -618,6 +677,9 @@ Complete src/Completion.res 110:5 posCursor:[110:5] posNoWhite:[110:4] Found expr:[110:3->110:5] Pexp_field [110:3->110:4] _:[116:0->110:5] Completable: Cpath Value[r]."" +ContextPath Value[r]."" +ContextPath Value[r] +Path r [{ "label": "x", "kind": 5, @@ -636,6 +698,9 @@ Complete src/Completion.res 113:24 posCursor:[113:24] posNoWhite:[113:23] Found expr:[113:3->113:24] Pexp_field [113:3->113:23] _:[116:0->113:24] Completable: Cpath Value[Object, Rec, recordVal]."" +ContextPath Value[Object, Rec, recordVal]."" +ContextPath Value[Object, Rec, recordVal] +Path Object.Rec.recordVal [{ "label": "xx", "kind": 5, @@ -656,6 +721,8 @@ posCursor:[120:7] posNoWhite:[120:6] Found expr:[120:5->122:5] posCursor:[120:7] posNoWhite:[120:6] Found expr:[120:5->120:7] Pexp_ident my:[120:5->120:7] Completable: Cpath Value[my] +ContextPath Value[my] +Path my [{ "label": "myAmazingFunction", "kind": 12, @@ -668,6 +735,9 @@ Complete src/Completion.res 125:18 posCursor:[125:18] posNoWhite:[125:17] Found expr:[125:3->145:32] Pexp_send [125:18->125:18] e:[125:3->125:16] Completable: Cpath Value[Object, object][""] +ContextPath Value[Object, object][""] +ContextPath Value[Object, object] +Path Object.object [{ "label": "name", "kind": 4, @@ -686,6 +756,8 @@ Complete src/Completion.res 151:6 posCursor:[151:6] posNoWhite:[151:5] Found expr:[151:4->151:6] JSX 151:6] > _children:None Completable: Cpath Module[O, ""] +ContextPath Module[O, ""] +Path O. [{ "label": "Comp", "kind": 9, @@ -698,6 +770,10 @@ Complete src/Completion.res 157:8 posCursor:[157:8] posNoWhite:[157:7] Found expr:[157:3->157:8] Pexp_field [157:3->157:7] _:[165:0->157:8] Completable: Cpath Value[q].aa."" +ContextPath Value[q].aa."" +ContextPath Value[q].aa +ContextPath Value[q] +Path q [{ "label": "x", "kind": 5, @@ -716,6 +792,10 @@ Complete src/Completion.res 159:9 posCursor:[159:9] posNoWhite:[159:8] Found expr:[159:3->159:9] Pexp_field [159:3->159:7] n:[159:8->159:9] Completable: Cpath Value[q].aa.n +ContextPath Value[q].aa.n +ContextPath Value[q].aa +ContextPath Value[q] +Path q [{ "label": "name", "kind": 5, @@ -728,6 +808,8 @@ Complete src/Completion.res 162:6 posCursor:[162:6] posNoWhite:[162:5] Found expr:[162:3->162:6] Pexp_construct Lis:[162:3->162:6] None Completable: Cpath Value[Lis] +ContextPath Value[Lis] +Path Lis [{ "label": "List", "kind": 9, @@ -746,6 +828,8 @@ Complete src/Completion.res 169:16 posCursor:[169:16] posNoWhite:[169:15] Found expr:[169:4->169:16] JSX 169:16] > _children:None Completable: Cpath Module[WithChildren] +ContextPath Module[WithChildren] +Path WithChildren [{ "label": "WithChildren", "kind": 9, @@ -758,6 +842,8 @@ Complete src/Completion.res 172:16 posCursor:[172:16] posNoWhite:[172:15] Found type:[172:12->172:16] Ptyp_constr Js.n:[172:12->172:16] Completable: Cpath Type[Js, n] +ContextPath Type[Js, n] +Path Js.n [{ "label": "null_undefined", "kind": 22, @@ -782,6 +868,8 @@ Complete src/Completion.res 174:20 posCursor:[174:20] posNoWhite:[174:19] Found type:[174:12->174:20] Ptyp_constr ForAuto.:[174:12->174:20] Completable: Cpath Type[ForAuto, ""] +ContextPath Type[ForAuto, ""] +Path ForAuto. [{ "label": "t", "kind": 22, @@ -794,6 +882,8 @@ Complete src/Completion.res 179:13 posCursor:[179:13] posNoWhite:[179:12] Found expr:[179:11->179:13] Pexp_construct As:[179:11->179:13] None Completable: Cpath Value[As] +ContextPath Value[As] +Path As [{ "label": "Asterix", "kind": 4, @@ -805,6 +895,8 @@ Completable: Cpath Value[As] Complete src/Completion.res 182:17 Pmod_ident For:[182:14->182:17] Completable: Cpath Module[For] +ContextPath Module[For] +Path For [{ "label": "ForAuto", "kind": 9, @@ -817,6 +909,8 @@ Complete src/Completion.res 190:11 posCursor:[190:11] posNoWhite:[190:10] Found expr:[190:3->190:11] Pexp_ident Private.:[190:3->190:11] Completable: Cpath Value[Private, ""] +ContextPath Value[Private, ""] +Path Private. [{ "label": "b", "kind": 12, @@ -829,6 +923,8 @@ Complete src/Completion.res 202:6 posCursor:[202:6] posNoWhite:[202:5] Found expr:[202:3->202:6] Pexp_ident sha:[202:3->202:6] Completable: Cpath Value[sha] +ContextPath Value[sha] +Path sha [] Complete src/Completion.res 205:6 @@ -837,6 +933,8 @@ Pexp_ident sha:[205:3->205:6] Completable: Cpath Value[sha] Raw opens: 1 Shadow.A.place holder Resolved opens 1 Completion.res +ContextPath Value[sha] +Path sha [{ "label": "shadowed", "kind": 12, @@ -851,6 +949,8 @@ Pexp_ident sha:[208:3->208:6] Completable: Cpath Value[sha] Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder Resolved opens 2 Completion.res Completion.res +ContextPath Value[sha] +Path sha [{ "label": "shadowed", "kind": 12, @@ -865,6 +965,9 @@ Pexp_send [221:22->221:22] e:[221:3->221:20] Completable: Cpath Value[FAO, forAutoObject][""] Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder Resolved opens 2 Completion.res Completion.res +ContextPath Value[FAO, forAutoObject][""] +ContextPath Value[FAO, forAutoObject] +Path FAO.forAutoObject [{ "label": "age", "kind": 4, @@ -885,6 +988,10 @@ Pexp_field [224:3->224:36] _:[233:0->224:37] Completable: Cpath Value[FAO, forAutoObject]["forAutoLabel"]."" Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder Resolved opens 2 Completion.res Completion.res +ContextPath Value[FAO, forAutoObject]["forAutoLabel"]."" +ContextPath Value[FAO, forAutoObject]["forAutoLabel"] +ContextPath Value[FAO, forAutoObject] +Path FAO.forAutoObject [{ "label": "forAuto", "kind": 5, @@ -904,6 +1011,15 @@ posCursor:[227:46] posNoWhite:[227:45] Found expr:[227:3->0:-1] Completable: Cpath Value[FAO, forAutoObject]["forAutoLabel"].forAuto-> Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder Resolved opens 2 Completion.res Completion.res +ContextPath Value[FAO, forAutoObject]["forAutoLabel"].forAuto-> +ContextPath Value[FAO, forAutoObject]["forAutoLabel"].forAuto +ContextPath Value[FAO, forAutoObject]["forAutoLabel"] +ContextPath Value[FAO, forAutoObject] +Path FAO.forAutoObject +CPPipe env:Completion envFromCompletionItem:Completion.FAR +CPPipe type path:ForAuto.t +CPPipe pathFromEnv:ForAuto found:false +Path ForAuto. [{ "label": "ForAuto.abc", "kind": 12, @@ -925,6 +1041,8 @@ Pexp_ident ForAuto.a:[230:46->230:55] Completable: Cpath Value[ForAuto, a] Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder Resolved opens 2 Completion.res Completion.res +ContextPath Value[ForAuto, a] +Path ForAuto.a [{ "label": "abc", "kind": 12, @@ -949,6 +1067,8 @@ Pexp_ident na:[234:32->234:34] Completable: Cpath Value[na] Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder Resolved opens 2 Completion.res Completion.res +ContextPath Value[na] +Path na [{ "label": "name", "kind": 12, @@ -965,7 +1085,6 @@ Resolved opens 2 Completion.res Completion.res [] Complete src/Completion.res 243:8 -posCursor:[243:8] posNoWhite:[243:7] Found expr:[241:8->246:1] posCursor:[243:8] posNoWhite:[243:7] Found expr:[242:14->243:8] Pexp_apply ...[243:3->243:4] (...[242:14->242:15], ...[243:5->243:8]) posCursor:[243:8] posNoWhite:[243:7] Found expr:[243:5->243:8] @@ -973,6 +1092,9 @@ Pexp_field [243:5->243:7] _:[245:0->243:8] Completable: Cpath Value[_z]."" Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder Resolved opens 2 Completion.res Completion.res +ContextPath Value[_z]."" +ContextPath Value[_z] +Path _z [{ "label": "x", "kind": 5, @@ -993,6 +1115,8 @@ Pexp_construct SomeLo:[254:11->254:17] None Completable: Cpath Value[SomeLo] Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder Resolved opens 2 Completion.res Completion.res +ContextPath Value[SomeLo] +Path SomeLo [{ "label": "SomeLocalModule", "kind": 9, @@ -1007,6 +1131,8 @@ Ptyp_constr SomeLocalModule.:[256:13->256:29] Completable: Cpath Type[SomeLocalModule, ""] Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder Resolved opens 2 Completion.res Completion.res +ContextPath Type[SomeLocalModule, ""] +Path SomeLocalModule. [{ "label": "zz", "kind": 22, @@ -1021,6 +1147,8 @@ Ptyp_constr SomeLocalModule.:[261:17->263:11] Completable: Cpath Type[SomeLocalModule, ""] Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder Resolved opens 2 Completion.res Completion.res +ContextPath Type[SomeLocalModule, ""] +Path SomeLocalModule. [{ "label": "zz", "kind": 22, @@ -1034,6 +1162,8 @@ Ptype_variant unary SomeLocal:[268:12->268:21] Completable: Cpath Value[SomeLocal] Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder Resolved opens 2 Completion.res Completion.res +ContextPath Value[SomeLocal] +Path SomeLocal [{ "label": "SomeLocalVariantItem", "kind": 4, @@ -1055,6 +1185,8 @@ Ptyp_constr SomeLocal:[271:11->274:3] Completable: Cpath Type[SomeLocal] Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder Resolved opens 2 Completion.res Completion.res +ContextPath Type[SomeLocal] +Path SomeLocal [{ "label": "SomeLocalModule", "kind": 9, @@ -1071,6 +1203,8 @@ Pexp_ident _w:[275:13->275:15] Completable: Cpath Value[_w] Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder Resolved opens 2 Completion.res Completion.res +ContextPath Value[_w] +Path _w [{ "label": "_world", "kind": 12, @@ -1085,6 +1219,8 @@ Ptyp_constr s:[281:21->281:22] Completable: Cpath Type[s] Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder Resolved opens 2 Completion.res Completion.res +ContextPath Type[s] +Path s [{ "label": "someType", "kind": 22, @@ -1105,6 +1241,9 @@ Pexp_apply ...[291:11->291:28] () Completable: CnamedArg(Value[funRecord].someFun, "", []) Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder Resolved opens 2 Completion.res Completion.res +ContextPath Value[funRecord].someFun +ContextPath Value[funRecord] +Path funRecord Found type for function (~name: string) => unit [{ "label": "name", @@ -1120,6 +1259,10 @@ Pexp_field [296:3->296:10] _:[299:0->296:11] Completable: Cpath Value[retAA](Nolabel)."" Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder Resolved opens 2 Completion.res Completion.res +ContextPath Value[retAA](Nolabel)."" +ContextPath Value[retAA](Nolabel) +ContextPath Value[retAA] +Path retAA [{ "label": "x", "kind": 5, @@ -1140,6 +1283,9 @@ Pexp_apply ...[301:3->301:11] () Completable: CnamedArg(Value[ff](~c), "", []) Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder Resolved opens 2 Completion.res Completion.res +ContextPath Value[ff](~c) +ContextPath Value[ff] +Path ff Found type for function ( ~opt1: int=?, ~a: int, @@ -1180,6 +1326,10 @@ Pexp_apply ...[304:3->304:13] () Completable: CnamedArg(Value[ff](~c)(Nolabel), "", []) Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder Resolved opens 2 Completion.res Completion.res +ContextPath Value[ff](~c)(Nolabel) +ContextPath Value[ff](~c) +ContextPath Value[ff] +Path ff Found type for function (~a: int, ~b: int, ~opt2: int=?, unit) => int [{ "label": "a", @@ -1207,6 +1357,9 @@ Pexp_apply ...[307:3->307:15] () Completable: CnamedArg(Value[ff](~c, Nolabel), "", []) Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder Resolved opens 2 Completion.res Completion.res +ContextPath Value[ff](~c, Nolabel) +ContextPath Value[ff] +Path ff Found type for function (~a: int, ~b: int, ~opt2: int=?, unit) => int [{ "label": "a", @@ -1234,6 +1387,9 @@ Pexp_apply ...[310:3->310:19] () Completable: CnamedArg(Value[ff](~c, Nolabel, Nolabel), "", []) Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder Resolved opens 2 Completion.res Completion.res +ContextPath Value[ff](~c, Nolabel, Nolabel) +ContextPath Value[ff] +Path ff Found type for function (~a: int, ~b: int) => int [{ "label": "a", @@ -1255,6 +1411,9 @@ Pexp_apply ...[313:3->313:21] () Completable: CnamedArg(Value[ff](~c, Nolabel, ~b), "", []) Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder Resolved opens 2 Completion.res Completion.res +ContextPath Value[ff](~c, Nolabel, ~b) +ContextPath Value[ff] +Path ff Found type for function (~a: int, ~opt2: int=?, unit) => int [{ "label": "a", @@ -1276,6 +1435,9 @@ Pexp_apply ...[316:3->316:14] () Completable: CnamedArg(Value[ff](~opt2), "", []) Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder Resolved opens 2 Completion.res Completion.res +ContextPath Value[ff](~opt2) +ContextPath Value[ff] +Path ff Found type for function (~opt1: int=?, ~a: int, ~b: int, unit, unit, ~c: int) => int [{ "label": "opt1", @@ -1309,6 +1471,8 @@ Pexp_apply ...[323:3->323:15] () Completable: CnamedArg(Value[withCallback], "", []) Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder Resolved opens 2 Completion.res Completion.res +ContextPath Value[withCallback] +Path withCallback Found type for function (~b: int) => callback [{ "label": "b", @@ -1330,6 +1494,9 @@ Pexp_apply ...[326:3->326:19] () Completable: CnamedArg(Value[withCallback](~a), "", []) Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder Resolved opens 2 Completion.res Completion.res +ContextPath Value[withCallback](~a) +ContextPath Value[withCallback] +Path withCallback Found type for function (~b: int) => int [{ "label": "b", @@ -1345,6 +1512,9 @@ Pexp_apply ...[329:3->329:19] () Completable: CnamedArg(Value[withCallback](~b), "", []) Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder Resolved opens 2 Completion.res Completion.res +ContextPath Value[withCallback](~b) +ContextPath Value[withCallback] +Path withCallback Found type for function (~a: int) => int [{ "label": "a", @@ -1364,9 +1534,14 @@ posCursor:[336:26] posNoWhite:[336:25] Found expr:[336:16->338:5] posCursor:[336:26] posNoWhite:[336:25] Found pattern:[336:20->338:5] posCursor:[336:26] posNoWhite:[336:25] Found type:[336:23->338:5] Ptyp_constr Res:[336:23->338:5] +posCursor:[336:26] posNoWhite:[336:25] Found pattern:[336:20->338:5] +posCursor:[336:26] posNoWhite:[336:25] Found type:[336:23->338:5] +Ptyp_constr Res:[336:23->338:5] Completable: Cpath Type[Res] Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder Resolved opens 2 Completion.res Completion.res +ContextPath Type[Res] +Path Res [{ "label": "RescriptReactErrorBoundary", "kind": 9, @@ -1382,13 +1557,14 @@ Resolved opens 2 Completion.res Completion.res }] Complete src/Completion.res 343:57 -posCursor:[343:57] posNoWhite:[343:56] Found expr:[343:10->346:23] posCursor:[343:57] posNoWhite:[343:56] Found expr:[343:53->346:23] posCursor:[343:57] posNoWhite:[343:56] Found expr:[343:53->343:57] Pexp_ident this:[343:53->343:57] Completable: Cpath Value[this] Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder Resolved opens 2 Completion.res Completion.res +ContextPath Value[this] +Path this [{ "label": "thisIsNotSaved", "kind": 12, @@ -1415,6 +1591,8 @@ Pexp_ident FAO.forAutoObject:[349:11->349:28] Completable: Cpath Value[FAO, forAutoObject] Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder Resolved opens 2 Completion.res Completion.res +ContextPath Value[FAO, forAutoObject] +Path FAO.forAutoObject {"contents": {"kind": "markdown", "value": "```rescript\n{\"age\": int, \"forAutoLabel\": FAR.forAutoRecord}\n```"}} Hover src/Completion.res 352:17 @@ -1424,6 +1602,8 @@ Pexp_apply ...[352:11->352:13] (~opt1352:15->352:19=...[352:20->352:21]) Completable: CnamedArg(Value[ff], opt1, [opt1]) Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder Resolved opens 2 Completion.res Completion.res +ContextPath Value[ff] +Path ff Found type for function ( ~opt1: int=?, ~a: int, @@ -1442,15 +1622,19 @@ posCursor:[355:23] posNoWhite:[355:22] Found expr:[355:12->355:23] Complete src/Completion.res 362:8 posCursor:[362:8] posNoWhite:[362:7] Found expr:[360:8->365:3] -posCursor:[362:8] posNoWhite:[362:7] Found expr:[361:2->365:3] posCursor:[362:8] posNoWhite:[362:7] Found pattern:[362:7->364:5] posCursor:[362:8] posNoWhite:[362:7] Found pattern:[362:7->362:8] Ppat_construct T:[362:7->362:8] Completable: Cpattern Value[x]=T Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder Resolved opens 2 Completion.res Completion.res +ContextPath Value[x] +Path x +Completable: Cpath Value[T] Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder Resolved opens 2 Completion.res Completion.res +ContextPath Value[T] +Path T [{ "label": "That", "kind": 4, @@ -1479,13 +1663,14 @@ Resolved opens 2 Completion.res Completion.res Complete src/Completion.res 373:21 posCursor:[373:21] posNoWhite:[373:20] Found expr:[371:8->376:3] -posCursor:[373:21] posNoWhite:[373:20] Found expr:[372:2->376:3] posCursor:[373:21] posNoWhite:[373:20] Found pattern:[373:7->375:5] posCursor:[373:21] posNoWhite:[373:20] Found pattern:[373:7->373:21] Ppat_construct AndThatOther.T:[373:7->373:21] Completable: Cpath Value[AndThatOther, T] Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder Resolved opens 2 Completion.res Completion.res +ContextPath Value[AndThatOther, T] +Path AndThatOther.T [{ "label": "ThatOther", "kind": 4, @@ -1504,6 +1689,8 @@ Pexp_ident ForAuto.:[378:16->378:24] Completable: Cpath Value[ForAuto, ""] Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder Resolved opens 2 Completion.res Completion.res +ContextPath Value[ForAuto, ""] +Path ForAuto. [{ "label": "abc", "kind": 12, @@ -1528,6 +1715,9 @@ Pexp_send [381:38->381:38] e:[381:19->381:36] Completable: Cpath Value[FAO, forAutoObject][""] Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder Resolved opens 2 Completion.res Completion.res +ContextPath Value[FAO, forAutoObject][""] +ContextPath Value[FAO, forAutoObject] +Path FAO.forAutoObject [{ "label": "age", "kind": 4, @@ -1552,6 +1742,9 @@ Pexp_field [384:14->384:23] _:[384:24->384:24] Completable: Cpath Value[funRecord]."" Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder Resolved opens 2 Completion.res Completion.res +ContextPath Value[funRecord]."" +ContextPath Value[funRecord] +Path funRecord [{ "label": "someFun", "kind": 5, @@ -1574,6 +1767,10 @@ posCursor:[389:12] posNoWhite:[389:11] Found expr:[389:6->389:12] Completable: Cpath array->ma Raw opens: 3 Js.place holder ... Shadow.B.place holder ... Shadow.A.place holder Resolved opens 3 Completion.res Completion.res js.ml +ContextPath array->ma +ContextPath array +CPPipe env:Completion +Path Js.Array2.ma [{ "label": "Array2.mapi", "kind": 12, @@ -1598,6 +1795,8 @@ Pexp_ident red:[397:13->397:16] Completable: Cpath Value[red] Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder Resolved opens 2 Completion.res Completion.res +ContextPath Value[red] +Path red [{ "label": "red", "kind": 12, @@ -1616,6 +1815,8 @@ Pexp_ident red:[402:24->402:27] Completable: Cpath Value[red] Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder Resolved opens 2 Completion.res Completion.res +ContextPath Value[red] +Path red [{ "label": "red", "kind": 12, @@ -1635,6 +1836,8 @@ Pexp_ident r:[405:21->405:22] Completable: Cpath Value[r] Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder Resolved opens 2 Completion.res Completion.res +ContextPath Value[r] +Path r [{ "label": "red", "kind": 12, @@ -1664,6 +1867,8 @@ Pexp_ident SomeLocalModule.:[409:5->411:5] Completable: Cpath Value[SomeLocalModule, ""] Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder Resolved opens 2 Completion.res Completion.res +ContextPath Value[SomeLocalModule, ""] +Path SomeLocalModule. [{ "label": "bb", "kind": 12, @@ -1688,6 +1893,8 @@ Pexp_ident SomeLocalModule.:[412:5->414:8] Completable: Cpath Value[SomeLocalModule, ""] Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder Resolved opens 2 Completion.res Completion.res +ContextPath Value[SomeLocalModule, ""] +Path SomeLocalModule. [{ "label": "bb", "kind": 12, @@ -1707,6 +1914,10 @@ posCursor:[417:17] posNoWhite:[417:16] Found expr:[417:11->417:17] Completable: Cpath int->t Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder Resolved opens 2 Completion.res Completion.res +ContextPath int->t +ContextPath int +CPPipe env:Completion +Path Belt.Int.t [{ "label": "Belt.Int.toString", "kind": 12, @@ -1726,6 +1937,10 @@ posCursor:[420:19] posNoWhite:[420:18] Found expr:[420:11->420:19] Completable: Cpath float->t Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder Resolved opens 2 Completion.res Completion.res +ContextPath float->t +ContextPath float +CPPipe env:Completion +Path Belt.Float.t [{ "label": "Belt.Float.toInt", "kind": 12, @@ -1745,6 +1960,11 @@ posCursor:[425:8] posNoWhite:[425:7] Found expr:[425:3->425:8] Completable: Cpath Value[ok]->g Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder Resolved opens 2 Completion.res Completion.res +ContextPath Value[ok]->g +ContextPath Value[ok] +Path ok +CPPipe env:Completion +Path Belt.Result.g [{ "label": "Belt.Result.getExn", "kind": 12, @@ -1765,6 +1985,9 @@ Pexp_field [443:3->443:12] so:[443:13->443:15] Completable: Cpath Value[rWithDepr].so Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder Resolved opens 2 Completion.res Completion.res +ContextPath Value[rWithDepr].so +ContextPath Value[rWithDepr] +Path rWithDepr [{ "label": "someInt", "kind": 5, @@ -1784,6 +2007,8 @@ XXX Not found! Completable: Cexpression Type[someVariantWithDeprecated] Raw opens: 2 Shadow.B.place holder ... Shadow.A.place holder Resolved opens 2 Completion.res Completion.res +ContextPath Type[someVariantWithDeprecated] +Path someVariantWithDeprecated [{ "label": "DoNotUseMe", "kind": 4, diff --git a/analysis/tests/src/expected/CompletionExpressions.res.txt b/analysis/tests/src/expected/CompletionExpressions.res.txt index 5f3324514..64dddf545 100644 --- a/analysis/tests/src/expected/CompletionExpressions.res.txt +++ b/analysis/tests/src/expected/CompletionExpressions.res.txt @@ -1,6 +1,11 @@ Complete src/CompletionExpressions.res 3:20 XXX Not found! Completable: Cpattern CTuple(Value[s], Value[f]) +ContextPath CTuple(Value[s], Value[f]) +ContextPath Value[s] +Path s +ContextPath Value[f] +Path f [{ "label": "(_, _)", "kind": 12, @@ -15,6 +20,9 @@ Complete src/CompletionExpressions.res 26:27 posCursor:[26:27] posNoWhite:[26:26] Found expr:[26:11->26:29] Pexp_apply ...[26:11->26:25] (...[26:26->26:28]) Completable: Cexpression CArgument Value[fnTakingRecord]($0)->recordBody +ContextPath CArgument Value[fnTakingRecord]($0) +ContextPath Value[fnTakingRecord] +Path fnTakingRecord [{ "label": "age", "kind": 5, @@ -57,6 +65,9 @@ Complete src/CompletionExpressions.res 29:28 posCursor:[29:28] posNoWhite:[29:27] Found expr:[29:11->29:30] Pexp_apply ...[29:11->29:25] (...[29:27->29:28]) Completable: Cexpression CArgument Value[fnTakingRecord]($0)=n->recordBody +ContextPath CArgument Value[fnTakingRecord]($0) +ContextPath Value[fnTakingRecord] +Path fnTakingRecord [{ "label": "nested", "kind": 5, @@ -69,6 +80,9 @@ Complete src/CompletionExpressions.res 32:35 posCursor:[32:35] posNoWhite:[32:34] Found expr:[32:11->32:38] Pexp_apply ...[32:11->32:25] (...[32:26->32:38]) Completable: Cexpression CArgument Value[fnTakingRecord]($0)->recordField(offline) +ContextPath CArgument Value[fnTakingRecord]($0) +ContextPath Value[fnTakingRecord] +Path fnTakingRecord [{ "label": "true", "kind": 4, @@ -87,6 +101,9 @@ Complete src/CompletionExpressions.res 35:36 posCursor:[35:36] posNoWhite:[35:35] Found expr:[35:11->35:39] Pexp_apply ...[35:11->35:25] (...[35:26->35:38]) Completable: Cexpression CArgument Value[fnTakingRecord]($0)->recordBody +ContextPath CArgument Value[fnTakingRecord]($0) +ContextPath Value[fnTakingRecord] +Path fnTakingRecord [{ "label": "offline", "kind": 5, @@ -123,6 +140,9 @@ Complete src/CompletionExpressions.res 38:37 posCursor:[38:37] posNoWhite:[38:35] Found expr:[38:11->38:53] Pexp_apply ...[38:11->38:25] (...[38:26->38:52]) Completable: Cexpression CArgument Value[fnTakingRecord]($0)->recordBody +ContextPath CArgument Value[fnTakingRecord]($0) +ContextPath Value[fnTakingRecord] +Path fnTakingRecord [{ "label": "online", "kind": 5, @@ -153,15 +173,18 @@ Complete src/CompletionExpressions.res 41:44 posCursor:[41:44] posNoWhite:[41:43] Found expr:[41:11->41:47] Pexp_apply ...[41:11->41:25] (...[41:26->41:47]) Completable: Cexpression CArgument Value[fnTakingRecord]($0)->recordField(nested) +ContextPath CArgument Value[fnTakingRecord]($0) +ContextPath Value[fnTakingRecord] +Path fnTakingRecord [{ "label": "None", - "kind": 4, + "kind": 12, "tags": [], "detail": "otherRecord", "documentation": null }, { "label": "Some(_)", - "kind": 4, + "kind": 12, "tags": [], "detail": "otherRecord", "documentation": null, @@ -181,12 +204,18 @@ Complete src/CompletionExpressions.res 44:46 posCursor:[44:46] posNoWhite:[44:45] Found expr:[44:11->44:49] Pexp_apply ...[44:11->44:25] (...[44:26->44:48]) Completable: Cexpression CArgument Value[fnTakingRecord]($0)->recordField(nested), recordBody +ContextPath CArgument Value[fnTakingRecord]($0) +ContextPath Value[fnTakingRecord] +Path fnTakingRecord [] Complete src/CompletionExpressions.res 47:51 posCursor:[47:51] posNoWhite:[47:50] Found expr:[47:11->47:55] Pexp_apply ...[47:11->47:25] (...[47:26->47:54]) Completable: Cexpression CArgument Value[fnTakingRecord]($0)->recordField(nested), variantPayload::Some($0), recordBody +ContextPath CArgument Value[fnTakingRecord]($0) +ContextPath Value[fnTakingRecord] +Path fnTakingRecord [{ "label": "someField", "kind": 5, @@ -205,6 +234,9 @@ Complete src/CompletionExpressions.res 50:45 posCursor:[50:45] posNoWhite:[50:44] Found expr:[50:11->50:48] Pexp_apply ...[50:11->50:25] (...[50:26->50:48]) Completable: Cexpression CArgument Value[fnTakingRecord]($0)->recordField(variant) +ContextPath CArgument Value[fnTakingRecord]($0) +ContextPath Value[fnTakingRecord] +Path fnTakingRecord [{ "label": "One", "kind": 4, @@ -235,6 +267,9 @@ Complete src/CompletionExpressions.res 53:47 posCursor:[53:47] posNoWhite:[53:46] Found expr:[53:11->53:50] Pexp_apply ...[53:11->53:25] (...[53:26->53:49]) Completable: Cexpression CArgument Value[fnTakingRecord]($0)=O->recordField(variant) +ContextPath CArgument Value[fnTakingRecord]($0) +ContextPath Value[fnTakingRecord] +Path fnTakingRecord [{ "label": "One", "kind": 4, @@ -262,6 +297,9 @@ Complete src/CompletionExpressions.res 56:57 posCursor:[56:57] posNoWhite:[56:56] Found expr:[56:11->56:61] Pexp_apply ...[56:11->56:25] (...[56:26->56:60]) Completable: Cexpression CArgument Value[fnTakingRecord]($0)->recordField(polyvariant), polyvariantPayload::three($0) +ContextPath CArgument Value[fnTakingRecord]($0) +ContextPath Value[fnTakingRecord] +Path fnTakingRecord [{ "label": "{}", "kind": 12, @@ -277,6 +315,9 @@ Complete src/CompletionExpressions.res 59:60 posCursor:[59:60] posNoWhite:[59:59] Found expr:[59:11->59:65] Pexp_apply ...[59:11->59:25] (...[59:26->59:64]) Completable: Cexpression CArgument Value[fnTakingRecord]($0)->recordField(polyvariant), polyvariantPayload::three($1) +ContextPath CArgument Value[fnTakingRecord]($0) +ContextPath Value[fnTakingRecord] +Path fnTakingRecord [{ "label": "true", "kind": 4, @@ -295,6 +336,9 @@ Complete src/CompletionExpressions.res 62:62 posCursor:[62:62] posNoWhite:[62:61] Found expr:[62:11->62:66] Pexp_apply ...[62:11->62:25] (...[62:26->62:65]) Completable: Cexpression CArgument Value[fnTakingRecord]($0)=t->recordField(polyvariant), polyvariantPayload::three($1) +ContextPath CArgument Value[fnTakingRecord]($0) +ContextPath Value[fnTakingRecord] +Path fnTakingRecord [{ "label": "true", "kind": 4, @@ -307,6 +351,9 @@ Complete src/CompletionExpressions.res 69:25 posCursor:[69:25] posNoWhite:[69:24] Found expr:[69:11->69:26] Pexp_apply ...[69:11->69:24] (...[69:25->69:26]) Completable: Cexpression CArgument Value[fnTakingArray]($0) +ContextPath CArgument Value[fnTakingArray]($0) +ContextPath Value[fnTakingArray] +Path fnTakingArray [{ "label": "[]", "kind": 12, @@ -322,15 +369,18 @@ Complete src/CompletionExpressions.res 72:26 posCursor:[72:26] posNoWhite:[72:25] Found expr:[72:11->72:28] Pexp_apply ...[72:11->72:24] (...[72:25->72:27]) Completable: Cexpression CArgument Value[fnTakingArray]($0)->array +ContextPath CArgument Value[fnTakingArray]($0) +ContextPath Value[fnTakingArray] +Path fnTakingArray [{ "label": "None", - "kind": 4, + "kind": 12, "tags": [], "detail": "bool", "documentation": null }, { "label": "Some(_)", - "kind": 4, + "kind": 12, "tags": [], "detail": "bool", "documentation": null, @@ -354,6 +404,9 @@ Complete src/CompletionExpressions.res 75:26 posCursor:[75:26] posNoWhite:[75:25] Found expr:[75:11->75:27] Pexp_apply ...[75:11->75:24] (...[75:25->75:26]) Completable: Cexpression CArgument Value[fnTakingArray]($0)=s +ContextPath CArgument Value[fnTakingArray]($0) +ContextPath Value[fnTakingArray] +Path fnTakingArray [{ "label": "s", "kind": 12, @@ -366,6 +419,9 @@ Complete src/CompletionExpressions.res 78:31 posCursor:[78:31] posNoWhite:[78:30] Found expr:[78:11->78:34] Pexp_apply ...[78:11->78:24] (...[78:25->78:33]) Completable: Cexpression CArgument Value[fnTakingArray]($0)->array, variantPayload::Some($0) +ContextPath CArgument Value[fnTakingArray]($0) +ContextPath Value[fnTakingArray] +Path fnTakingArray [{ "label": "true", "kind": 4, @@ -384,15 +440,18 @@ Complete src/CompletionExpressions.res 81:31 posCursor:[81:31] posNoWhite:[81:30] Found expr:[81:11->81:34] Pexp_apply ...[81:11->81:24] (...[81:25->81:33]) Completable: Cexpression CArgument Value[fnTakingArray]($0)->array +ContextPath CArgument Value[fnTakingArray]($0) +ContextPath Value[fnTakingArray] +Path fnTakingArray [{ "label": "None", - "kind": 4, + "kind": 12, "tags": [], "detail": "bool", "documentation": null }, { "label": "Some(_)", - "kind": 4, + "kind": 12, "tags": [], "detail": "bool", "documentation": null, @@ -416,15 +475,18 @@ Complete src/CompletionExpressions.res 84:31 posCursor:[84:31] posNoWhite:[84:30] Found expr:[84:11->84:40] Pexp_apply ...[84:11->84:24] (...[84:25->84:39]) Completable: Cexpression CArgument Value[fnTakingArray]($0)->array +ContextPath CArgument Value[fnTakingArray]($0) +ContextPath Value[fnTakingArray] +Path fnTakingArray [{ "label": "None", - "kind": 4, + "kind": 12, "tags": [], "detail": "bool", "documentation": null }, { "label": "Some(_)", - "kind": 4, + "kind": 12, "tags": [], "detail": "bool", "documentation": null, @@ -448,6 +510,9 @@ Complete src/CompletionExpressions.res 89:38 posCursor:[89:38] posNoWhite:[89:37] Found expr:[89:11->89:41] Pexp_apply ...[89:11->89:25] (...[89:26->89:40]) Completable: Cexpression CArgument Value[fnTakingRecord]($0)=so +ContextPath CArgument Value[fnTakingRecord]($0) +ContextPath Value[fnTakingRecord] +Path fnTakingRecord [{ "label": "someBoolVar", "kind": 12, @@ -460,6 +525,9 @@ Complete src/CompletionExpressions.res 96:43 posCursor:[96:43] posNoWhite:[96:42] Found expr:[96:11->96:46] Pexp_apply ...[96:11->96:30] (...[96:31->96:46]) Completable: Cexpression CArgument Value[fnTakingOtherRecord]($0)->recordField(otherField) +ContextPath CArgument Value[fnTakingOtherRecord]($0) +ContextPath Value[fnTakingOtherRecord] +Path fnTakingOtherRecord [{ "label": "\"\"", "kind": 12, @@ -475,6 +543,9 @@ Complete src/CompletionExpressions.res 108:57 posCursor:[108:57] posNoWhite:[108:56] Found expr:[108:11->108:60] Pexp_apply ...[108:11->108:42] (...[108:43->108:60]) Completable: Cexpression CArgument Value[fnTakingRecordWithOptionalField]($0)->recordField(someOptField) +ContextPath CArgument Value[fnTakingRecordWithOptionalField]($0) +ContextPath Value[fnTakingRecordWithOptionalField] +Path fnTakingRecordWithOptionalField [{ "label": "true", "kind": 4, @@ -493,17 +564,20 @@ Complete src/CompletionExpressions.res 116:53 posCursor:[116:53] posNoWhite:[116:52] Found expr:[116:11->116:56] Pexp_apply ...[116:11->116:39] (...[116:40->116:56]) Completable: Cexpression CArgument Value[fnTakingRecordWithOptVariant]($0)->recordField(someVariant) +ContextPath CArgument Value[fnTakingRecordWithOptVariant]($0) +ContextPath Value[fnTakingRecordWithOptVariant] +Path fnTakingRecordWithOptVariant [{ "label": "None", - "kind": 4, + "kind": 12, "tags": [], - "detail": "type someVariant = One | Two | Three(int, string)", + "detail": "someVariant", "documentation": null }, { "label": "Some(_)", - "kind": 4, + "kind": 12, "tags": [], - "detail": "type someVariant = One | Two | Three(int, string)", + "detail": "someVariant", "documentation": null, "insertText": "Some(${1:_})", "insertTextFormat": 2 @@ -537,6 +611,9 @@ Complete src/CompletionExpressions.res 126:49 posCursor:[126:49] posNoWhite:[126:48] Found expr:[126:11->126:51] Pexp_apply ...[126:11->126:31] (...[126:32->126:50]) Completable: Cexpression CArgument Value[fnTakingInlineRecord]($0)->variantPayload::WithInlineRecord($0) +ContextPath CArgument Value[fnTakingInlineRecord]($0) +ContextPath Value[fnTakingInlineRecord] +Path fnTakingInlineRecord [{ "label": "{}", "kind": 4, @@ -552,6 +629,9 @@ Complete src/CompletionExpressions.res 129:50 posCursor:[129:50] posNoWhite:[129:49] Found expr:[129:11->129:53] Pexp_apply ...[129:11->129:31] (...[129:32->129:52]) Completable: Cexpression CArgument Value[fnTakingInlineRecord]($0)->variantPayload::WithInlineRecord($0), recordBody +ContextPath CArgument Value[fnTakingInlineRecord]($0) +ContextPath Value[fnTakingInlineRecord] +Path fnTakingInlineRecord [{ "label": "someBoolField", "kind": 4, @@ -576,6 +656,9 @@ Complete src/CompletionExpressions.res 132:51 posCursor:[132:51] posNoWhite:[132:50] Found expr:[132:11->132:54] Pexp_apply ...[132:11->132:31] (...[132:32->132:53]) Completable: Cexpression CArgument Value[fnTakingInlineRecord]($0)=s->variantPayload::WithInlineRecord($0), recordBody +ContextPath CArgument Value[fnTakingInlineRecord]($0) +ContextPath Value[fnTakingInlineRecord] +Path fnTakingInlineRecord [{ "label": "someBoolField", "kind": 4, @@ -588,6 +671,9 @@ Complete src/CompletionExpressions.res 135:63 posCursor:[135:63] posNoWhite:[135:62] Found expr:[135:11->135:67] Pexp_apply ...[135:11->135:31] (...[135:32->135:66]) Completable: Cexpression CArgument Value[fnTakingInlineRecord]($0)->variantPayload::WithInlineRecord($0), recordField(nestedRecord) +ContextPath CArgument Value[fnTakingInlineRecord]($0) +ContextPath Value[fnTakingInlineRecord] +Path fnTakingInlineRecord [{ "label": "{}", "kind": 12, @@ -603,6 +689,9 @@ Complete src/CompletionExpressions.res 138:65 posCursor:[138:65] posNoWhite:[138:64] Found expr:[138:11->138:70] Pexp_apply ...[138:11->138:31] (...[138:32->138:69]) Completable: Cexpression CArgument Value[fnTakingInlineRecord]($0)->variantPayload::WithInlineRecord($0), recordField(nestedRecord), recordBody +ContextPath CArgument Value[fnTakingInlineRecord]($0) +ContextPath Value[fnTakingInlineRecord] +Path fnTakingInlineRecord [{ "label": "someField", "kind": 5, @@ -621,6 +710,9 @@ Complete src/CompletionExpressions.res 159:20 posCursor:[159:20] posNoWhite:[159:19] Found expr:[159:3->159:21] Pexp_apply ...[159:3->159:19] (...[159:20->159:21]) Completable: Cexpression CArgument Value[fnTakingCallback]($0) +ContextPath CArgument Value[fnTakingCallback]($0) +ContextPath Value[fnTakingCallback] +Path fnTakingCallback [{ "label": "() => {}", "kind": 12, @@ -636,12 +728,18 @@ Complete src/CompletionExpressions.res 162:21 posCursor:[162:21] posNoWhite:[162:20] Found expr:[162:3->162:22] Pexp_apply ...[162:3->162:19] (...[162:20->162:21]) Completable: Cexpression CArgument Value[fnTakingCallback]($0)=a +ContextPath CArgument Value[fnTakingCallback]($0) +ContextPath Value[fnTakingCallback] +Path fnTakingCallback [] Complete src/CompletionExpressions.res 165:22 posCursor:[165:22] posNoWhite:[165:21] Found expr:[165:3->165:24] Pexp_apply ...[165:3->165:19] (...[165:20->165:21]) Completable: Cexpression CArgument Value[fnTakingCallback]($1) +ContextPath CArgument Value[fnTakingCallback]($1) +ContextPath Value[fnTakingCallback] +Path fnTakingCallback [{ "label": "v => {}", "kind": 12, @@ -657,6 +755,9 @@ Complete src/CompletionExpressions.res 168:25 posCursor:[168:25] posNoWhite:[168:24] Found expr:[168:3->168:27] Pexp_apply ...[168:3->168:19] (...[168:20->168:21], ...[168:23->168:24]) Completable: Cexpression CArgument Value[fnTakingCallback]($2) +ContextPath CArgument Value[fnTakingCallback]($2) +ContextPath Value[fnTakingCallback] +Path fnTakingCallback [{ "label": "event => {}", "kind": 12, @@ -672,6 +773,9 @@ Complete src/CompletionExpressions.res 171:29 posCursor:[171:29] posNoWhite:[171:27] Found expr:[171:3->171:30] Pexp_apply ...[171:3->171:19] (...[171:20->171:21], ...[171:23->171:24], ...[171:26->171:27]) Completable: Cexpression CArgument Value[fnTakingCallback]($3) +ContextPath CArgument Value[fnTakingCallback]($3) +ContextPath Value[fnTakingCallback] +Path fnTakingCallback [{ "label": "(~on, ~off=?, v1) => {}", "kind": 12, @@ -687,6 +791,9 @@ Complete src/CompletionExpressions.res 174:32 posCursor:[174:32] posNoWhite:[174:30] Found expr:[174:3->174:33] Pexp_apply ...[174:3->174:19] (...[174:20->174:21], ...[174:23->174:24], ...[174:26->174:27], ...[174:29->174:30]) Completable: Cexpression CArgument Value[fnTakingCallback]($4) +ContextPath CArgument Value[fnTakingCallback]($4) +ContextPath Value[fnTakingCallback] +Path fnTakingCallback [{ "label": "(v1, v2, v3) => {}", "kind": 12, @@ -702,6 +809,9 @@ Complete src/CompletionExpressions.res 177:34 posCursor:[177:34] posNoWhite:[177:33] Found expr:[177:3->177:36] Pexp_apply ...[177:3->177:19] (...[177:20->177:21], ...[177:23->177:24], ...[177:26->177:27], ...[177:29->177:30], ...[177:32->177:33]) Completable: Cexpression CArgument Value[fnTakingCallback]($5) +ContextPath CArgument Value[fnTakingCallback]($5) +ContextPath Value[fnTakingCallback] +Path fnTakingCallback [{ "label": "(~on=?, ~off=?, ()) => {}", "kind": 12, @@ -721,6 +831,9 @@ posCursor:[185:10] posNoWhite:[185:9] Found expr:[184:2->185:11] posCursor:[185:10] posNoWhite:[185:9] Found expr:[185:2->185:11] Pexp_apply ...[185:2->185:8] (...[185:9->185:10]) Completable: Cexpression CArgument Value[Js, log]($0)=s +ContextPath CArgument Value[Js, log]($0) +ContextPath Value[Js, log] +Path Js.log [{ "label": "second2", "kind": 12, @@ -751,6 +864,9 @@ Complete src/CompletionExpressions.res 196:14 posCursor:[196:14] posNoWhite:[196:13] Found expr:[196:3->196:14] Pexp_field [196:3->196:6] someOpt:[196:7->196:14] Completable: Cpath Value[fff].someOpt +ContextPath Value[fff].someOpt +ContextPath Value[fff] +Path fff [{ "label": "someOptField", "kind": 5, diff --git a/analysis/tests/src/expected/CompletionFunctionArguments.res.txt b/analysis/tests/src/expected/CompletionFunctionArguments.res.txt index a2b6236f6..e15baa7a3 100644 --- a/analysis/tests/src/expected/CompletionFunctionArguments.res.txt +++ b/analysis/tests/src/expected/CompletionFunctionArguments.res.txt @@ -2,6 +2,9 @@ Complete src/CompletionFunctionArguments.res 10:24 posCursor:[10:24] posNoWhite:[10:23] Found expr:[10:11->10:25] Pexp_apply ...[10:11->10:17] (~isOn10:19->10:23=...__ghost__[0:-1->0:-1]) Completable: Cexpression CArgument Value[someFn](~isOn) +ContextPath CArgument Value[someFn](~isOn) +ContextPath Value[someFn] +Path someFn [{ "label": "true", "kind": 4, @@ -20,6 +23,9 @@ Complete src/CompletionFunctionArguments.res 13:25 posCursor:[13:25] posNoWhite:[13:24] Found expr:[13:11->13:26] Pexp_apply ...[13:11->13:17] (~isOn13:19->13:23=...[13:24->13:25]) Completable: Cexpression CArgument Value[someFn](~isOn)=t +ContextPath CArgument Value[someFn](~isOn) +ContextPath Value[someFn] +Path someFn [{ "label": "true", "kind": 4, @@ -39,6 +45,9 @@ Complete src/CompletionFunctionArguments.res 16:25 posCursor:[16:25] posNoWhite:[16:24] Found expr:[16:11->16:26] Pexp_apply ...[16:11->16:17] (~isOff16:19->16:24=...__ghost__[0:-1->0:-1]) Completable: Cexpression CArgument Value[someFn](~isOff) +ContextPath CArgument Value[someFn](~isOff) +ContextPath Value[someFn] +Path someFn [{ "label": "true", "kind": 4, @@ -61,6 +70,9 @@ posCursor:[21:27] posNoWhite:[21:26] Found expr:[21:7->21:28] posCursor:[21:27] posNoWhite:[21:26] Found expr:[21:14->21:28] Pexp_apply ...[21:14->21:20] (~isOn21:22->21:26=...__ghost__[0:-1->0:-1]) Completable: Cexpression CArgument Value[someFn](~isOn) +ContextPath CArgument Value[someFn](~isOn) +ContextPath Value[someFn] +Path someFn [{ "label": "true", "kind": 4, @@ -79,6 +91,9 @@ Complete src/CompletionFunctionArguments.res 34:24 posCursor:[34:24] posNoWhite:[34:23] Found expr:[34:11->34:25] Pexp_apply ...[34:11->34:22] (...[34:23->34:24]) Completable: Cexpression CArgument Value[someOtherFn]($0)=f +ContextPath CArgument Value[someOtherFn]($0) +ContextPath Value[someOtherFn] +Path someOtherFn [{ "label": "false", "kind": 4, @@ -91,6 +106,9 @@ Complete src/CompletionFunctionArguments.res 51:39 posCursor:[51:39] posNoWhite:[51:38] Found expr:[51:11->51:40] Pexp_apply ...[51:11->51:30] (~config51:32->51:38=...__ghost__[0:-1->0:-1]) Completable: Cexpression CArgument Value[someFnTakingVariant](~config) +ContextPath CArgument Value[someFnTakingVariant](~config) +ContextPath Value[someFnTakingVariant] +Path someFnTakingVariant [{ "label": "One", "kind": 4, @@ -121,6 +139,9 @@ Complete src/CompletionFunctionArguments.res 54:40 posCursor:[54:40] posNoWhite:[54:39] Found expr:[54:11->54:41] Pexp_apply ...[54:11->54:30] (~config54:32->54:38=...[54:39->54:40]) Completable: Cexpression CArgument Value[someFnTakingVariant](~config)=O +ContextPath CArgument Value[someFnTakingVariant](~config) +ContextPath Value[someFnTakingVariant] +Path someFnTakingVariant [{ "label": "One", "kind": 4, @@ -154,11 +175,14 @@ Complete src/CompletionFunctionArguments.res 57:33 posCursor:[57:33] posNoWhite:[57:32] Found expr:[57:11->57:34] Pexp_apply ...[57:11->57:30] (...[57:31->57:33]) Completable: Cexpression CArgument Value[someFnTakingVariant]($0)=So +ContextPath CArgument Value[someFnTakingVariant]($0) +ContextPath Value[someFnTakingVariant] +Path someFnTakingVariant [{ "label": "Some(_)", - "kind": 4, + "kind": 12, "tags": [], - "detail": "type someVariant = One | Two | Three(int, string)", + "detail": "someVariant", "documentation": null, "sortText": "A Some(_)", "insertText": "Some(${1:_})", @@ -175,6 +199,9 @@ Complete src/CompletionFunctionArguments.res 60:44 posCursor:[60:44] posNoWhite:[60:43] Found expr:[60:11->60:45] Pexp_apply ...[60:11->60:30] (~configOpt260:32->60:42=...[60:43->60:44]) Completable: Cexpression CArgument Value[someFnTakingVariant](~configOpt2)=O +ContextPath CArgument Value[someFnTakingVariant](~configOpt2) +ContextPath Value[someFnTakingVariant] +Path someFnTakingVariant [{ "label": "One", "kind": 4, @@ -208,6 +235,9 @@ Complete src/CompletionFunctionArguments.res 63:23 posCursor:[63:23] posNoWhite:[63:22] Found expr:[63:11->63:24] Pexp_apply ...[63:11->63:22] (...[63:23->63:24]) Completable: Cexpression CArgument Value[someOtherFn]($0) +ContextPath CArgument Value[someOtherFn]($0) +ContextPath Value[someOtherFn] +Path someOtherFn [{ "label": "true", "kind": 4, @@ -226,6 +256,9 @@ Complete src/CompletionFunctionArguments.res 66:28 posCursor:[66:28] posNoWhite:[66:27] Found expr:[66:11->66:30] Pexp_apply ...[66:11->66:22] (...[66:23->66:24], ...[66:26->66:27]) Completable: Cexpression CArgument Value[someOtherFn]($2) +ContextPath CArgument Value[someOtherFn]($2) +ContextPath Value[someOtherFn] +Path someOtherFn [{ "label": "true", "kind": 4, @@ -243,6 +276,9 @@ Completable: Cexpression CArgument Value[someOtherFn]($2) Complete src/CompletionFunctionArguments.res 69:30 posCursor:[69:30] posNoWhite:[69:29] Found expr:[69:11->69:31] Completable: Cexpression CArgument Value[someOtherFn]($2)=t +ContextPath CArgument Value[someOtherFn]($2) +ContextPath Value[someOtherFn] +Path someOtherFn [{ "label": "true", "kind": 4, @@ -262,6 +298,9 @@ Complete src/CompletionFunctionArguments.res 76:25 posCursor:[76:25] posNoWhite:[76:24] Found expr:[76:11->76:26] Pexp_apply ...[76:11->76:24] (...[76:25->76:26]) Completable: Cexpression CArgument Value[fnTakingTuple]($0) +ContextPath CArgument Value[fnTakingTuple]($0) +ContextPath Value[fnTakingTuple] +Path fnTakingTuple [{ "label": "(_, _, _)", "kind": 12, @@ -276,6 +315,9 @@ Complete src/CompletionFunctionArguments.res 89:27 posCursor:[89:27] posNoWhite:[89:26] Found expr:[89:11->89:29] Pexp_apply ...[89:11->89:25] (...[89:26->89:28]) Completable: Cexpression CArgument Value[fnTakingRecord]($0)->recordBody +ContextPath CArgument Value[fnTakingRecord]($0) +ContextPath Value[fnTakingRecord] +Path fnTakingRecord [{ "label": "age", "kind": 5, @@ -304,6 +346,13 @@ posCursor:[109:29] posNoWhite:[109:28] Found expr:[107:6->109:29] posCursor:[109:29] posNoWhite:[109:28] Found expr:[108:6->109:29] posCursor:[109:29] posNoWhite:[109:28] Found expr:[109:9->109:29] Completable: Cpath Value[thisGetsBrokenLoc]->a <> +ContextPath Value[thisGetsBrokenLoc]->a <> +ContextPath Value[thisGetsBrokenLoc] +Path thisGetsBrokenLoc +CPPipe env:CompletionFunctionArguments +CPPipe type path:ReactEvent.Mouse.t +CPPipe pathFromEnv:ReactEvent.Mouse found:false +Path ReactEvent.Mouse.a [{ "label": "ReactEvent.Mouse.altKey", "kind": 12, @@ -320,6 +369,13 @@ posCursor:[111:27] posNoWhite:[111:26] Found expr:[107:6->111:27] posCursor:[111:27] posNoWhite:[111:26] Found expr:[108:6->111:27] posCursor:[111:27] posNoWhite:[111:26] Found expr:[111:9->111:27] Completable: Cpath Value[reassignedWorks]->a <> +ContextPath Value[reassignedWorks]->a <> +ContextPath Value[reassignedWorks] +Path reassignedWorks +CPPipe env:CompletionFunctionArguments +CPPipe type path:ReactEvent.Mouse.t +CPPipe pathFromEnv:ReactEvent.Mouse found:false +Path ReactEvent.Mouse.a [{ "label": "ReactEvent.Mouse.altKey", "kind": 12, diff --git a/analysis/tests/src/expected/CompletionInferValues.res.txt b/analysis/tests/src/expected/CompletionInferValues.res.txt new file mode 100644 index 000000000..4d6034ad7 --- /dev/null +++ b/analysis/tests/src/expected/CompletionInferValues.res.txt @@ -0,0 +1,816 @@ +Complete src/CompletionInferValues.res 15:43 +posCursor:[15:43] posNoWhite:[15:42] Found expr:[15:33->15:43] +Completable: Cpath Value[aliased]->f +ContextPath Value[aliased]->f +ContextPath Value[aliased] +Path aliased +ContextPath Value[x] +Path x +ContextPath int +CPPipe env:CompletionInferValues +Path Belt.Int.f +[{ + "label": "Belt.Int.fromString", + "kind": 12, + "tags": [], + "detail": "string => option", + "documentation": {"kind": "markdown", "value": "\n Converts a given `string` to an `int`. Returns `Some(int)` when the input is a number, `None` otherwise.\n\n ```res example\n Js.log(Belt.Int.fromString(\"1\") === Some(1)) /* true */\n ```\n"} + }, { + "label": "Belt.Int.fromFloat", + "kind": 12, + "tags": [], + "detail": "float => int", + "documentation": {"kind": "markdown", "value": "\n Converts a given `float` to an `int`.\n\n ```res example\n Js.log(Belt.Int.fromFloat(1.0) === 1) /* true */\n ```\n"} + }] + +Complete src/CompletionInferValues.res 18:30 +posCursor:[18:30] posNoWhite:[18:29] Found expr:[18:28->18:30] +Pexp_field [18:28->18:29] _:[33:0->18:30] +Completable: Cpath Value[x]."" +ContextPath Value[x]."" +ContextPath Value[x] +Path x +ContextPath Value[getSomeRecord](Nolabel) +ContextPath Value[getSomeRecord] +Path getSomeRecord +[{ + "label": "name", + "kind": 5, + "tags": [], + "detail": "name: string\n\ntype someRecord = {name: string, age: int}", + "documentation": null + }, { + "label": "age", + "kind": 5, + "tags": [], + "detail": "age: int\n\ntype someRecord = {name: string, age: int}", + "documentation": null + }] + +Complete src/CompletionInferValues.res 21:53 +posCursor:[21:53] posNoWhite:[21:52] Found expr:[21:45->21:53] +Pexp_field [21:45->21:52] _:[33:0->21:53] +Completable: Cpath Value[aliased]."" +ContextPath Value[aliased]."" +ContextPath Value[aliased] +Path aliased +ContextPath Value[x] +Path x +ContextPath Value[getSomeRecord](Nolabel) +ContextPath Value[getSomeRecord] +Path getSomeRecord +[{ + "label": "name", + "kind": 5, + "tags": [], + "detail": "name: string\n\ntype someRecord = {name: string, age: int}", + "documentation": null + }, { + "label": "age", + "kind": 5, + "tags": [], + "detail": "age: int\n\ntype someRecord = {name: string, age: int}", + "documentation": null + }] + +Complete src/CompletionInferValues.res 24:63 +posCursor:[24:63] posNoWhite:[24:62] Found expr:[24:3->24:64] +Pexp_apply ...[24:3->24:21] (...[24:22->24:63]) +posCursor:[24:63] posNoWhite:[24:62] Found expr:[24:22->24:63] +posCursor:[24:63] posNoWhite:[24:62] Found expr:[24:36->24:63] +posCursor:[24:63] posNoWhite:[24:62] Found expr:[24:42->24:63] +posCursor:[24:63] posNoWhite:[24:62] Found expr:[24:52->24:63] +Pexp_field [24:52->24:62] _:[24:63->24:63] +Completable: Cpath Value[someRecord]."" +ContextPath Value[someRecord]."" +ContextPath Value[someRecord] +Path someRecord +ContextPath CArgument CArgument Value[someFnWithCallback]($0)(~someRecord) +ContextPath CArgument Value[someFnWithCallback]($0) +ContextPath Value[someFnWithCallback] +Path someFnWithCallback +[{ + "label": "name", + "kind": 5, + "tags": [], + "detail": "name: string\n\ntype someRecord = {name: string, age: int}", + "documentation": null + }, { + "label": "age", + "kind": 5, + "tags": [], + "detail": "age: int\n\ntype someRecord = {name: string, age: int}", + "documentation": null + }] + +Complete src/CompletionInferValues.res 27:90 +posCursor:[27:90] posNoWhite:[27:89] Found expr:[27:39->27:91] +Pexp_apply ...[27:39->27:48] (...[27:49->27:90]) +posCursor:[27:90] posNoWhite:[27:89] Found expr:[27:49->27:90] +posCursor:[27:90] posNoWhite:[27:89] Found expr:[27:56->27:90] +posCursor:[27:90] posNoWhite:[27:89] Found expr:[27:69->27:90] +posCursor:[27:90] posNoWhite:[27:89] Found expr:[27:79->27:90] +Pexp_field [27:79->27:89] _:[27:90->27:90] +Completable: Cpath Value[someRecord]."" +ContextPath Value[someRecord]."" +ContextPath Value[someRecord] +Path someRecord +ContextPath CArgument CArgument Value[aliasedFn]($0)(~someRecord) +ContextPath CArgument Value[aliasedFn]($0) +ContextPath Value[aliasedFn] +Path aliasedFn +ContextPath Value[someFnWithCallback] +Path someFnWithCallback +[{ + "label": "name", + "kind": 5, + "tags": [], + "detail": "name: string\n\ntype someRecord = {name: string, age: int}", + "documentation": null + }, { + "label": "age", + "kind": 5, + "tags": [], + "detail": "age: int\n\ntype someRecord = {name: string, age: int}", + "documentation": null + }] + +Complete src/CompletionInferValues.res 30:36 +posCursor:[30:36] posNoWhite:[30:35] Found expr:[30:3->30:39] +Pexp_apply ...[30:3->30:15] (...[30:16->30:38]) +posCursor:[30:36] posNoWhite:[30:35] Found expr:[30:16->30:38] +posCursor:[30:36] posNoWhite:[30:35] Found expr:[30:27->30:36] +Completable: Cpath Value[event]->pr +ContextPath Value[event]->pr +ContextPath Value[event] +Path event +ContextPath CArgument CArgument Value[reactEventFn]($0)($0) +ContextPath CArgument Value[reactEventFn]($0) +ContextPath Value[reactEventFn] +Path reactEventFn +CPPipe env:CompletionInferValues +CPPipe type path:ReactEvent.Mouse.t +CPPipe pathFromEnv:ReactEvent.Mouse found:false +Path ReactEvent.Mouse.pr +[{ + "label": "ReactEvent.Mouse.preventDefault", + "kind": 12, + "tags": [], + "detail": "t => unit", + "documentation": null + }] + +Complete src/CompletionInferValues.res 41:50 +posCursor:[41:50] posNoWhite:[41:49] Found expr:[41:12->41:56] +JSX 41:15] onMouseEnter[41:16->41:28]=...[41:36->41:52]> _children:41:54 +posCursor:[41:50] posNoWhite:[41:49] Found expr:[41:36->41:52] +posCursor:[41:50] posNoWhite:[41:49] Found expr:[41:41->41:50] +Completable: Cpath Value[event]->pr <> +ContextPath Value[event]->pr <> +ContextPath Value[event] +Path event +ContextPath CArgument CJsxPropValue [div] onMouseEnter($0) +ContextPath CJsxPropValue [div] onMouseEnter +Path ReactDOM.domProps +Path JsxDOM.domProps +CPPipe env:CompletionInferValues +CPPipe type path:JsxEvent.Mouse.t +CPPipe pathFromEnv:JsxEvent.Mouse found:false +Path JsxEvent.Mouse.pr +[{ + "label": "JsxEvent.Mouse.preventDefault", + "kind": 12, + "tags": [], + "detail": "t => unit", + "documentation": null + }] + +Complete src/CompletionInferValues.res 44:50 +posCursor:[44:50] posNoWhite:[44:49] Found expr:[44:12->44:56] +JSX 44:15] onMouseEnter[44:16->44:28]=...[44:36->44:52]> _children:44:54 +posCursor:[44:50] posNoWhite:[44:49] Found expr:[44:36->44:52] +posCursor:[44:50] posNoWhite:[44:49] Found expr:[44:41->44:50] +Completable: Cpath Value[event]->pr <> +ContextPath Value[event]->pr <> +ContextPath Value[event] +Path event +ContextPath CArgument CJsxPropValue [Div] onMouseEnter($0) +ContextPath CJsxPropValue [Div] onMouseEnter +Path Div.make +CPPipe env:CompletionInferValues envFromCompletionItem:CompletionInferValues.Div +CPPipe type path:JsxEvent.Mouse.t +CPPipe pathFromEnv:JsxEvent.Mouse found:false +Path JsxEvent.Mouse.pr +[{ + "label": "JsxEvent.Mouse.preventDefault", + "kind": 12, + "tags": [], + "detail": "t => unit", + "documentation": null + }] + +Complete src/CompletionInferValues.res 47:87 +posCursor:[47:87] posNoWhite:[47:86] Found expr:[47:12->47:93] +JSX 47:15] onMouseEnter[47:16->47:28]=...[47:36->47:89]> _children:47:91 +posCursor:[47:87] posNoWhite:[47:86] Found expr:[47:36->47:89] +posCursor:[47:87] posNoWhite:[47:86] Found expr:[47:41->47:87] +posCursor:[47:87] posNoWhite:[47:86] Found expr:[47:81->47:87] +Completable: Cpath Value[btn]->t <> +ContextPath Value[btn]->t <> +ContextPath Value[btn] +Path btn +ContextPath Value[JsxEvent, Mouse, button](Nolabel) +ContextPath Value[JsxEvent, Mouse, button] +Path JsxEvent.Mouse.button +CPPipe env:CompletionInferValues envFromCompletionItem:JsxEvent.Mouse +Path Belt.Int.t +[{ + "label": "Belt.Int.toString", + "kind": 12, + "tags": [], + "detail": "int => string", + "documentation": {"kind": "markdown", "value": "\n Converts a given `int` to a `string`. Uses the JavaScript `String` constructor under the hood.\n\n ```res example\n Js.log(Belt.Int.toString(1) === \"1\") /* true */\n ```\n"} + }, { + "label": "Belt.Int.toFloat", + "kind": 12, + "tags": [], + "detail": "int => float", + "documentation": {"kind": "markdown", "value": "\n Converts a given `int` to a `float`.\n\n ```res example\n Js.log(Belt.Int.toFloat(1) === 1.0) /* true */\n ```\n"} + }] + +Complete src/CompletionInferValues.res 50:108 +posCursor:[50:108] posNoWhite:[50:107] Found expr:[50:12->50:114] +JSX 50:15] onMouseEnter[50:16->50:28]=...[50:36->50:110]> _children:50:112 +posCursor:[50:108] posNoWhite:[50:107] Found expr:[50:36->50:110] +posCursor:[50:108] posNoWhite:[50:107] Found expr:[50:41->50:108] +posCursor:[50:108] posNoWhite:[50:107] Found expr:[50:100->50:108] +Completable: Cpath Value[btn]->spl <> +ContextPath Value[btn]->spl <> +ContextPath Value[btn] +Path btn +ContextPath Value[Belt, Int, toString](Nolabel) +ContextPath Value[Belt, Int, toString] +Path Belt.Int.toString +CPPipe env:CompletionInferValues envFromCompletionItem:Belt_Int +Path Js.String2.spl +[{ + "label": "Js.String2.splitAtMost", + "kind": 12, + "tags": [], + "detail": "(t, t, ~limit: int) => array", + "documentation": {"kind": "markdown", "value": "\n `splitAtMost delimiter ~limit: n str` splits the given `str` at every occurrence of `delimiter` and returns an array of the first `n` resulting substrings. If `n` is negative or greater than the number of substrings, the array will contain all the substrings.\n\n```\nsplitAtMost \"ant/bee/cat/dog/elk\" \"/\" ~limit: 3 = [|\"ant\"; \"bee\"; \"cat\"|];;\nsplitAtMost \"ant/bee/cat/dog/elk\" \"/\" ~limit: 0 = [| |];;\nsplitAtMost \"ant/bee/cat/dog/elk\" \"/\" ~limit: 9 = [|\"ant\"; \"bee\"; \"cat\"; \"dog\"; \"elk\"|];;\n```\n"} + }, { + "label": "Js.String2.splitByRe", + "kind": 12, + "tags": [], + "detail": "(t, Js_re.t) => array>", + "documentation": {"kind": "markdown", "value": "\n`splitByRe(str, regex)` splits the given `str` at every occurrence of `regex`\nand returns an array of the resulting substrings.\n\nSee [`String.split`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split)\non MDN.\n\n```res example\nJs.String2.splitByRe(\"art; bed , cog ;dad\", %re(\"/\\s*[,;]\\s*/\")) == [\n Some(\"art\"),\n Some(\"bed\"),\n Some(\"cog\"),\n Some(\"dad\"),\n ]\n```\n"} + }, { + "label": "Js.String2.split", + "kind": 12, + "tags": [], + "detail": "(t, t) => array", + "documentation": {"kind": "markdown", "value": "\n`split(str, delimiter)` splits the given `str` at every occurrence of\n`delimiter` and returns an array of the resulting substrings.\n\nSee [`String.split`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split)\non MDN.\n\n```res example\nJs.String2.split(\"2018-01-02\", \"-\") == [\"2018\", \"01\", \"02\"]\nJs.String2.split(\"a,b,,c\", \",\") == [\"a\", \"b\", \"\", \"c\"]\nJs.String2.split(\"good::bad as great::awful\", \"::\") == [\"good\", \"bad as great\", \"awful\"]\nJs.String2.split(\"has-no-delimiter\", \";\") == [\"has-no-delimiter\"]\n```\n"} + }, { + "label": "Js.String2.splitByReAtMost", + "kind": 12, + "tags": [], + "detail": "(t, Js_re.t, ~limit: int) => array>", + "documentation": {"kind": "markdown", "value": "\n`splitByReAtMost(str, regex, ~limit:n)` splits the given `str` at every\noccurrence of `regex` and returns an array of the first `n` resulting\nsubstrings. If `n` is negative or greater than the number of substrings, the\narray will contain all the substrings.\n\nSee [`String.split`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split)\non MDN.\n\n```res example\nJs.String2.splitByReAtMost(\"one: two: three: four\", %re(\"/\\s*:\\s*/\"), ~limit=3) == [\n Some(\"one\"),\n Some(\"two\"),\n Some(\"three\"),\n ]\n\nJs.String2.splitByReAtMost(\"one: two: three: four\", %re(\"/\\s*:\\s*/\"), ~limit=0) == []\n\nJs.String2.splitByReAtMost(\"one: two: three: four\", %re(\"/\\s*:\\s*/\"), ~limit=8) == [\n Some(\"one\"),\n Some(\"two\"),\n Some(\"three\"),\n Some(\"four\"),\n ]\n```\n"} + }] + +Complete src/CompletionInferValues.res 53:130 +posCursor:[53:130] posNoWhite:[53:129] Found expr:[53:12->53:136] +JSX 53:15] onMouseEnter[53:16->53:28]=...[53:36->53:132]> _children:53:134 +posCursor:[53:130] posNoWhite:[53:129] Found expr:[53:36->53:132] +posCursor:[53:130] posNoWhite:[53:129] Found expr:[53:41->53:130] +posCursor:[53:130] posNoWhite:[53:129] Found expr:[53:123->53:130] +Completable: Cpath Value[btn]->ma <> +ContextPath Value[btn]->ma <> +ContextPath Value[btn] +Path btn +ContextPath Value[Js, String2, split](Nolabel, Nolabel) +ContextPath Value[Js, String2, split] +Path Js.String2.split +CPPipe env:CompletionInferValues envFromCompletionItem:Js_string2 +Path Js.Array2.ma +[{ + "label": "Js.Array2.mapi", + "kind": 12, + "tags": [], + "detail": "(t<'a>, ('a, int) => 'b) => t<'b>", + "documentation": {"kind": "markdown", "value": "\nApplies the function (the second argument) to each item in the array, returning\na new array. The function acceps two arguments: an item from the array and its\nindex number. The result array does not have to have elements of the same type\nas the input array. See\n[`Array.map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map)\non MDN.\n\n```res example\n// multiply each item in array by its position\nlet product = (item, index) => item * index\nJs.Array2.mapi([10, 11, 12], product) == [0, 11, 24]\n```\n"} + }, { + "label": "Js.Array2.map", + "kind": 12, + "tags": [], + "detail": "(t<'a>, 'a => 'b) => t<'b>", + "documentation": {"kind": "markdown", "value": "\nApplies the function (the second argument) to each item in the array, returning\na new array. The result array does not have to have elements of the same type\nas the input array. See\n[`Array.map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map)\non MDN.\n\n```res example\nJs.Array2.map([12, 4, 8], x => x * x) == [144, 16, 64]\nJs.Array2.map([\"animal\", \"vegetable\", \"mineral\"], Js.String.length) == [6, 9, 7]\n```\n"} + }] + +Complete src/CompletionInferValues.res 56:52 +posCursor:[56:52] posNoWhite:[56:51] Found expr:[56:50->56:52] +Pexp_field [56:50->56:51] _:[59:0->56:52] +Completable: Cpath Value[x]."" +ContextPath Value[x]."" +ContextPath Value[x] +Path x +ContextPath Type[someRecord] +Path someRecord +[{ + "label": "name", + "kind": 5, + "tags": [], + "detail": "name: string\n\ntype someRecord = {name: string, age: int}", + "documentation": null + }, { + "label": "age", + "kind": 5, + "tags": [], + "detail": "age: int\n\ntype someRecord = {name: string, age: int}", + "documentation": null + }] + +Complete src/CompletionInferValues.res 78:78 +posCursor:[78:78] posNoWhite:[78:77] Found expr:[78:70->78:78] +Pexp_field [78:70->78:77] _:[125:0->78:78] +Completable: Cpath Value[srecord]."" +ContextPath Value[srecord]."" +ContextPath Value[srecord] +Path srecord +ContextPath CPatternPath(Value[x])->recordField(srecord) +ContextPath Value[x] +Path x +ContextPath Type[someRecordWithNestedStuff] +Path someRecordWithNestedStuff +[{ + "label": "name", + "kind": 5, + "tags": [], + "detail": "name: string\n\ntype someRecord = {name: string, age: int}", + "documentation": null + }, { + "label": "age", + "kind": 5, + "tags": [], + "detail": "age: int\n\ntype someRecord = {name: string, age: int}", + "documentation": null + }] + +Complete src/CompletionInferValues.res 82:86 +posCursor:[82:86] posNoWhite:[82:85] Found expr:[82:78->82:86] +Pexp_field [82:78->82:85] _:[125:0->82:86] +Completable: Cpath Value[aliased]."" +ContextPath Value[aliased]."" +ContextPath Value[aliased] +Path aliased +ContextPath CPatternPath(Value[x])->recordField(nested) +ContextPath Value[x] +Path x +ContextPath Type[someRecordWithNestedStuff] +Path someRecordWithNestedStuff +[{ + "label": "someRecord", + "kind": 5, + "tags": [], + "detail": "someRecord: someRecord\n\ntype someNestedRecord = {someRecord: someRecord}", + "documentation": null + }] + +Complete src/CompletionInferValues.res 86:103 +posCursor:[86:103] posNoWhite:[86:102] Found expr:[86:92->86:103] +Pexp_field [86:92->86:102] _:[125:0->86:103] +Completable: Cpath Value[someRecord]."" +ContextPath Value[someRecord]."" +ContextPath Value[someRecord] +Path someRecord +ContextPath CPatternPath(Value[x])->recordField(nested)->recordField(someRecord) +ContextPath Value[x] +Path x +ContextPath Type[someRecordWithNestedStuff] +Path someRecordWithNestedStuff +[{ + "label": "name", + "kind": 5, + "tags": [], + "detail": "name: string\n\ntype someRecord = {name: string, age: int}", + "documentation": null + }, { + "label": "age", + "kind": 5, + "tags": [], + "detail": "age: int\n\ntype someRecord = {name: string, age: int}", + "documentation": null + }] + +Complete src/CompletionInferValues.res 90:81 +posCursor:[90:81] posNoWhite:[90:80] Found expr:[90:69->90:81] +Completable: Cpath Value[things]->slic +ContextPath Value[things]->slic +ContextPath Value[things] +Path things +ContextPath CPatternPath(Value[x])->recordField(things) +ContextPath Value[x] +Path x +ContextPath Type[someRecordWithNestedStuff] +Path someRecordWithNestedStuff +CPPipe env:CompletionInferValues +Path Js.String2.slic +[{ + "label": "Js.String2.sliceToEnd", + "kind": 12, + "tags": [], + "detail": "(t, ~from: int) => t", + "documentation": {"kind": "markdown", "value": "\n`sliceToEnd(str, from:n)` returns the substring of `str` starting at character\n`n` to the end of the string.\n- If `n` is negative, then it is evaluated as `length(str - n)`.\n- If `n` is greater than the length of `str`, then sliceToEnd returns the empty string.\n\nSee [`String.slice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/slice) on MDN.\n\n```res example\nJs.String2.sliceToEnd(\"abcdefg\", ~from=4) == \"efg\"\nJs.String2.sliceToEnd(\"abcdefg\", ~from=-2) == \"fg\"\nJs.String2.sliceToEnd(\"abcdefg\", ~from=7) == \"\"\n```\n"} + }, { + "label": "Js.String2.slice", + "kind": 12, + "tags": [], + "detail": "(t, ~from: int, ~to_: int) => t", + "documentation": {"kind": "markdown", "value": "\n`slice(str, from:n1, to_:n2)` returns the substring of `str` starting at\ncharacter `n1` up to but not including `n2`.\n- If either `n1` or `n2` is negative, then it is evaluated as `length(str - n1)` or `length(str - n2)`.\n- If `n2` is greater than the length of `str`, then it is treated as `length(str)`.\n- If `n1` is greater than `n2`, slice returns the empty string.\n\nSee [`String.slice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/slice) on MDN.\n\n```res example\nJs.String2.slice(\"abcdefg\", ~from=2, ~to_=5) == \"cde\"\nJs.String2.slice(\"abcdefg\", ~from=2, ~to_=9) == \"cdefg\"\nJs.String2.slice(\"abcdefg\", ~from=-4, ~to_=-2) == \"de\"\nJs.String2.slice(\"abcdefg\", ~from=5, ~to_=1) == \"\"\n```\n"} + }] + +Complete src/CompletionInferValues.res 94:82 +posCursor:[94:82] posNoWhite:[94:81] Found expr:[94:70->94:82] +Completable: Cpath Value[someInt]->toS +ContextPath Value[someInt]->toS +ContextPath Value[someInt] +Path someInt +ContextPath CPatternPath(Value[x])->recordField(someInt) +ContextPath Value[x] +Path x +ContextPath Type[someRecordWithNestedStuff] +Path someRecordWithNestedStuff +CPPipe env:CompletionInferValues +Path Belt.Int.toS +[{ + "label": "Belt.Int.toString", + "kind": 12, + "tags": [], + "detail": "int => string", + "documentation": {"kind": "markdown", "value": "\n Converts a given `int` to a `string`. Uses the JavaScript `String` constructor under the hood.\n\n ```res example\n Js.log(Belt.Int.toString(1) === \"1\") /* true */\n ```\n"} + }] + +Complete src/CompletionInferValues.res 98:109 +posCursor:[98:109] posNoWhite:[98:108] Found expr:[98:97->98:109] +Completable: Cpath Value[someInt]->toS +ContextPath Value[someInt]->toS +ContextPath Value[someInt] +Path someInt +ContextPath CPatternPath(Value[someTuple])->tuple($1) +ContextPath Value[someTuple] +Path someTuple +ContextPath CPatternPath(Value[x])->recordField(someTuple) +ContextPath Value[x] +Path x +ContextPath Type[otherNestedRecord] +Path otherNestedRecord +CPPipe env:CompletionInferValues +Path Belt.Int.toS +[{ + "label": "Belt.Int.toString", + "kind": 12, + "tags": [], + "detail": "int => string", + "documentation": {"kind": "markdown", "value": "\n Converts a given `int` to a `string`. Uses the JavaScript `String` constructor under the hood.\n\n ```res example\n Js.log(Belt.Int.toString(1) === \"1\") /* true */\n ```\n"} + }] + +Complete src/CompletionInferValues.res 102:102 +posCursor:[102:102] posNoWhite:[102:101] Found expr:[102:57->102:102] +posCursor:[102:102] posNoWhite:[102:101] Found expr:[102:90->102:102] +Completable: Cpath Value[someInt]->toS +ContextPath Value[someInt]->toS +ContextPath Value[someInt] +Path someInt +ContextPath CPatternPath(Value[someTuple])->tuple($1) +ContextPath Value[someTuple] +Path someTuple +ContextPath CPatternPath(Value[x])->recordField(someTuple) +ContextPath Value[x] +Path x +ContextPath Type[otherNestedRecord] +Path otherNestedRecord +CPPipe env:CompletionInferValues +Path Belt.Int.toS +[{ + "label": "Belt.Int.toString", + "kind": 12, + "tags": [], + "detail": "int => string", + "documentation": {"kind": "markdown", "value": "\n Converts a given `int` to a `string`. Uses the JavaScript `String` constructor under the hood.\n\n ```res example\n Js.log(Belt.Int.toString(1) === \"1\") /* true */\n ```\n"} + }] + +Complete src/CompletionInferValues.res 106:88 +posCursor:[106:88] posNoWhite:[106:87] Found expr:[106:79->106:88] +Completable: Cpath Value[str]->slic +ContextPath Value[str]->slic +ContextPath Value[str] +Path str +ContextPath CPatternPath(Value[x])->recordField(someTuple)->tuple($0)->variantPayload::Three($1) +ContextPath Value[x] +Path x +ContextPath Type[otherNestedRecord] +Path otherNestedRecord +CPPipe env:CompletionInferValues +Path Js.String2.slic +[{ + "label": "Js.String2.sliceToEnd", + "kind": 12, + "tags": [], + "detail": "(t, ~from: int) => t", + "documentation": {"kind": "markdown", "value": "\n`sliceToEnd(str, from:n)` returns the substring of `str` starting at character\n`n` to the end of the string.\n- If `n` is negative, then it is evaluated as `length(str - n)`.\n- If `n` is greater than the length of `str`, then sliceToEnd returns the empty string.\n\nSee [`String.slice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/slice) on MDN.\n\n```res example\nJs.String2.sliceToEnd(\"abcdefg\", ~from=4) == \"efg\"\nJs.String2.sliceToEnd(\"abcdefg\", ~from=-2) == \"fg\"\nJs.String2.sliceToEnd(\"abcdefg\", ~from=7) == \"\"\n```\n"} + }, { + "label": "Js.String2.slice", + "kind": 12, + "tags": [], + "detail": "(t, ~from: int, ~to_: int) => t", + "documentation": {"kind": "markdown", "value": "\n`slice(str, from:n1, to_:n2)` returns the substring of `str` starting at\ncharacter `n1` up to but not including `n2`.\n- If either `n1` or `n2` is negative, then it is evaluated as `length(str - n1)` or `length(str - n2)`.\n- If `n2` is greater than the length of `str`, then it is treated as `length(str)`.\n- If `n1` is greater than `n2`, slice returns the empty string.\n\nSee [`String.slice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/slice) on MDN.\n\n```res example\nJs.String2.slice(\"abcdefg\", ~from=2, ~to_=5) == \"cde\"\nJs.String2.slice(\"abcdefg\", ~from=2, ~to_=9) == \"cdefg\"\nJs.String2.slice(\"abcdefg\", ~from=-4, ~to_=-2) == \"de\"\nJs.String2.slice(\"abcdefg\", ~from=5, ~to_=1) == \"\"\n```\n"} + }] + +Complete src/CompletionInferValues.res 110:89 +posCursor:[110:89] posNoWhite:[110:88] Found expr:[110:80->110:89] +Completable: Cpath Value[str]->slic +ContextPath Value[str]->slic +ContextPath Value[str] +Path str +ContextPath CPatternPath(Value[x])->recordField(someTuple)->tuple($2)->polyvariantPayload::three($1) +ContextPath Value[x] +Path x +ContextPath Type[otherNestedRecord] +Path otherNestedRecord +CPPipe env:CompletionInferValues +Path Js.String2.slic +[{ + "label": "Js.String2.sliceToEnd", + "kind": 12, + "tags": [], + "detail": "(t, ~from: int) => t", + "documentation": {"kind": "markdown", "value": "\n`sliceToEnd(str, from:n)` returns the substring of `str` starting at character\n`n` to the end of the string.\n- If `n` is negative, then it is evaluated as `length(str - n)`.\n- If `n` is greater than the length of `str`, then sliceToEnd returns the empty string.\n\nSee [`String.slice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/slice) on MDN.\n\n```res example\nJs.String2.sliceToEnd(\"abcdefg\", ~from=4) == \"efg\"\nJs.String2.sliceToEnd(\"abcdefg\", ~from=-2) == \"fg\"\nJs.String2.sliceToEnd(\"abcdefg\", ~from=7) == \"\"\n```\n"} + }, { + "label": "Js.String2.slice", + "kind": 12, + "tags": [], + "detail": "(t, ~from: int, ~to_: int) => t", + "documentation": {"kind": "markdown", "value": "\n`slice(str, from:n1, to_:n2)` returns the substring of `str` starting at\ncharacter `n1` up to but not including `n2`.\n- If either `n1` or `n2` is negative, then it is evaluated as `length(str - n1)` or `length(str - n2)`.\n- If `n2` is greater than the length of `str`, then it is treated as `length(str)`.\n- If `n1` is greater than `n2`, slice returns the empty string.\n\nSee [`String.slice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/slice) on MDN.\n\n```res example\nJs.String2.slice(\"abcdefg\", ~from=2, ~to_=5) == \"cde\"\nJs.String2.slice(\"abcdefg\", ~from=2, ~to_=9) == \"cdefg\"\nJs.String2.slice(\"abcdefg\", ~from=-4, ~to_=-2) == \"de\"\nJs.String2.slice(\"abcdefg\", ~from=5, ~to_=1) == \"\"\n```\n"} + }] + +Complete src/CompletionInferValues.res 114:80 +posCursor:[114:80] posNoWhite:[114:79] Found expr:[114:70->114:80] +Completable: Cpath Value[name]->slic +ContextPath Value[name]->slic +ContextPath Value[name] +Path name +ContextPath CPatternPath(Value[x])->recordField(optRecord)->variantPayload::Some($0)->recordField(name) +ContextPath Value[x] +Path x +ContextPath Type[otherNestedRecord] +Path otherNestedRecord +CPPipe env:CompletionInferValues +Path Js.String2.slic +[{ + "label": "Js.String2.sliceToEnd", + "kind": 12, + "tags": [], + "detail": "(t, ~from: int) => t", + "documentation": {"kind": "markdown", "value": "\n`sliceToEnd(str, from:n)` returns the substring of `str` starting at character\n`n` to the end of the string.\n- If `n` is negative, then it is evaluated as `length(str - n)`.\n- If `n` is greater than the length of `str`, then sliceToEnd returns the empty string.\n\nSee [`String.slice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/slice) on MDN.\n\n```res example\nJs.String2.sliceToEnd(\"abcdefg\", ~from=4) == \"efg\"\nJs.String2.sliceToEnd(\"abcdefg\", ~from=-2) == \"fg\"\nJs.String2.sliceToEnd(\"abcdefg\", ~from=7) == \"\"\n```\n"} + }, { + "label": "Js.String2.slice", + "kind": 12, + "tags": [], + "detail": "(t, ~from: int, ~to_: int) => t", + "documentation": {"kind": "markdown", "value": "\n`slice(str, from:n1, to_:n2)` returns the substring of `str` starting at\ncharacter `n1` up to but not including `n2`.\n- If either `n1` or `n2` is negative, then it is evaluated as `length(str - n1)` or `length(str - n2)`.\n- If `n2` is greater than the length of `str`, then it is treated as `length(str)`.\n- If `n1` is greater than `n2`, slice returns the empty string.\n\nSee [`String.slice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/slice) on MDN.\n\n```res example\nJs.String2.slice(\"abcdefg\", ~from=2, ~to_=5) == \"cde\"\nJs.String2.slice(\"abcdefg\", ~from=2, ~to_=9) == \"cdefg\"\nJs.String2.slice(\"abcdefg\", ~from=-4, ~to_=-2) == \"de\"\nJs.String2.slice(\"abcdefg\", ~from=5, ~to_=1) == \"\"\n```\n"} + }] + +Complete src/CompletionInferValues.res 118:67 +posCursor:[118:67] posNoWhite:[118:66] Found expr:[118:60->118:67] +Pexp_field [118:60->118:65] s:[118:66->118:67] +Completable: Cpath Value[inner].s +ContextPath Value[inner].s +ContextPath Value[inner] +Path inner +ContextPath CPatternPath(Value[x])->array +ContextPath Value[x] +Path x +ContextPath array +ContextPath Type[otherNestedRecord] +Path otherNestedRecord +[{ + "label": "someRecord", + "kind": 5, + "tags": [], + "detail": "someRecord: someRecord\n\ntype otherNestedRecord = {someRecord: someRecord, someTuple: (someVariant, int, somePolyVariant), optRecord: option}", + "documentation": null + }, { + "label": "someTuple", + "kind": 5, + "tags": [], + "detail": "someTuple: (someVariant, int, somePolyVariant)\n\ntype otherNestedRecord = {someRecord: someRecord, someTuple: (someVariant, int, somePolyVariant), optRecord: option}", + "documentation": null + }] + +Complete src/CompletionInferValues.res 122:53 +posCursor:[122:53] posNoWhite:[122:52] Found expr:[122:46->122:53] +Completable: Cpath Value[v]->toSt +ContextPath Value[v]->toSt +ContextPath Value[v] +Path v +ContextPath Value[x] +Path x +ContextPath int +CPPipe env:CompletionInferValues +Path Belt.Int.toSt +[{ + "label": "Belt.Int.toString", + "kind": 12, + "tags": [], + "detail": "int => string", + "documentation": {"kind": "markdown", "value": "\n Converts a given `int` to a `string`. Uses the JavaScript `String` constructor under the hood.\n\n ```res example\n Js.log(Belt.Int.toString(1) === \"1\") /* true */\n ```\n"} + }] + +Complete src/CompletionInferValues.res 130:26 +posCursor:[130:26] posNoWhite:[130:25] Found expr:[130:3->130:37] +Pexp_apply ...[130:3->130:23] (...[130:24->130:36]) +posCursor:[130:26] posNoWhite:[130:25] Found expr:[130:24->130:36] +posCursor:[130:26] posNoWhite:[130:25] Found pattern:[130:25->130:27] +posCursor:[130:26] posNoWhite:[130:25] Found pattern:[130:25->130:27] +Completable: Cpattern CArgument CArgument Value[fnWithRecordCallback]($0)($0)->recordBody +ContextPath CArgument CArgument Value[fnWithRecordCallback]($0)($0) +ContextPath CArgument Value[fnWithRecordCallback]($0) +ContextPath Value[fnWithRecordCallback] +Path fnWithRecordCallback +[{ + "label": "name", + "kind": 5, + "tags": [], + "detail": "name: string\n\nsomeRecord", + "documentation": null + }, { + "label": "age", + "kind": 5, + "tags": [], + "detail": "age: int\n\nsomeRecord", + "documentation": null + }] + +Complete src/CompletionInferValues.res 137:30 +posCursor:[137:30] posNoWhite:[137:29] Found expr:[137:3->137:33] +Pexp_apply ...[137:3->137:6] (~cb137:8->137:10=...[137:11->137:32]) +posCursor:[137:30] posNoWhite:[137:29] Found expr:[137:11->137:32] +posCursor:[137:30] posNoWhite:[137:29] Found expr:[137:24->0:-1] +posCursor:[137:30] posNoWhite:[137:29] Found expr:[137:24->0:-1] +Completable: Cpath Value[root]-> +ContextPath Value[root]-> +ContextPath Value[root] +Path root +ContextPath CPatternPath(CArgument CArgument Value[fn2](~cb)($0))->recordField(root) +ContextPath CArgument CArgument Value[fn2](~cb)($0) +ContextPath CArgument Value[fn2](~cb) +ContextPath Value[fn2] +Path fn2 +CPPipe env:CompletionInferValues +CPPipe type path:ReactDOM.Client.Root.t +CPPipe pathFromEnv:ReactDOM.Client.Root found:false +Path ReactDOM.Client.Root. +[{ + "label": "ReactDOM.Client.Root.unmount", + "kind": 12, + "tags": [], + "detail": "(t, unit) => unit", + "documentation": null + }, { + "label": "ReactDOM.Client.Root.render", + "kind": 12, + "tags": [], + "detail": "(t, React.element) => unit", + "documentation": null + }] + +Complete src/CompletionInferValues.res 146:30 +posCursor:[146:30] posNoWhite:[146:29] Found expr:[146:3->146:33] +Pexp_apply ...[146:3->146:6] (~cb146:8->146:10=...[146:11->146:32]) +posCursor:[146:30] posNoWhite:[146:29] Found expr:[146:11->146:32] +posCursor:[146:30] posNoWhite:[146:29] Found expr:[146:24->0:-1] +posCursor:[146:30] posNoWhite:[146:29] Found expr:[146:24->0:-1] +Completable: Cpath Value[root]-> +ContextPath Value[root]-> +ContextPath Value[root] +Path root +ContextPath CPatternPath(CArgument CArgument Value[fn3](~cb)($0))->recordField(root) +ContextPath CArgument CArgument Value[fn3](~cb)($0) +ContextPath CArgument Value[fn3](~cb) +ContextPath Value[fn3] +Path fn3 +CPPipe env:CompletionInferValues +CPPipe type path:CompletionSupport.Test.t +CPPipe pathFromEnv:CompletionSupport.Test found:false +Path CompletionSupport.Test. +[{ + "label": "CompletionSupport.Test.add", + "kind": 12, + "tags": [], + "detail": "t => int", + "documentation": null + }, { + "label": "CompletionSupport.Test.addSelf", + "kind": 12, + "tags": [], + "detail": "t => t", + "documentation": null + }, { + "label": "CompletionSupport.Test.make", + "kind": 12, + "tags": [], + "detail": "int => t", + "documentation": null + }] + +Complete src/CompletionInferValues.res 150:47 +XXX Not found! +Completable: Cpattern Value[Belt, Int, toString](Nolabel) +ContextPath Value[Belt, Int, toString](Nolabel) +ContextPath Value[Belt, Int, toString] +Path Belt.Int.toString +[{ + "label": "\"\"", + "kind": 12, + "tags": [], + "detail": "string", + "documentation": null, + "sortText": "A", + "insertText": "\"$0\"", + "insertTextFormat": 2 + }] + +Complete src/CompletionInferValues.res 154:70 +XXX Not found! +Completable: Cpattern Value[Js, String2, split](Nolabel, Nolabel) +ContextPath Value[Js, String2, split](Nolabel, Nolabel) +ContextPath Value[Js, String2, split] +Path Js.String2.split +[{ + "label": "[]", + "kind": 12, + "tags": [], + "detail": "t", + "documentation": null, + "sortText": "A", + "insertText": "[$0]", + "insertTextFormat": 2 + }] + +Complete src/CompletionInferValues.res 158:105 +posCursor:[158:105] posNoWhite:[158:104] Found expr:[158:18->158:110] +Pexp_apply ...[158:18->158:49] (~prepare158:51->158:58=...[158:59->158:72], ~render158:74->158:80=...[158:81->158:106], ...[158:107->158:109]) +posCursor:[158:105] posNoWhite:[158:104] Found expr:[158:81->158:106] +posCursor:[158:105] posNoWhite:[158:104] Found expr:[158:97->158:105] +Pexp_field [158:97->158:104] _:[158:105->158:105] +Completable: Cpath Value[support]."" +ContextPath Value[support]."" +ContextPath Value[support] +Path support +ContextPath CPatternPath(CArgument CArgument Value[CompletionSupport2, makeRenderer](~render)($0))->recordField(support) +ContextPath CArgument CArgument Value[CompletionSupport2, makeRenderer](~render)($0) +ContextPath CArgument Value[CompletionSupport2, makeRenderer](~render) +ContextPath Value[CompletionSupport2, makeRenderer] +Path CompletionSupport2.makeRenderer +[{ + "label": "root", + "kind": 5, + "tags": [], + "detail": "root: ReactDOM.Client.Root.t\n\ntype config = {root: ReactDOM.Client.Root.t}", + "documentation": null + }] + +Complete src/CompletionInferValues.res 162:110 +posCursor:[162:110] posNoWhite:[162:109] Found expr:[162:18->162:115] +Pexp_apply ...[162:18->162:49] (~prepare162:51->162:58=...[162:59->162:72], ~render162:74->162:80=...[162:81->162:111], ...[162:112->162:114]) +posCursor:[162:110] posNoWhite:[162:109] Found expr:[162:81->162:111] +posCursor:[162:110] posNoWhite:[162:109] Found expr:[162:104->0:-1] +posCursor:[162:110] posNoWhite:[162:109] Found expr:[162:104->0:-1] +Completable: Cpath Value[root]-> +ContextPath Value[root]-> +ContextPath Value[root] +Path root +ContextPath CPatternPath(CArgument CArgument Value[CompletionSupport2, makeRenderer](~render)($0))->recordField(support)->recordField(root) +ContextPath CArgument CArgument Value[CompletionSupport2, makeRenderer](~render)($0) +ContextPath CArgument Value[CompletionSupport2, makeRenderer](~render) +ContextPath Value[CompletionSupport2, makeRenderer] +Path CompletionSupport2.makeRenderer +CPPipe env:CompletionInferValues envFromCompletionItem:CompletionSupport2.Internal +CPPipe type path:ReactDOM.Client.Root.t +CPPipe pathFromEnv:ReactDOM.Client.Root found:false +Path ReactDOM.Client.Root. +[{ + "label": "ReactDOM.Client.Root.unmount", + "kind": 12, + "tags": [], + "detail": "(t, unit) => unit", + "documentation": null + }, { + "label": "ReactDOM.Client.Root.render", + "kind": 12, + "tags": [], + "detail": "(t, React.element) => unit", + "documentation": null + }] + diff --git a/analysis/tests/src/expected/CompletionJsx.res.txt b/analysis/tests/src/expected/CompletionJsx.res.txt index aae7edac3..3559b81ef 100644 --- a/analysis/tests/src/expected/CompletionJsx.res.txt +++ b/analysis/tests/src/expected/CompletionJsx.res.txt @@ -1,6 +1,11 @@ Complete src/CompletionJsx.res 3:17 posCursor:[3:17] posNoWhite:[3:16] Found expr:[3:3->3:17] Completable: Cpath Value[someString]->st +ContextPath Value[someString]->st +ContextPath Value[someString] +Path someString +CPPipe env:CompletionJsx +Path Js.String2.st [{ "label": "Js.String2.startsWith", "kind": 12, @@ -24,6 +29,11 @@ posCursor:[13:21] posNoWhite:[13:20] Found expr:[12:4->32:10] posCursor:[13:21] posNoWhite:[13:20] Found expr:[13:7->32:10] posCursor:[13:21] posNoWhite:[13:20] Found expr:[13:7->13:21] Completable: Cpath Value[someString]->st <> +ContextPath Value[someString]->st <> +ContextPath Value[someString] +Path someString +CPPipe env:CompletionJsx +Path Js.String2.st [{ "label": "React.string", "kind": 12, @@ -65,6 +75,11 @@ Pexp_construct :::[18:10->32:4] [18:10->32:4] posCursor:[18:24] posNoWhite:[18:23] Found expr:[18:10->32:4] posCursor:[18:24] posNoWhite:[18:23] Found expr:[18:10->18:24] Completable: Cpath Value[someString]->st <> +ContextPath Value[someString]->st <> +ContextPath Value[someString] +Path someString +CPPipe env:CompletionJsx +Path Js.String2.st [{ "label": "React.string", "kind": 12, @@ -106,6 +121,10 @@ Pexp_construct :::[20:10->32:4] [20:10->32:4] posCursor:[20:27] posNoWhite:[20:26] Found expr:[20:10->32:4] posCursor:[20:27] posNoWhite:[20:26] Found expr:[20:10->20:27] Completable: Cpath string->st <> +ContextPath string->st <> +ContextPath string +CPPipe env:CompletionJsx +Path Js.String2.st [{ "label": "React.string", "kind": 12, @@ -147,6 +166,12 @@ Pexp_construct :::[22:10->32:4] [22:10->32:4] posCursor:[22:44] posNoWhite:[22:43] Found expr:[22:10->32:4] posCursor:[22:44] posNoWhite:[22:43] Found expr:[22:10->22:44] Completable: Cpath Value[Js, String2, trim](Nolabel)->st <> +ContextPath Value[Js, String2, trim](Nolabel)->st <> +ContextPath Value[Js, String2, trim](Nolabel) +ContextPath Value[Js, String2, trim] +Path Js.String2.trim +CPPipe env:CompletionJsx envFromCompletionItem:Js_string2 +Path Js.String2.st [{ "label": "React.string", "kind": 12, @@ -188,6 +213,11 @@ Pexp_construct :::[24:10->32:4] [24:10->32:4] posCursor:[24:19] posNoWhite:[24:18] Found expr:[24:10->32:4] posCursor:[24:19] posNoWhite:[24:18] Found expr:[24:10->0:-1] Completable: Cpath Value[someInt]-> <> +ContextPath Value[someInt]-> <> +ContextPath Value[someInt] +Path someInt +CPPipe env:CompletionJsx +Path Belt.Int. [{ "label": "React.int", "kind": 12, @@ -265,6 +295,10 @@ Pexp_construct :::[26:10->32:4] [26:10->32:4] posCursor:[26:14] posNoWhite:[26:13] Found expr:[26:10->32:4] posCursor:[26:14] posNoWhite:[26:13] Found expr:[26:10->0:-1] Completable: Cpath int-> <> +ContextPath int-> <> +ContextPath int +CPPipe env:CompletionJsx +Path Belt.Int. [{ "label": "React.int", "kind": 12, @@ -342,6 +376,11 @@ Pexp_construct :::[28:10->32:4] [28:10->32:4] posCursor:[28:20] posNoWhite:[28:19] Found expr:[28:10->32:4] posCursor:[28:20] posNoWhite:[28:19] Found expr:[28:10->28:20] Completable: Cpath Value[someArr]->a <> +ContextPath Value[someArr]->a <> +ContextPath Value[someArr] +Path someArr +CPPipe env:CompletionJsx +Path Js.Array2.a [{ "label": "React.array", "kind": 12, @@ -405,6 +444,7 @@ Complete src/CompletionJsx.res 45:23 posCursor:[45:23] posNoWhite:[45:22] Found expr:[45:4->45:23] JSX 45:21] n[45:22->45:23]=...[45:22->45:23]> _children:None Completable: Cjsx([CompWithoutJsxPpx], n, [n]) +Path CompWithoutJsxPpx.make [{ "label": "name", "kind": 4, diff --git a/analysis/tests/src/expected/CompletionJsxProps.res.txt b/analysis/tests/src/expected/CompletionJsxProps.res.txt index 45885f535..f424a3c10 100644 --- a/analysis/tests/src/expected/CompletionJsxProps.res.txt +++ b/analysis/tests/src/expected/CompletionJsxProps.res.txt @@ -2,6 +2,8 @@ Complete src/CompletionJsxProps.res 0:47 posCursor:[0:47] posNoWhite:[0:46] Found expr:[0:12->0:47] JSX 0:43] on[0:44->0:46]=...__ghost__[0:-1->0:-1]> _children:None Completable: Cexpression CJsxPropValue [CompletionSupport, TestComponent] on +ContextPath CJsxPropValue [CompletionSupport, TestComponent] on +Path CompletionSupport.TestComponent.make [{ "label": "true", "kind": 4, @@ -20,6 +22,8 @@ Complete src/CompletionJsxProps.res 3:48 posCursor:[3:48] posNoWhite:[3:47] Found expr:[3:12->3:48] JSX 3:43] on[3:44->3:46]=...[3:47->3:48]> _children:None Completable: Cexpression CJsxPropValue [CompletionSupport, TestComponent] on=t +ContextPath CJsxPropValue [CompletionSupport, TestComponent] on +Path CompletionSupport.TestComponent.make [{ "label": "true", "kind": 4, @@ -32,6 +36,8 @@ Complete src/CompletionJsxProps.res 6:50 posCursor:[6:50] posNoWhite:[6:49] Found expr:[6:12->6:50] JSX 6:43] test[6:44->6:48]=...[6:49->6:50]> _children:None Completable: Cexpression CJsxPropValue [CompletionSupport, TestComponent] test=T +ContextPath CJsxPropValue [CompletionSupport, TestComponent] test +Path CompletionSupport.TestComponent.make [{ "label": "Two", "kind": 4, @@ -68,6 +74,8 @@ Complete src/CompletionJsxProps.res 9:52 posCursor:[9:52] posNoWhite:[9:51] Found expr:[9:12->9:52] JSX 9:43] polyArg[9:44->9:51]=...__ghost__[0:-1->0:-1]> _children:None Completable: Cexpression CJsxPropValue [CompletionSupport, TestComponent] polyArg +ContextPath CJsxPropValue [CompletionSupport, TestComponent] polyArg +Path CompletionSupport.TestComponent.make [{ "label": "#one", "kind": 4, @@ -106,6 +114,8 @@ Complete src/CompletionJsxProps.res 12:54 posCursor:[12:54] posNoWhite:[12:53] Found expr:[12:12->12:54] JSX 12:43] polyArg[12:44->12:51]=...[12:52->12:54]> _children:None Completable: Cexpression CJsxPropValue [CompletionSupport, TestComponent] polyArg=#t +ContextPath CJsxPropValue [CompletionSupport, TestComponent] polyArg +Path CompletionSupport.TestComponent.make [{ "label": "#three(_, _)", "kind": 4, @@ -136,6 +146,9 @@ Complete src/CompletionJsxProps.res 15:22 posCursor:[15:22] posNoWhite:[15:21] Found expr:[15:12->15:25] JSX 15:15] muted[15:16->15:21]=...__ghost__[0:-1->0:-1]> _children:15:23 Completable: Cexpression CJsxPropValue [div] muted +ContextPath CJsxPropValue [div] muted +Path ReactDOM.domProps +Path JsxDOM.domProps [{ "label": "true", "kind": 4, @@ -154,6 +167,9 @@ Complete src/CompletionJsxProps.res 18:29 posCursor:[18:29] posNoWhite:[18:28] Found expr:[18:12->18:32] JSX 18:15] onMouseEnter[18:16->18:28]=...__ghost__[0:-1->0:-1]> _children:18:30 Completable: Cexpression CJsxPropValue [div] onMouseEnter +ContextPath CJsxPropValue [div] onMouseEnter +Path ReactDOM.domProps +Path JsxDOM.domProps [{ "label": "event => {}", "kind": 12, @@ -169,11 +185,13 @@ Complete src/CompletionJsxProps.res 22:52 posCursor:[22:52] posNoWhite:[22:51] Found expr:[22:12->22:52] JSX 22:43] testArr[22:44->22:51]=...__ghost__[0:-1->0:-1]> _children:None Completable: Cexpression CJsxPropValue [CompletionSupport, TestComponent] testArr +ContextPath CJsxPropValue [CompletionSupport, TestComponent] testArr +Path CompletionSupport.TestComponent.make [{ "label": "[]", "kind": 12, "tags": [], - "detail": "type testVariant = One | Two | Three(int)", + "detail": "testVariant", "documentation": null, "sortText": "A", "insertText": "{[$0]}", @@ -184,6 +202,8 @@ Complete src/CompletionJsxProps.res 26:54 posCursor:[26:54] posNoWhite:[26:53] Found expr:[26:12->26:56] JSX 26:43] testArr[26:44->26:51]=...[26:53->26:55]> _children:None Completable: Cexpression CJsxPropValue [CompletionSupport, TestComponent] testArr->array +ContextPath CJsxPropValue [CompletionSupport, TestComponent] testArr +Path CompletionSupport.TestComponent.make [{ "label": "One", "kind": 4, diff --git a/analysis/tests/src/expected/CompletionPattern.res.txt b/analysis/tests/src/expected/CompletionPattern.res.txt index e935e98ca..42a22d085 100644 --- a/analysis/tests/src/expected/CompletionPattern.res.txt +++ b/analysis/tests/src/expected/CompletionPattern.res.txt @@ -5,6 +5,8 @@ posCursor:[7:13] posNoWhite:[7:12] Found expr:[7:3->7:13] Complete src/CompletionPattern.res 10:15 XXX Not found! Completable: Cpattern Value[v] +ContextPath Value[v] +Path v [{ "label": "(_, _, _)", "kind": 12, @@ -16,10 +18,11 @@ Completable: Cpattern Value[v] }] Complete src/CompletionPattern.res 13:18 -posCursor:[13:18] posNoWhite:[13:17] Found expr:[13:3->13:24] posCursor:[13:18] posNoWhite:[13:17] Found pattern:[13:16->13:22] posCursor:[13:18] posNoWhite:[13:17] Found pattern:[13:17->13:18] Completable: Cpattern Value[v]=t->tuple($0) +ContextPath Value[v] +Path v [{ "label": "true", "kind": 4, @@ -29,11 +32,12 @@ Completable: Cpattern Value[v]=t->tuple($0) }] Complete src/CompletionPattern.res 16:25 -posCursor:[16:25] posNoWhite:[16:24] Found expr:[16:3->16:32] posCursor:[16:25] posNoWhite:[16:24] Found pattern:[16:16->16:30] posCursor:[16:25] posNoWhite:[16:24] Found pattern:[16:23->16:29] posCursor:[16:25] posNoWhite:[16:24] Found pattern:[16:24->16:25] Completable: Cpattern Value[v]=f->tuple($2), tuple($0) +ContextPath Value[v] +Path v [{ "label": "false", "kind": 4, @@ -45,6 +49,8 @@ Completable: Cpattern Value[v]=f->tuple($2), tuple($0) Complete src/CompletionPattern.res 21:15 XXX Not found! Completable: Cpattern Value[x] +ContextPath Value[x] +Path x [{ "label": "true", "kind": 4, @@ -60,9 +66,10 @@ Completable: Cpattern Value[x] }] Complete src/CompletionPattern.res 24:17 -posCursor:[24:17] posNoWhite:[24:16] Found expr:[24:3->24:17] posCursor:[24:17] posNoWhite:[24:16] Found pattern:[24:16->24:17] Completable: Cpattern Value[x]=t +ContextPath Value[x] +Path x [{ "label": "true", "kind": 4, @@ -74,6 +81,8 @@ Completable: Cpattern Value[x]=t Complete src/CompletionPattern.res 46:15 XXX Not found! Completable: Cpattern Value[f] +ContextPath Value[f] +Path f [{ "label": "{}", "kind": 22, @@ -86,9 +95,10 @@ Completable: Cpattern Value[f] }] Complete src/CompletionPattern.res 49:17 -posCursor:[49:17] posNoWhite:[49:16] Found expr:[49:3->49:19] posCursor:[49:17] posNoWhite:[49:16] Found pattern:[49:16->49:18] Completable: Cpattern Value[f]->recordBody +ContextPath Value[f] +Path f [{ "label": "first", "kind": 5, @@ -116,9 +126,10 @@ Completable: Cpattern Value[f]->recordBody }] Complete src/CompletionPattern.res 52:24 -posCursor:[52:24] posNoWhite:[52:22] Found expr:[52:3->52:36] posCursor:[52:24] posNoWhite:[52:22] Found pattern:[52:16->52:35] Completable: Cpattern Value[f]->recordBody +ContextPath Value[f] +Path f [{ "label": "optThird", "kind": 5, @@ -134,10 +145,11 @@ Completable: Cpattern Value[f]->recordBody }] Complete src/CompletionPattern.res 55:19 -posCursor:[55:19] posNoWhite:[55:18] Found expr:[55:3->55:21] posCursor:[55:19] posNoWhite:[55:18] Found pattern:[55:16->55:20] posCursor:[55:19] posNoWhite:[55:18] Found pattern:[55:17->55:19] Completable: Cpattern Value[f]=fi->recordBody +ContextPath Value[f] +Path f [{ "label": "first", "kind": 5, @@ -147,11 +159,12 @@ Completable: Cpattern Value[f]=fi->recordBody }] Complete src/CompletionPattern.res 58:19 -posCursor:[58:19] posNoWhite:[58:18] Found expr:[58:3->58:25] posCursor:[58:19] posNoWhite:[58:18] Found pattern:[58:16->58:24] posCursor:[58:19] posNoWhite:[58:18] Found pattern:[58:17->58:20] posCursor:[58:19] posNoWhite:[58:18] Found pattern:[58:18->58:19] Completable: Cpattern Value[z]=o->tuple($0), recordBody +ContextPath Value[z] +Path z [{ "label": "optThird", "kind": 5, @@ -161,9 +174,10 @@ Completable: Cpattern Value[z]=o->tuple($0), recordBody }] Complete src/CompletionPattern.res 61:22 -posCursor:[61:22] posNoWhite:[61:21] Found expr:[61:3->74:1] posCursor:[61:22] posNoWhite:[61:21] Found pattern:[61:16->61:25] Completable: Cpattern Value[f]->recordField(nest) +ContextPath Value[f] +Path f [{ "label": "{}", "kind": 22, @@ -176,10 +190,11 @@ Completable: Cpattern Value[f]->recordField(nest) }] Complete src/CompletionPattern.res 64:24 -posCursor:[64:24] posNoWhite:[64:23] Found expr:[64:3->64:27] posCursor:[64:24] posNoWhite:[64:23] Found pattern:[64:16->64:26] posCursor:[64:24] posNoWhite:[64:23] Found pattern:[64:23->64:25] Completable: Cpattern Value[f]->recordField(nest), recordBody +ContextPath Value[f] +Path f [{ "label": "nested", "kind": 5, @@ -189,12 +204,12 @@ Completable: Cpattern Value[f]->recordField(nest), recordBody }] Complete src/CompletionPattern.res 70:22 -posCursor:[70:22] posNoWhite:[70:21] Found expr:[67:8->74:1] posCursor:[70:22] posNoWhite:[70:21] Found expr:[69:2->72:13] posCursor:[70:22] posNoWhite:[70:21] Found expr:[70:5->72:13] -posCursor:[70:22] posNoWhite:[70:21] Found expr:[70:5->70:24] posCursor:[70:22] posNoWhite:[70:21] Found pattern:[70:21->70:23] Completable: Cpattern Value[nest]->recordBody +ContextPath Value[nest] +Path nest [{ "label": "nested", "kind": 5, @@ -206,6 +221,8 @@ Completable: Cpattern Value[nest]->recordBody Complete src/CompletionPattern.res 76:8 posCursor:[76:8] posNoWhite:[76:7] Found pattern:[76:7->76:9] Completable: Cpattern Value[f]->recordBody +ContextPath Value[f] +Path f [{ "label": "first", "kind": 5, @@ -237,6 +254,8 @@ posCursor:[79:16] posNoWhite:[79:15] Found pattern:[79:7->79:18] posCursor:[79:16] posNoWhite:[79:15] Found pattern:[79:14->79:17] posCursor:[79:16] posNoWhite:[79:15] Found pattern:[79:15->79:16] Completable: Cpattern Value[f]=n->recordField(nest), recordBody +ContextPath Value[f] +Path f [{ "label": "nested", "kind": 5, @@ -246,12 +265,13 @@ Completable: Cpattern Value[f]=n->recordField(nest), recordBody }] Complete src/CompletionPattern.res 87:20 -posCursor:[87:20] posNoWhite:[87:19] Found expr:[87:3->87:22] posCursor:[87:20] posNoWhite:[87:19] Found pattern:[87:16->87:21] Ppat_construct Two:[87:16->87:19] posCursor:[87:20] posNoWhite:[87:19] Found pattern:[87:19->87:21] Ppat_construct ():[87:19->87:21] Completable: Cpattern Value[z]->variantPayload::Two($0) +ContextPath Value[z] +Path z [{ "label": "true", "kind": 4, @@ -267,11 +287,12 @@ Completable: Cpattern Value[z]->variantPayload::Two($0) }] Complete src/CompletionPattern.res 90:21 -posCursor:[90:21] posNoWhite:[90:20] Found expr:[90:3->90:23] posCursor:[90:21] posNoWhite:[90:20] Found pattern:[90:16->90:22] Ppat_construct Two:[90:16->90:19] posCursor:[90:21] posNoWhite:[90:20] Found pattern:[90:20->90:21] Completable: Cpattern Value[z]=t->variantPayload::Two($0) +ContextPath Value[z] +Path z [{ "label": "true", "kind": 4, @@ -281,11 +302,12 @@ Completable: Cpattern Value[z]=t->variantPayload::Two($0) }] Complete src/CompletionPattern.res 93:23 -posCursor:[93:23] posNoWhite:[93:22] Found expr:[93:3->93:26] posCursor:[93:23] posNoWhite:[93:22] Found pattern:[93:16->93:25] Ppat_construct Three:[93:16->93:21] posCursor:[93:23] posNoWhite:[93:22] Found pattern:[93:22->93:24] Completable: Cpattern Value[z]->variantPayload::Three($0), recordBody +ContextPath Value[z] +Path z [{ "label": "first", "kind": 5, @@ -313,12 +335,13 @@ Completable: Cpattern Value[z]->variantPayload::Three($0), recordBody }] Complete src/CompletionPattern.res 96:27 -posCursor:[96:27] posNoWhite:[96:26] Found expr:[96:3->96:29] posCursor:[96:27] posNoWhite:[96:26] Found pattern:[96:16->96:28] Ppat_construct Three:[96:16->96:21] posCursor:[96:27] posNoWhite:[96:26] Found pattern:[96:21->96:29] posCursor:[96:27] posNoWhite:[96:26] Found pattern:[96:26->96:27] Completable: Cpattern Value[z]=t->variantPayload::Three($1) +ContextPath Value[z] +Path z [{ "label": "true", "kind": 4, @@ -328,11 +351,12 @@ Completable: Cpattern Value[z]=t->variantPayload::Three($1) }] Complete src/CompletionPattern.res 103:21 -posCursor:[103:21] posNoWhite:[103:20] Found expr:[103:3->103:23] posCursor:[103:21] posNoWhite:[103:20] Found pattern:[103:16->103:22] posCursor:[103:21] posNoWhite:[103:20] Found pattern:[103:20->103:21] Ppat_construct ():[103:20->103:21] Completable: Cpattern Value[b]->polyvariantPayload::two($0) +ContextPath Value[b] +Path b [{ "label": "true", "kind": 4, @@ -348,10 +372,11 @@ Completable: Cpattern Value[b]->polyvariantPayload::two($0) }] Complete src/CompletionPattern.res 106:22 -posCursor:[106:22] posNoWhite:[106:21] Found expr:[106:3->106:24] posCursor:[106:22] posNoWhite:[106:21] Found pattern:[106:16->106:23] posCursor:[106:22] posNoWhite:[106:21] Found pattern:[106:21->106:22] Completable: Cpattern Value[b]=t->polyvariantPayload::two($0) +ContextPath Value[b] +Path b [{ "label": "true", "kind": 4, @@ -361,10 +386,11 @@ Completable: Cpattern Value[b]=t->polyvariantPayload::two($0) }] Complete src/CompletionPattern.res 109:24 -posCursor:[109:24] posNoWhite:[109:23] Found expr:[109:3->109:27] posCursor:[109:24] posNoWhite:[109:23] Found pattern:[109:16->109:26] posCursor:[109:24] posNoWhite:[109:23] Found pattern:[109:23->109:25] Completable: Cpattern Value[b]->polyvariantPayload::three($0), recordBody +ContextPath Value[b] +Path b [{ "label": "first", "kind": 5, @@ -392,11 +418,12 @@ Completable: Cpattern Value[b]->polyvariantPayload::three($0), recordBody }] Complete src/CompletionPattern.res 112:28 -posCursor:[112:28] posNoWhite:[112:27] Found expr:[112:3->112:30] posCursor:[112:28] posNoWhite:[112:27] Found pattern:[112:16->112:29] posCursor:[112:28] posNoWhite:[112:27] Found pattern:[112:22->112:29] posCursor:[112:28] posNoWhite:[112:27] Found pattern:[112:27->112:28] Completable: Cpattern Value[b]=t->polyvariantPayload::three($1) +ContextPath Value[b] +Path b [{ "label": "true", "kind": 4, @@ -408,9 +435,11 @@ Completable: Cpattern Value[b]=t->polyvariantPayload::three($1) Complete src/CompletionPattern.res 118:15 XXX Not found! Completable: Cpattern Value[c] +ContextPath Value[c] +Path c [{ "label": "[]", - "kind": 22, + "kind": 12, "tags": [], "detail": "bool", "documentation": null, @@ -420,9 +449,10 @@ Completable: Cpattern Value[c] }] Complete src/CompletionPattern.res 121:17 -posCursor:[121:17] posNoWhite:[121:16] Found expr:[121:3->121:20] posCursor:[121:17] posNoWhite:[121:16] Found pattern:[121:16->121:18] Completable: Cpattern Value[c]->array +ContextPath Value[c] +Path c [{ "label": "true", "kind": 4, @@ -438,12 +468,13 @@ Completable: Cpattern Value[c]->array }] Complete src/CompletionPattern.res 127:21 -posCursor:[127:21] posNoWhite:[127:20] Found expr:[127:3->127:24] posCursor:[127:21] posNoWhite:[127:20] Found pattern:[127:16->127:22] Ppat_construct Some:[127:16->127:20] posCursor:[127:21] posNoWhite:[127:20] Found pattern:[127:20->127:22] Ppat_construct ():[127:20->127:22] Completable: Cpattern Value[o]->variantPayload::Some($0) +ContextPath Value[o] +Path o [{ "label": "true", "kind": 4, @@ -459,10 +490,11 @@ Completable: Cpattern Value[o]->variantPayload::Some($0) }] Complete src/CompletionPattern.res 134:23 -posCursor:[134:23] posNoWhite:[134:22] Found expr:[134:3->134:26] posCursor:[134:23] posNoWhite:[134:22] Found pattern:[134:16->134:25] Ppat_construct Test:[134:16->134:20] Completable: Cpattern Value[p]->variantPayload::Test($1) +ContextPath Value[p] +Path p [{ "label": "true", "kind": 4, @@ -478,20 +510,21 @@ Completable: Cpattern Value[p]->variantPayload::Test($1) }] Complete src/CompletionPattern.res 137:29 -posCursor:[137:29] posNoWhite:[137:28] Found expr:[137:3->137:32] posCursor:[137:29] posNoWhite:[137:28] Found pattern:[137:16->137:31] Ppat_construct Test:[137:16->137:20] posCursor:[137:29] posNoWhite:[137:28] Found pattern:[137:20->137:32] Completable: Cpattern Value[p]->variantPayload::Test($2) +ContextPath Value[p] +Path p [{ "label": "None", - "kind": 4, + "kind": 12, "tags": [], "detail": "bool", "documentation": null }, { "label": "Some(_)", - "kind": 4, + "kind": 12, "tags": [], "detail": "bool", "documentation": null, @@ -512,11 +545,12 @@ Completable: Cpattern Value[p]->variantPayload::Test($2) }] Complete src/CompletionPattern.res 140:23 -posCursor:[140:23] posNoWhite:[140:22] Found expr:[140:3->140:32] posCursor:[140:23] posNoWhite:[140:22] Found pattern:[140:16->140:31] Ppat_construct Test:[140:16->140:20] posCursor:[140:23] posNoWhite:[140:22] Found pattern:[140:20->140:32] Completable: Cpattern Value[p]->variantPayload::Test($1) +ContextPath Value[p] +Path p [{ "label": "true", "kind": 4, @@ -532,14 +566,15 @@ Completable: Cpattern Value[p]->variantPayload::Test($1) }] Complete src/CompletionPattern.res 143:35 -posCursor:[143:35] posNoWhite:[143:34] Found expr:[143:3->143:38] posCursor:[143:35] posNoWhite:[143:34] Found pattern:[143:16->143:37] Ppat_construct Test:[143:16->143:20] posCursor:[143:35] posNoWhite:[143:34] Found pattern:[143:20->143:38] Completable: Cpattern Value[p]->variantPayload::Test($3) +ContextPath Value[p] +Path p [{ "label": "[]", - "kind": 22, + "kind": 12, "tags": [], "detail": "bool", "documentation": null, @@ -549,9 +584,10 @@ Completable: Cpattern Value[p]->variantPayload::Test($3) }] Complete src/CompletionPattern.res 150:24 -posCursor:[150:24] posNoWhite:[150:23] Found expr:[150:3->150:27] posCursor:[150:24] posNoWhite:[150:23] Found pattern:[150:16->150:26] Completable: Cpattern Value[v]->polyvariantPayload::test($1) +ContextPath Value[v] +Path v [{ "label": "true", "kind": 4, @@ -567,19 +603,20 @@ Completable: Cpattern Value[v]->polyvariantPayload::test($1) }] Complete src/CompletionPattern.res 153:30 -posCursor:[153:30] posNoWhite:[153:29] Found expr:[153:3->153:33] posCursor:[153:30] posNoWhite:[153:29] Found pattern:[153:16->153:32] posCursor:[153:30] posNoWhite:[153:29] Found pattern:[153:21->153:32] Completable: Cpattern Value[v]->polyvariantPayload::test($2) +ContextPath Value[v] +Path v [{ "label": "None", - "kind": 4, + "kind": 12, "tags": [], "detail": "bool", "documentation": null }, { "label": "Some(_)", - "kind": 4, + "kind": 12, "tags": [], "detail": "bool", "documentation": null, @@ -600,10 +637,11 @@ Completable: Cpattern Value[v]->polyvariantPayload::test($2) }] Complete src/CompletionPattern.res 156:24 -posCursor:[156:24] posNoWhite:[156:23] Found expr:[156:3->156:33] posCursor:[156:24] posNoWhite:[156:23] Found pattern:[156:16->156:32] posCursor:[156:24] posNoWhite:[156:23] Found pattern:[156:21->156:32] Completable: Cpattern Value[v]->polyvariantPayload::test($1) +ContextPath Value[v] +Path v [{ "label": "true", "kind": 4, @@ -619,13 +657,14 @@ Completable: Cpattern Value[v]->polyvariantPayload::test($1) }] Complete src/CompletionPattern.res 159:36 -posCursor:[159:36] posNoWhite:[159:35] Found expr:[159:3->159:39] posCursor:[159:36] posNoWhite:[159:35] Found pattern:[159:16->159:38] posCursor:[159:36] posNoWhite:[159:35] Found pattern:[159:21->159:38] Completable: Cpattern Value[v]->polyvariantPayload::test($3) +ContextPath Value[v] +Path v [{ "label": "[]", - "kind": 22, + "kind": 12, "tags": [], "detail": "bool", "documentation": null, @@ -635,10 +674,11 @@ Completable: Cpattern Value[v]->polyvariantPayload::test($3) }] Complete src/CompletionPattern.res 164:17 -posCursor:[164:17] posNoWhite:[164:16] Found expr:[164:3->164:20] posCursor:[164:17] posNoWhite:[164:16] Found pattern:[164:16->164:18] Ppat_construct ():[164:16->164:18] Completable: Cpattern Value[s]->tuple($0) +ContextPath Value[s] +Path s [{ "label": "true", "kind": 4, @@ -654,18 +694,19 @@ Completable: Cpattern Value[s]->tuple($0) }] Complete src/CompletionPattern.res 167:23 -posCursor:[167:23] posNoWhite:[167:21] Found expr:[167:3->167:26] posCursor:[167:23] posNoWhite:[167:21] Found pattern:[167:16->167:24] Completable: Cpattern Value[s]->tuple($1) +ContextPath Value[s] +Path s [{ "label": "None", - "kind": 4, + "kind": 12, "tags": [], "detail": "bool", "documentation": null }, { "label": "Some(_)", - "kind": 4, + "kind": 12, "tags": [], "detail": "bool", "documentation": null, @@ -686,18 +727,19 @@ Completable: Cpattern Value[s]->tuple($1) }] Complete src/CompletionPattern.res 170:22 -posCursor:[170:22] posNoWhite:[170:21] Found expr:[170:3->170:30] posCursor:[170:22] posNoWhite:[170:21] Found pattern:[170:16->170:28] Completable: Cpattern Value[s]->tuple($1) +ContextPath Value[s] +Path s [{ "label": "None", - "kind": 4, + "kind": 12, "tags": [], "detail": "bool", "documentation": null }, { "label": "Some(_)", - "kind": 4, + "kind": 12, "tags": [], "detail": "bool", "documentation": null, @@ -720,6 +762,8 @@ Completable: Cpattern Value[s]->tuple($1) Complete src/CompletionPattern.res 173:35 XXX Not found! Completable: Cpattern Value[s] +ContextPath Value[s] +Path s [{ "label": "(_, _, _)", "kind": 12, @@ -731,18 +775,19 @@ Completable: Cpattern Value[s] }] Complete src/CompletionPattern.res 176:41 -posCursor:[176:41] posNoWhite:[176:40] Found expr:[176:3->176:50] posCursor:[176:41] posNoWhite:[176:40] Found pattern:[176:35->176:47] Completable: Cpattern Value[s]->tuple($1) +ContextPath Value[s] +Path s [{ "label": "None", - "kind": 4, + "kind": 12, "tags": [], "detail": "bool", "documentation": null }, { "label": "Some(_)", - "kind": 4, + "kind": 12, "tags": [], "detail": "bool", "documentation": null, @@ -765,6 +810,8 @@ Completable: Cpattern Value[s]->tuple($1) Complete src/CompletionPattern.res 179:21 XXX Not found! Completable: Cpattern Value[z] +ContextPath Value[z] +Path z [{ "label": "One", "kind": 4, @@ -792,11 +839,12 @@ Completable: Cpattern Value[z] }] Complete src/CompletionPattern.res 182:32 -posCursor:[182:32] posNoWhite:[182:31] Found expr:[182:3->182:37] posCursor:[182:32] posNoWhite:[182:31] Found pattern:[182:16->182:34] posCursor:[182:32] posNoWhite:[182:31] Found pattern:[182:22->182:34] Ppat_construct Two:[182:22->182:25] Completable: Cpattern Value[z]->variantPayload::Two($0) +ContextPath Value[z] +Path z [{ "label": "true", "kind": 4, @@ -812,12 +860,13 @@ Completable: Cpattern Value[z]->variantPayload::Two($0) }] Complete src/CompletionPattern.res 185:48 -posCursor:[185:48] posNoWhite:[185:47] Found expr:[185:3->185:53] posCursor:[185:48] posNoWhite:[185:47] Found pattern:[185:16->185:50] posCursor:[185:48] posNoWhite:[185:47] Found pattern:[185:22->185:50] Ppat_construct Three:[185:22->185:27] posCursor:[185:48] posNoWhite:[185:47] Found pattern:[185:27->185:53] Completable: Cpattern Value[z]->variantPayload::Three($1) +ContextPath Value[z] +Path z [{ "label": "true", "kind": 4, @@ -833,10 +882,11 @@ Completable: Cpattern Value[z]->variantPayload::Three($1) }] Complete src/CompletionPattern.res 188:34 -posCursor:[188:34] posNoWhite:[188:33] Found expr:[188:3->188:39] posCursor:[188:34] posNoWhite:[188:33] Found pattern:[188:16->188:36] posCursor:[188:34] posNoWhite:[188:33] Found pattern:[188:23->188:36] Completable: Cpattern Value[b]->polyvariantPayload::two($0) +ContextPath Value[b] +Path b [{ "label": "true", "kind": 4, @@ -852,11 +902,12 @@ Completable: Cpattern Value[b]->polyvariantPayload::two($0) }] Complete src/CompletionPattern.res 191:50 -posCursor:[191:50] posNoWhite:[191:49] Found expr:[191:3->191:55] posCursor:[191:50] posNoWhite:[191:49] Found pattern:[191:16->191:52] posCursor:[191:50] posNoWhite:[191:49] Found pattern:[191:23->191:52] posCursor:[191:50] posNoWhite:[191:49] Found pattern:[191:29->191:52] Completable: Cpattern Value[b]->polyvariantPayload::three($1) +ContextPath Value[b] +Path b [{ "label": "true", "kind": 4, @@ -872,19 +923,20 @@ Completable: Cpattern Value[b]->polyvariantPayload::three($1) }] Complete src/CompletionPattern.res 194:24 -posCursor:[194:24] posNoWhite:[194:23] Found expr:[194:3->194:31] posCursor:[194:24] posNoWhite:[194:23] Found pattern:[194:16->194:29] posCursor:[194:24] posNoWhite:[194:23] Found pattern:[194:23->194:24] Completable: Cpattern Value[s]->tuple($1) +ContextPath Value[s] +Path s [{ "label": "None", - "kind": 4, + "kind": 12, "tags": [], "detail": "bool", "documentation": null }, { "label": "Some(_)", - "kind": 4, + "kind": 12, "tags": [], "detail": "bool", "documentation": null, @@ -905,14 +957,17 @@ Completable: Cpattern Value[s]->tuple($1) }] Complete src/CompletionPattern.res 201:25 -posCursor:[201:25] posNoWhite:[201:24] Found expr:[201:3->204:25] posCursor:[201:25] posNoWhite:[201:24] Found pattern:[201:17->201:28] Completable: Cpattern Value[ff]->recordField(someFn) +ContextPath Value[ff] +Path ff [] Complete src/CompletionPattern.res 206:16 XXX Not found! Completable: Cpattern Value[xn] +ContextPath Value[xn] +Path xn [{ "label": "Js.Exn.Error(error)", "kind": 4, diff --git a/analysis/tests/src/expected/CompletionPipeChain.res.txt b/analysis/tests/src/expected/CompletionPipeChain.res.txt index c149770fe..8afb814c0 100644 --- a/analysis/tests/src/expected/CompletionPipeChain.res.txt +++ b/analysis/tests/src/expected/CompletionPipeChain.res.txt @@ -1,6 +1,13 @@ Complete src/CompletionPipeChain.res 27:16 posCursor:[27:16] posNoWhite:[27:15] Found expr:[27:11->0:-1] Completable: Cpath Value[int]-> +ContextPath Value[int]-> +ContextPath Value[int] +Path int +CPPipe env:CompletionPipeChain +CPPipe type path:Integer.t +CPPipe pathFromEnv:Integer found:true +Path Integer. [{ "label": "Integer.toInt", "kind": 12, @@ -30,6 +37,14 @@ Completable: Cpath Value[int]-> Complete src/CompletionPipeChain.res 30:23 posCursor:[30:23] posNoWhite:[30:22] Found expr:[30:11->0:-1] Completable: Cpath Value[toFlt](Nolabel)-> +ContextPath Value[toFlt](Nolabel)-> +ContextPath Value[toFlt](Nolabel) +ContextPath Value[toFlt] +Path toFlt +CPPipe env:CompletionPipeChain +CPPipe type path:SuperFloat.t +CPPipe pathFromEnv:SuperFloat found:true +Path SuperFloat. [{ "label": "SuperFloat.fromInteger", "kind": 12, @@ -47,6 +62,14 @@ Completable: Cpath Value[toFlt](Nolabel)-> Complete src/CompletionPipeChain.res 33:38 posCursor:[33:38] posNoWhite:[33:37] Found expr:[33:11->0:-1] Completable: Cpath Value[Integer, increment](Nolabel, Nolabel)-> +ContextPath Value[Integer, increment](Nolabel, Nolabel)-> +ContextPath Value[Integer, increment](Nolabel, Nolabel) +ContextPath Value[Integer, increment] +Path Integer.increment +CPPipe env:CompletionPipeChain envFromCompletionItem:CompletionPipeChain.Integer +CPPipe type path:t +CPPipe pathFromEnv:Integer found:true +Path Integer. [{ "label": "Integer.toInt", "kind": 12, @@ -76,6 +99,14 @@ Completable: Cpath Value[Integer, increment](Nolabel, Nolabel)-> Complete src/CompletionPipeChain.res 36:38 posCursor:[36:38] posNoWhite:[36:37] Found expr:[36:11->0:-1] Completable: Cpath Value[Integer, increment](Nolabel, Nolabel)-> +ContextPath Value[Integer, increment](Nolabel, Nolabel)-> +ContextPath Value[Integer, increment](Nolabel, Nolabel) +ContextPath Value[Integer, increment] +Path Integer.increment +CPPipe env:CompletionPipeChain envFromCompletionItem:CompletionPipeChain.Integer +CPPipe type path:t +CPPipe pathFromEnv:Integer found:true +Path Integer. [{ "label": "Integer.toInt", "kind": 12, @@ -105,6 +136,14 @@ Completable: Cpath Value[Integer, increment](Nolabel, Nolabel)-> Complete src/CompletionPipeChain.res 39:47 posCursor:[39:47] posNoWhite:[39:46] Found expr:[39:11->0:-1] Completable: Cpath Value[Integer, decrement](Nolabel, Nolabel)-> +ContextPath Value[Integer, decrement](Nolabel, Nolabel)-> +ContextPath Value[Integer, decrement](Nolabel, Nolabel) +ContextPath Value[Integer, decrement] +Path Integer.decrement +CPPipe env:CompletionPipeChain envFromCompletionItem:CompletionPipeChain.Integer +CPPipe type path:t +CPPipe pathFromEnv:Integer found:true +Path Integer. [{ "label": "Integer.toInt", "kind": 12, @@ -134,6 +173,14 @@ Completable: Cpath Value[Integer, decrement](Nolabel, Nolabel)-> Complete src/CompletionPipeChain.res 42:69 posCursor:[42:69] posNoWhite:[42:68] Found expr:[42:11->0:-1] Completable: Cpath Value[Integer, decrement](Nolabel, Nolabel)-> +ContextPath Value[Integer, decrement](Nolabel, Nolabel)-> +ContextPath Value[Integer, decrement](Nolabel, Nolabel) +ContextPath Value[Integer, decrement] +Path Integer.decrement +CPPipe env:CompletionPipeChain envFromCompletionItem:CompletionPipeChain.Integer +CPPipe type path:t +CPPipe pathFromEnv:Integer found:true +Path Integer. [{ "label": "Integer.toInt", "kind": 12, @@ -163,6 +210,14 @@ Completable: Cpath Value[Integer, decrement](Nolabel, Nolabel)-> Complete src/CompletionPipeChain.res 45:62 posCursor:[45:62] posNoWhite:[45:61] Found expr:[45:11->0:-1] Completable: Cpath Value[SuperFloat, fromInteger](Nolabel)-> +ContextPath Value[SuperFloat, fromInteger](Nolabel)-> +ContextPath Value[SuperFloat, fromInteger](Nolabel) +ContextPath Value[SuperFloat, fromInteger] +Path SuperFloat.fromInteger +CPPipe env:CompletionPipeChain envFromCompletionItem:CompletionPipeChain.SuperFloat +CPPipe type path:t +CPPipe pathFromEnv:SuperFloat found:true +Path SuperFloat. [{ "label": "SuperFloat.fromInteger", "kind": 12, @@ -180,6 +235,14 @@ Completable: Cpath Value[SuperFloat, fromInteger](Nolabel)-> Complete src/CompletionPipeChain.res 48:63 posCursor:[48:63] posNoWhite:[48:62] Found expr:[48:11->48:63] Completable: Cpath Value[SuperFloat, fromInteger](Nolabel)->t +ContextPath Value[SuperFloat, fromInteger](Nolabel)->t +ContextPath Value[SuperFloat, fromInteger](Nolabel) +ContextPath Value[SuperFloat, fromInteger] +Path SuperFloat.fromInteger +CPPipe env:CompletionPipeChain envFromCompletionItem:CompletionPipeChain.SuperFloat +CPPipe type path:t +CPPipe pathFromEnv:SuperFloat found:true +Path SuperFloat.t [{ "label": "SuperFloat.toInteger", "kind": 12, @@ -191,6 +254,14 @@ Completable: Cpath Value[SuperFloat, fromInteger](Nolabel)->t Complete src/CompletionPipeChain.res 51:82 posCursor:[51:82] posNoWhite:[51:81] Found expr:[51:11->0:-1] Completable: Cpath Value[CompletionSupport, Test, make](Nolabel)-> +ContextPath Value[CompletionSupport, Test, make](Nolabel)-> +ContextPath Value[CompletionSupport, Test, make](Nolabel) +ContextPath Value[CompletionSupport, Test, make] +Path CompletionSupport.Test.make +CPPipe env:CompletionPipeChain envFromCompletionItem:CompletionSupport.Test +CPPipe type path:t +CPPipe pathFromEnv:Test found:true +Path CompletionSupport.Test. [{ "label": "CompletionSupport.Test.add", "kind": 12, @@ -214,6 +285,14 @@ Completable: Cpath Value[CompletionSupport, Test, make](Nolabel)-> Complete src/CompletionPipeChain.res 54:78 posCursor:[54:78] posNoWhite:[54:77] Found expr:[54:11->0:-1] Completable: Cpath Value[CompletionSupport, Test, addSelf](Nolabel, Nolabel)-> +ContextPath Value[CompletionSupport, Test, addSelf](Nolabel, Nolabel)-> +ContextPath Value[CompletionSupport, Test, addSelf](Nolabel, Nolabel) +ContextPath Value[CompletionSupport, Test, addSelf] +Path CompletionSupport.Test.addSelf +CPPipe env:CompletionPipeChain envFromCompletionItem:CompletionSupport.Test +CPPipe type path:t +CPPipe pathFromEnv:Test found:true +Path CompletionSupport.Test. [{ "label": "CompletionSupport.Test.add", "kind": 12, @@ -237,11 +316,24 @@ Completable: Cpath Value[CompletionSupport, Test, addSelf](Nolabel, Nolabel)-> Complete src/CompletionPipeChain.res 58:5 posCursor:[58:5] posNoWhite:[58:4] Found expr:[57:8->0:-1] Completable: Cpath Value[Js, Array2, forEach](Nolabel, Nolabel)-> +ContextPath Value[Js, Array2, forEach](Nolabel, Nolabel)-> +ContextPath Value[Js, Array2, forEach](Nolabel, Nolabel) +ContextPath Value[Js, Array2, forEach] +Path Js.Array2.forEach +CPPipe env:CompletionPipeChain envFromCompletionItem:Js_array2 +CPPipe type path:unit +CPPipe pathFromEnv: found:true [] Complete src/CompletionPipeChain.res 62:6 posCursor:[62:6] posNoWhite:[62:5] Found expr:[61:8->62:6] Completable: Cpath Value[Belt, Array, reduce](Nolabel, Nolabel, Nolabel)->t +ContextPath Value[Belt, Array, reduce](Nolabel, Nolabel, Nolabel)->t +ContextPath Value[Belt, Array, reduce](Nolabel, Nolabel, Nolabel) +ContextPath Value[Belt, Array, reduce] +Path Belt.Array.reduce +CPPipe env:CompletionPipeChain envFromCompletionItem:Belt_Array +Path Belt.Int.t [{ "label": "Belt.Int.toString", "kind": 12, @@ -259,6 +351,13 @@ Completable: Cpath Value[Belt, Array, reduce](Nolabel, Nolabel, Nolabel)->t Complete src/CompletionPipeChain.res 70:12 posCursor:[70:12] posNoWhite:[70:11] Found expr:[70:3->0:-1] Completable: Cpath Value[aliased]-> +ContextPath Value[aliased]-> +ContextPath Value[aliased] +Path aliased +CPPipe env:CompletionPipeChain +CPPipe type path:CompletionSupport.Test.t +CPPipe pathFromEnv:CompletionSupport.Test found:false +Path CompletionSupport.Test. [{ "label": "CompletionSupport.Test.add", "kind": 12, @@ -282,6 +381,13 @@ Completable: Cpath Value[aliased]-> Complete src/CompletionPipeChain.res 73:15 posCursor:[73:15] posNoWhite:[73:14] Found expr:[73:3->0:-1] Completable: Cpath Value[notAliased]-> +ContextPath Value[notAliased]-> +ContextPath Value[notAliased] +Path notAliased +CPPipe env:CompletionPipeChain +CPPipe type path:CompletionSupport.Test.t +CPPipe pathFromEnv:CompletionSupport.Test found:false +Path CompletionSupport.Test. [{ "label": "CompletionSupport.Test.add", "kind": 12, @@ -302,3 +408,53 @@ Completable: Cpath Value[notAliased]-> "documentation": null }] +Complete src/CompletionPipeChain.res 82:30 +posCursor:[82:30] posNoWhite:[82:29] Found expr:[76:15->93:1] +Pexp_apply ...[76:15->76:46] (~prepare77:3->77:10=...[77:11->77:24], ~render78:3->78:9=...[78:10->91:3], ...[92:2->92:4]) +posCursor:[82:30] posNoWhite:[82:29] Found expr:[78:10->91:3] +posCursor:[82:30] posNoWhite:[82:29] Found expr:[79:4->90:14] +posCursor:[82:30] posNoWhite:[82:29] Found expr:[82:7->90:14] +posCursor:[82:30] posNoWhite:[82:29] Found expr:[82:7->82:30] +Completable: Cpath Value[props].support.root->ren +ContextPath Value[props].support.root->ren +ContextPath Value[props].support.root +ContextPath Value[props].support +ContextPath Value[props] +Path props +CPPipe env:CompletionPipeChain envFromCompletionItem:CompletionSupport.Nested +CPPipe type path:ReactDOM.Client.Root.t +CPPipe pathFromEnv:ReactDOM.Client.Root found:false +Path ReactDOM.Client.Root.ren +[{ + "label": "ReactDOM.Client.Root.render", + "kind": 12, + "tags": [], + "detail": "(t, React.element) => unit", + "documentation": null + }] + +Complete src/CompletionPipeChain.res 88:16 +posCursor:[88:16] posNoWhite:[88:15] Found expr:[76:15->93:1] +Pexp_apply ...[76:15->76:46] (~prepare77:3->77:10=...[77:11->77:24], ~render78:3->78:9=...[78:10->91:3], ...[92:2->92:4]) +posCursor:[88:16] posNoWhite:[88:15] Found expr:[78:10->91:3] +posCursor:[88:16] posNoWhite:[88:15] Found expr:[79:4->90:14] +posCursor:[88:16] posNoWhite:[88:15] Found expr:[84:4->90:14] +posCursor:[88:16] posNoWhite:[88:15] Found expr:[85:4->90:14] +posCursor:[88:16] posNoWhite:[88:15] Found expr:[88:7->90:14] +posCursor:[88:16] posNoWhite:[88:15] Found expr:[88:7->88:16] +Completable: Cpath Value[root]->ren +ContextPath Value[root]->ren +ContextPath Value[root] +Path root +CPPipe env:CompletionPipeChain +CPPipe type path:ReactDOM.Client.Root.t +CPPipe pathFromEnv:ReactDOM.Client.Root found:false +Path ReactDOM.Client.Root.ren +[{ + "label": "ReactDOM.Client.Root.render", + "kind": 12, + "tags": [], + "detail": "(t, React.element) => unit", + "documentation": null + }] + diff --git a/analysis/tests/src/expected/CompletionPipeSubmodules.res.txt b/analysis/tests/src/expected/CompletionPipeSubmodules.res.txt index a699eb8e6..666931ee5 100644 --- a/analysis/tests/src/expected/CompletionPipeSubmodules.res.txt +++ b/analysis/tests/src/expected/CompletionPipeSubmodules.res.txt @@ -1,6 +1,13 @@ Complete src/CompletionPipeSubmodules.res 12:20 posCursor:[12:20] posNoWhite:[12:19] Found expr:[12:11->20:8] Completable: Cpath Value[A, B1, xx]-> +ContextPath Value[A, B1, xx]-> +ContextPath Value[A, B1, xx] +Path A.B1.xx +CPPipe env:CompletionPipeSubmodules envFromCompletionItem:CompletionPipeSubmodules.A.B1 +CPPipe type path:b1 +CPPipe pathFromEnv:A.B1 found:true +Path A.B1. [{ "label": "A.B1.xx", "kind": 12, @@ -18,6 +25,14 @@ Completable: Cpath Value[A, B1, xx]-> Complete src/CompletionPipeSubmodules.res 16:18 posCursor:[16:18] posNoWhite:[16:17] Found expr:[16:11->20:8] Completable: Cpath Value[A, x].v-> +ContextPath Value[A, x].v-> +ContextPath Value[A, x].v +ContextPath Value[A, x] +Path A.x +CPPipe env:CompletionPipeSubmodules envFromCompletionItem:CompletionPipeSubmodules.A +CPPipe type path:B1.b1 +CPPipe pathFromEnv:A.B1 found:true +Path A.B1. [{ "label": "A.B1.xx", "kind": 12, @@ -35,6 +50,15 @@ Completable: Cpath Value[A, x].v-> Complete src/CompletionPipeSubmodules.res 38:20 posCursor:[38:20] posNoWhite:[38:19] Found expr:[38:11->0:-1] Completable: Cpath Value[E, e].v.v-> +ContextPath Value[E, e].v.v-> +ContextPath Value[E, e].v.v +ContextPath Value[E, e].v +ContextPath Value[E, e] +Path E.e +CPPipe env:CompletionPipeSubmodules envFromCompletionItem:CompletionPipeSubmodules.D +CPPipe type path:C.t +CPPipe pathFromEnv:C found:false +Path C. [{ "label": "C.C", "kind": 4, @@ -46,6 +70,15 @@ Completable: Cpath Value[E, e].v.v-> Complete src/CompletionPipeSubmodules.res 42:21 posCursor:[42:21] posNoWhite:[42:20] Found expr:[42:11->0:-1] Completable: Cpath Value[E, e].v.v2-> +ContextPath Value[E, e].v.v2-> +ContextPath Value[E, e].v.v2 +ContextPath Value[E, e].v +ContextPath Value[E, e] +Path E.e +CPPipe env:CompletionPipeSubmodules envFromCompletionItem:CompletionPipeSubmodules.D +CPPipe type path:C2.t2 +CPPipe pathFromEnv:D.C2 found:true +Path D.C2. [{ "label": "D.C2.C2", "kind": 4, diff --git a/analysis/tests/src/expected/CompletionSupport2.res.txt b/analysis/tests/src/expected/CompletionSupport2.res.txt new file mode 100644 index 000000000..e69de29bb diff --git a/analysis/tests/src/expected/CompletionTypeAnnotation.res.txt b/analysis/tests/src/expected/CompletionTypeAnnotation.res.txt index 6d7db71a7..88468602c 100644 --- a/analysis/tests/src/expected/CompletionTypeAnnotation.res.txt +++ b/analysis/tests/src/expected/CompletionTypeAnnotation.res.txt @@ -1,6 +1,8 @@ Complete src/CompletionTypeAnnotation.res 9:22 XXX Not found! Completable: Cexpression Type[someRecord] +ContextPath Type[someRecord] +Path someRecord [{ "label": "{}", "kind": 12, @@ -15,6 +17,8 @@ Completable: Cexpression Type[someRecord] Complete src/CompletionTypeAnnotation.res 12:24 XXX Not found! Completable: Cexpression Type[someRecord]->recordBody +ContextPath Type[someRecord] +Path someRecord [{ "label": "age", "kind": 5, @@ -32,6 +36,8 @@ Completable: Cexpression Type[someRecord]->recordBody Complete src/CompletionTypeAnnotation.res 15:23 XXX Not found! Completable: Cexpression Type[someVariant] +ContextPath Type[someVariant] +Path someVariant [{ "label": "One", "kind": 4, @@ -53,6 +59,8 @@ Completable: Cexpression Type[someVariant] Complete src/CompletionTypeAnnotation.res 18:25 XXX Not found! Completable: Cexpression Type[someVariant]=O +ContextPath Type[someVariant] +Path someVariant [{ "label": "One", "kind": 4, @@ -79,6 +87,8 @@ Completable: Cexpression Type[someVariant]=O Complete src/CompletionTypeAnnotation.res 21:27 XXX Not found! Completable: Cexpression Type[somePolyVariant] +ContextPath Type[somePolyVariant] +Path somePolyVariant [{ "label": "#one", "kind": 4, @@ -100,6 +110,8 @@ Completable: Cexpression Type[somePolyVariant] Complete src/CompletionTypeAnnotation.res 24:30 XXX Not found! Completable: Cexpression Type[somePolyVariant]=#o +ContextPath Type[somePolyVariant] +Path somePolyVariant [{ "label": "#one", "kind": 4, @@ -113,6 +125,8 @@ Completable: Cexpression Type[somePolyVariant]=#o Complete src/CompletionTypeAnnotation.res 29:20 XXX Not found! Completable: Cexpression Type[someFunc] +ContextPath Type[someFunc] +Path someFunc [{ "label": "(v1, v2) => {}", "kind": 12, @@ -127,6 +141,8 @@ Completable: Cexpression Type[someFunc] Complete src/CompletionTypeAnnotation.res 34:21 XXX Not found! Completable: Cexpression Type[someTuple] +ContextPath Type[someTuple] +Path someTuple [{ "label": "(_, _)", "kind": 12, @@ -140,15 +156,17 @@ Completable: Cexpression Type[someTuple] Complete src/CompletionTypeAnnotation.res 37:28 XXX Not found! Completable: Cexpression Type[someTuple]->tuple($1) +ContextPath Type[someTuple] +Path someTuple [{ "label": "None", - "kind": 4, + "kind": 12, "tags": [], "detail": "bool", "documentation": null }, { "label": "Some(_)", - "kind": 4, + "kind": 12, "tags": [], "detail": "bool", "documentation": null, @@ -171,15 +189,18 @@ Completable: Cexpression Type[someTuple]->tuple($1) Complete src/CompletionTypeAnnotation.res 40:31 XXX Not found! Completable: Cexpression option +ContextPath option +ContextPath Type[someVariant] +Path someVariant [{ "label": "None", - "kind": 4, + "kind": 12, "tags": [], "detail": "type someVariant = One | Two(bool)", "documentation": null }, { "label": "Some(_)", - "kind": 4, + "kind": 12, "tags": [], "detail": "type someVariant = One | Two(bool)", "documentation": null, @@ -206,6 +227,9 @@ Completable: Cexpression option Complete src/CompletionTypeAnnotation.res 43:37 XXX Not found! Completable: Cexpression option->variantPayload::Some($0) +ContextPath option +ContextPath Type[someVariant] +Path someVariant [{ "label": "One", "kind": 4, @@ -227,6 +251,9 @@ Completable: Cexpression option->variantPayload::Some($0) Complete src/CompletionTypeAnnotation.res 46:30 XXX Not found! Completable: Cexpression array +ContextPath array +ContextPath Type[someVariant] +Path someVariant [{ "label": "[]", "kind": 12, @@ -241,6 +268,9 @@ Completable: Cexpression array Complete src/CompletionTypeAnnotation.res 49:32 XXX Not found! Completable: Cexpression array->array +ContextPath array +ContextPath Type[someVariant] +Path someVariant [{ "label": "One", "kind": 4, @@ -262,6 +292,10 @@ Completable: Cexpression array->array Complete src/CompletionTypeAnnotation.res 52:38 XXX Not found! Completable: Cexpression array> +ContextPath array> +ContextPath option +ContextPath Type[someVariant] +Path someVariant [{ "label": "[]", "kind": 12, @@ -276,6 +310,10 @@ Completable: Cexpression array> Complete src/CompletionTypeAnnotation.res 55:45 XXX Not found! Completable: Cexpression option>->variantPayload::Some($0), array +ContextPath option> +ContextPath array +ContextPath Type[someVariant] +Path someVariant [{ "label": "One", "kind": 4, diff --git a/analysis/tests/src/expected/Cross.res.txt b/analysis/tests/src/expected/Cross.res.txt index b51c414b8..5407bfa66 100644 --- a/analysis/tests/src/expected/Cross.res.txt +++ b/analysis/tests/src/expected/Cross.res.txt @@ -97,6 +97,8 @@ Complete src/Cross.res 36:28 posCursor:[36:28] posNoWhite:[36:27] Found expr:[36:3->36:28] Pexp_ident DefinitionWithInterface.a:[36:3->36:28] Completable: Cpath Value[DefinitionWithInterface, a] +ContextPath Value[DefinitionWithInterface, a] +Path DefinitionWithInterface.a [] Definition src/Cross.res 39:39 diff --git a/analysis/tests/src/expected/Debug.res.txt b/analysis/tests/src/expected/Debug.res.txt index 2ab89d23f..192122e7b 100644 --- a/analysis/tests/src/expected/Debug.res.txt +++ b/analysis/tests/src/expected/Debug.res.txt @@ -10,6 +10,8 @@ Pexp_ident eqN:[14:5->14:8] Completable: Cpath Value[eqN] Raw opens: 1 Js.place holder Resolved opens 1 js.ml +ContextPath Value[eqN] +Path eqN [{ "label": "eqNullable", "kind": 12, diff --git a/analysis/tests/src/expected/Destructuring.res.txt b/analysis/tests/src/expected/Destructuring.res.txt index 867586806..e3669008c 100644 --- a/analysis/tests/src/expected/Destructuring.res.txt +++ b/analysis/tests/src/expected/Destructuring.res.txt @@ -1,6 +1,8 @@ Complete src/Destructuring.res 4:11 posCursor:[4:11] posNoWhite:[4:9] Found pattern:[4:4->4:12] Completable: Cpattern Value[x]->recordBody +ContextPath Value[x] +Path x [{ "label": "age", "kind": 5, @@ -12,6 +14,8 @@ Completable: Cpattern Value[x]->recordBody Complete src/Destructuring.res 7:8 posCursor:[7:8] posNoWhite:[7:7] Found pattern:[7:7->7:9] Completable: Cpattern Value[x]->recordBody +ContextPath Value[x] +Path x [{ "label": "name", "kind": 5, @@ -31,6 +35,8 @@ posCursor:[11:13] posNoWhite:[11:11] Found expr:[10:8->14:1] posCursor:[11:13] posNoWhite:[11:11] Found expr:[11:2->13:6] posCursor:[11:13] posNoWhite:[11:11] Found pattern:[11:6->11:14] Completable: Cpattern Value[x]->recordBody +ContextPath Value[x] +Path x [{ "label": "age", "kind": 5, @@ -44,6 +50,8 @@ posCursor:[17:10] posNoWhite:[17:9] Found expr:[16:9->20:1] posCursor:[17:10] posNoWhite:[17:9] Found expr:[17:5->19:11] posCursor:[17:10] posNoWhite:[17:9] Found pattern:[17:9->17:11] Completable: Cpattern Value[x]->recordBody +ContextPath Value[x] +Path x [{ "label": "name", "kind": 5, @@ -61,6 +69,8 @@ Completable: Cpattern Value[x]->recordBody Complete src/Destructuring.res 31:8 posCursor:[31:8] posNoWhite:[31:7] Found pattern:[31:7->31:9] Completable: Cpattern Value[x]->recordBody +ContextPath Value[x] +Path x [{ "label": "someField", "kind": 5, diff --git a/analysis/tests/src/expected/ExhaustiveSwitch.res.txt b/analysis/tests/src/expected/ExhaustiveSwitch.res.txt index c9616503c..9f53761e5 100644 --- a/analysis/tests/src/expected/ExhaustiveSwitch.res.txt +++ b/analysis/tests/src/expected/ExhaustiveSwitch.res.txt @@ -1,6 +1,8 @@ Complete src/ExhaustiveSwitch.res 8:24 XXX Not found! Completable: CexhaustiveSwitch Value[withSomeVarian] +ContextPath Value[withSomeVarian] +Path withSomeVarian [{ "label": "withSomeVariant", "kind": 12, @@ -21,6 +23,8 @@ Completable: CexhaustiveSwitch Value[withSomeVarian] Complete src/ExhaustiveSwitch.res 11:21 XXX Not found! Completable: CexhaustiveSwitch Value[withSomePol] +ContextPath Value[withSomePol] +Path withSomePol [{ "label": "withSomePoly", "kind": 12, @@ -41,6 +45,8 @@ Completable: CexhaustiveSwitch Value[withSomePol] Complete src/ExhaustiveSwitch.res 14:17 XXX Not found! Completable: CexhaustiveSwitch Value[someBoo] +ContextPath Value[someBoo] +Path someBoo [{ "label": "someBool", "kind": 12, @@ -61,6 +67,8 @@ Completable: CexhaustiveSwitch Value[someBoo] Complete src/ExhaustiveSwitch.res 17:16 XXX Not found! Completable: CexhaustiveSwitch Value[someOp] +ContextPath Value[someOp] +Path someOp [{ "label": "someOpt", "kind": 12, diff --git a/analysis/tests/src/expected/Hover.res.txt b/analysis/tests/src/expected/Hover.res.txt index cdf59d587..423f460f9 100644 --- a/analysis/tests/src/expected/Hover.res.txt +++ b/analysis/tests/src/expected/Hover.res.txt @@ -116,6 +116,10 @@ Complete src/Hover.res 170:16 posCursor:[170:16] posNoWhite:[170:15] Found expr:[170:5->170:16] Pexp_field [170:5->170:15] _:[176:2->170:16] Completable: Cpath Value[x1].content."" +ContextPath Value[x1].content."" +ContextPath Value[x1].content +ContextPath Value[x1] +Path x1 [{ "label": "age", "kind": 5, @@ -128,6 +132,10 @@ Complete src/Hover.res 173:16 posCursor:[173:16] posNoWhite:[173:15] Found expr:[173:5->173:16] Pexp_field [173:5->173:15] _:[176:2->173:16] Completable: Cpath Value[x2].content."" +ContextPath Value[x2].content."" +ContextPath Value[x2].content +ContextPath Value[x2] +Path x2 [{ "label": "age", "kind": 5, @@ -140,6 +148,10 @@ Complete src/Hover.res 182:16 posCursor:[182:16] posNoWhite:[182:15] Found expr:[182:5->182:16] Pexp_field [182:5->182:15] _:[187:0->182:16] Completable: Cpath Value[y1].content."" +ContextPath Value[y1].content."" +ContextPath Value[y1].content +ContextPath Value[y1] +Path y1 [{ "label": "age", "kind": 5, @@ -152,6 +164,10 @@ Complete src/Hover.res 185:16 posCursor:[185:16] posNoWhite:[185:15] Found expr:[185:5->185:16] Pexp_field [185:5->185:15] _:[187:0->185:16] Completable: Cpath Value[y2].content."" +ContextPath Value[y2].content."" +ContextPath Value[y2].content +ContextPath Value[y2] +Path y2 [{ "label": "age", "kind": 5, @@ -171,6 +187,8 @@ Nothing at that position. Now trying to use completion. posCursor:[210:13] posNoWhite:[210:12] Found expr:[210:11->210:14] Pexp_ident usr:[210:11->210:14] Completable: Cpath Value[usr] +ContextPath Value[usr] +Path usr {"contents": {"kind": "markdown", "value": "```rescript\nuseR\n```\n\n---\n\n```\n \n```\n```rescript\ntype useR = {x: int, y: list>>}\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22Hover.res%22%2C200%2C0%5D)\n\n\n---\n\n```\n \n```\n```rescript\ntype r<'a> = {i: 'a, f: float}\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22Hover.res%22%2C101%2C0%5D)\n"}} Hover src/Hover.res 230:20 @@ -184,6 +202,9 @@ Nothing at that position. Now trying to use completion. posCursor:[245:6] posNoWhite:[245:5] Found expr:[245:3->245:14] Pexp_field [245:3->245:4] someField:[245:5->245:14] Completable: Cpath Value[x].someField +ContextPath Value[x].someField +ContextPath Value[x] +Path x {"contents": {"kind": "markdown", "value": "```rescript\nbool\n```\n\n Mighty fine field here. "}} Hover src/Hover.res 248:19 diff --git a/analysis/tests/src/expected/Jsx2.res.txt b/analysis/tests/src/expected/Jsx2.res.txt index 5cd54d307..ba54f65f3 100644 --- a/analysis/tests/src/expected/Jsx2.res.txt +++ b/analysis/tests/src/expected/Jsx2.res.txt @@ -7,12 +7,15 @@ Complete src/Jsx2.res 8:15 posCursor:[8:15] posNoWhite:[8:14] Found expr:[8:4->8:15] JSX 8:5] second[8:6->8:12]=...[8:13->8:15]> _children:None Completable: Cexpression CJsxPropValue [M] second=fi +ContextPath CJsxPropValue [M] second +Path M.make [] Complete src/Jsx2.res 11:20 posCursor:[11:20] posNoWhite:[11:19] Found expr:[11:4->11:20] JSX 11:5] second[11:6->11:12]=...[11:13->11:18] f[11:19->11:20]=...[11:19->11:20]> _children:None Completable: Cjsx([M], f, [second, f]) +Path M.make [{ "label": "first", "kind": 4, @@ -31,6 +34,8 @@ Complete src/Jsx2.res 14:13 posCursor:[14:13] posNoWhite:[14:12] Found expr:[14:12->14:13] JSX 14:13] > _children:None Completable: Cpath Module[M] +ContextPath Module[M] +Path M [{ "label": "M", "kind": 9, @@ -61,6 +66,7 @@ Complete src/Jsx2.res 22:19 posCursor:[22:19] posNoWhite:[22:18] Found expr:[22:4->22:19] JSX 22:5] prop[22:6->22:10]=...[22:12->22:16] k[22:18->22:19]=...[22:18->22:19]> _children:None Completable: Cjsx([M], k, [prop, k]) +Path M.make [{ "label": "key", "kind": 4, @@ -73,6 +79,7 @@ Complete src/Jsx2.res 25:17 posCursor:[25:17] posNoWhite:[25:16] Found expr:[25:4->25:17] JSX 25:5] prop[25:6->25:10]=...[25:11->25:15] k[25:16->25:17]=...[25:16->25:17]> _children:None Completable: Cjsx([M], k, [prop, k]) +Path M.make [{ "label": "key", "kind": 4, @@ -85,6 +92,7 @@ Complete src/Jsx2.res 28:21 posCursor:[28:21] posNoWhite:[28:20] Found expr:[28:4->28:21] JSX 28:5] prop[28:6->28:10]=...[28:11->28:19] k[28:20->28:21]=...[28:20->28:21]> _children:None Completable: Cjsx([M], k, [prop, k]) +Path M.make [{ "label": "key", "kind": 4, @@ -97,6 +105,7 @@ Complete src/Jsx2.res 31:24 posCursor:[31:24] posNoWhite:[31:23] Found expr:[31:4->31:24] JSX 31:5] prop[31:6->31:10]=...[31:11->31:22] k[31:23->31:24]=...[31:23->31:24]> _children:None Completable: Cjsx([M], k, [prop, k]) +Path M.make [{ "label": "key", "kind": 4, @@ -109,6 +118,7 @@ Complete src/Jsx2.res 34:18 posCursor:[34:18] posNoWhite:[34:17] Found expr:[34:4->34:18] JSX 34:5] prop[34:6->34:10]=...[34:12->34:16] k[34:17->34:18]=...[34:17->34:18]> _children:None Completable: Cjsx([M], k, [prop, k]) +Path M.make [{ "label": "key", "kind": 4, @@ -121,6 +131,7 @@ Complete src/Jsx2.res 37:16 posCursor:[37:16] posNoWhite:[37:15] Found expr:[37:4->37:16] JSX 37:5] prop[37:6->37:10]=...[37:11->37:14] k[37:15->37:16]=...[37:15->37:16]> _children:None Completable: Cjsx([M], k, [prop, k]) +Path M.make [{ "label": "key", "kind": 4, @@ -133,6 +144,7 @@ Complete src/Jsx2.res 40:17 posCursor:[40:17] posNoWhite:[40:16] Found expr:[40:4->40:17] JSX 40:5] prop[40:6->40:10]=...[40:11->40:15] k[40:16->40:17]=...[40:16->40:17]> _children:None Completable: Cjsx([M], k, [prop, k]) +Path M.make [{ "label": "key", "kind": 4, @@ -145,6 +157,7 @@ Complete src/Jsx2.res 43:18 posCursor:[43:18] posNoWhite:[43:17] Found expr:[43:4->43:18] JSX 43:5] prop[43:6->43:10]=...[43:11->43:16] k[43:17->43:18]=...[43:17->43:18]> _children:None Completable: Cjsx([M], k, [prop, k]) +Path M.make [{ "label": "key", "kind": 4, @@ -157,6 +170,7 @@ Complete src/Jsx2.res 46:16 posCursor:[46:16] posNoWhite:[46:15] Found expr:[46:4->46:16] JSX 46:5] prop[46:6->46:10]=...[46:11->46:14] k[46:15->46:16]=...[46:15->46:16]> _children:None Completable: Cjsx([M], k, [prop, k]) +Path M.make [{ "label": "key", "kind": 4, @@ -169,6 +183,7 @@ Complete src/Jsx2.res 49:27 posCursor:[49:27] posNoWhite:[49:26] Found expr:[49:4->49:27] JSX 49:5] prop[49:6->49:10]=...[49:11->49:25] k[49:26->49:27]=...[49:26->49:27]> _children:None Completable: Cjsx([M], k, [prop, k]) +Path M.make [{ "label": "key", "kind": 4, @@ -181,6 +196,7 @@ Complete src/Jsx2.res 52:38 posCursor:[52:38] posNoWhite:[52:37] Found expr:[52:4->52:38] JSX 52:5] prop[52:6->52:10]=...[52:11->52:36] k[52:37->52:38]=...[52:37->52:38]> _children:None Completable: Cjsx([M], k, [prop, k]) +Path M.make [{ "label": "key", "kind": 4, @@ -193,6 +209,7 @@ Complete src/Jsx2.res 55:25 posCursor:[55:25] posNoWhite:[55:24] Found expr:[55:4->55:25] JSX 55:5] prop[55:6->55:10]=...[55:11->55:23] k[55:24->55:25]=...[55:24->55:25]> _children:None Completable: Cjsx([M], k, [prop, k]) +Path M.make [{ "label": "key", "kind": 4, @@ -210,6 +227,7 @@ Complete src/Jsx2.res 68:10 posCursor:[68:10] posNoWhite:[68:9] Found expr:[68:4->68:10] JSX 68:7] al[68:8->68:10]=...[68:8->68:10]> _children:None Completable: Cjsx([Ext], al, [al]) +Path Ext.make [{ "label": "align", "kind": 4, @@ -222,12 +240,14 @@ Complete src/Jsx2.res 71:11 posCursor:[71:11] posNoWhite:[71:10] Found expr:[71:4->71:11] JSX 71:5] first[71:6->71:11]=...[71:6->71:11]> _children:None Completable: Cjsx([M], first, [first]) +Path M.make [] Complete src/Jsx2.res 74:16 posCursor:[74:16] posNoWhite:[74:15] Found expr:[74:4->74:16] JSX 74:5] first[74:6->74:11]=...[74:12->74:14] k[74:15->74:16]=...[74:15->74:16]> _children:None Completable: Cjsx([M], k, [first, k]) +Path M.make [{ "label": "key", "kind": 4, @@ -240,6 +260,7 @@ Complete src/Jsx2.res 77:23 posCursor:[77:23] posNoWhite:[77:22] Found expr:[77:4->77:23] JSX 77:5] first[77:6->77:11]=...[77:19->77:21] k[77:22->77:23]=...[77:22->77:23]> _children:None Completable: Cjsx([M], k, [first, k]) +Path M.make [{ "label": "key", "kind": 4, @@ -257,12 +278,20 @@ posCursor:[80:6] posNoWhite:[80:5] Found expr:[80:5->83:20] Pexp_construct :::[83:0->83:20] [83:0->83:20] posCursor:[80:6] posNoWhite:[80:5] Found expr:__ghost__[80:5->83:20] Pexp_construct []:__ghost__[80:5->83:20] None +posCursor:[80:6] posNoWhite:[80:5] Found expr:[80:4->83:19] +JSX 80:5] > _children:80:5 +posCursor:[80:6] posNoWhite:[80:5] Found expr:[80:5->83:20] +Pexp_construct :::[83:0->83:20] [83:0->83:20] +posCursor:[80:6] posNoWhite:[80:5] Found expr:__ghost__[80:5->83:20] +Pexp_construct []:__ghost__[80:5->83:20] None [] Complete src/Jsx2.res 89:16 posCursor:[89:16] posNoWhite:[89:15] Found expr:[89:4->89:16] JSX 89:16] > _children:None Completable: Cpath Module[WithChildren] +ContextPath Module[WithChildren] +Path WithChildren [{ "label": "WithChildren", "kind": 9, @@ -275,6 +304,7 @@ Complete src/Jsx2.res 91:18 posCursor:[91:18] posNoWhite:[91:17] Found expr:[91:4->91:18] JSX 91:16] n[91:17->91:18]=...[91:17->91:18]> _children:None Completable: Cjsx([WithChildren], n, [n]) +Path WithChildren.make [{ "label": "name", "kind": 4, @@ -288,6 +318,8 @@ posCursor:[94:18] posNoWhite:[94:17] Found pattern:[94:7->94:18] posCursor:[94:18] posNoWhite:[94:17] Found type:[94:11->94:18] Ptyp_constr React.e:[94:11->94:18] Completable: Cpath Type[React, e] +ContextPath Type[React, e] +Path React.e [{ "label": "element", "kind": 22, @@ -301,6 +333,8 @@ posCursor:[96:20] posNoWhite:[96:19] Found pattern:[96:7->99:6] posCursor:[96:20] posNoWhite:[96:19] Found type:[96:11->99:6] Ptyp_constr ReactDOMR:[96:11->99:6] Completable: Cpath Type[ReactDOMR] +ContextPath Type[ReactDOMR] +Path ReactDOMR [{ "label": "ReactDOMRe", "kind": 9, @@ -315,12 +349,17 @@ Pexp_apply ...[102:15->102:16] (...[102:13->102:14], ...[102:17->102:21]) posCursor:[102:21] posNoWhite:[102:20] Found expr:[102:17->102:21] Pexp_field [102:17->102:18] th:[102:19->102:21] Completable: Cpath Value[x].th +ContextPath Value[x].th +ContextPath Value[x] +Path x [] Complete src/Jsx2.res 106:28 posCursor:[106:28] posNoWhite:[106:27] Found expr:[106:11->106:28] Pexp_ident DefineSomeFields.:[106:11->106:28] Completable: Cpath Value[DefineSomeFields, ""] +ContextPath Value[DefineSomeFields, ""] +Path DefineSomeFields. [{ "label": "thisValue", "kind": 12, @@ -335,6 +374,8 @@ Pexp_apply ...[108:13->108:14] (...[108:11->108:12], ...[108:15->108:36]) posCursor:[108:36] posNoWhite:[108:35] Found expr:[108:15->108:36] Pexp_field [108:15->108:16] DefineSomeFields.th:[108:17->108:36] Completable: Cpath Module[DefineSomeFields].th +ContextPath Module[DefineSomeFields].th +Path DefineSomeFields.th [{ "label": "thisField", "kind": 5, @@ -355,6 +396,8 @@ JSX 121:6] x[122:5->122:6]=...[122:7->122:20] name[124:4->124:8]=.. posCursor:[122:20] posNoWhite:[122:19] Found expr:[122:7->122:20] Pexp_ident Outer.Inner.h:[122:7->122:20] Completable: Cpath Value[Outer, Inner, h] +ContextPath Value[Outer, Inner, h] +Path Outer.Inner.h [{ "label": "hello", "kind": 12, @@ -369,6 +412,8 @@ JSX 128:6] x[129:5->129:6]=...[129:7->131:8]> _children:None posCursor:[129:19] posNoWhite:[129:18] Found expr:[129:7->131:8] Pexp_ident Outer.Inner.:[129:7->131:8] Completable: Cpath Value[Outer, Inner, ""] +ContextPath Value[Outer, Inner, ""] +Path Outer.Inner. [{ "label": "hello", "kind": 12, @@ -386,6 +431,8 @@ Complete src/Jsx2.res 150:21 posCursor:[150:21] posNoWhite:[150:20] Found expr:[150:12->150:32] JSX 150:21] name[150:22->150:26]=...[150:27->150:29]> _children:150:30 Completable: Cpath Module[Nested, Co] +ContextPath Module[Nested, Co] +Path Nested.Co [{ "label": "Comp", "kind": 9, @@ -398,6 +445,8 @@ Complete src/Jsx2.res 153:19 posCursor:[153:19] posNoWhite:[153:18] Found expr:[153:12->153:25] JSX 153:24] > _children:None Completable: Cpath Module[Nested, ""] +ContextPath Module[Nested, ""] +Path Nested. [{ "label": "Comp", "kind": 9, @@ -414,6 +463,7 @@ posCursor:[162:12] posNoWhite:[162:11] Found expr:[162:6->162:21] posCursor:[162:12] posNoWhite:[162:11] Found expr:[162:6->162:20] JSX 162:10] age[162:11->162:14]=...[162:15->162:17]> _children:162:18 Completable: Cjsx([Comp], age, [age]) +Path Comp.make {"contents": {"kind": "markdown", "value": "```rescript\nint\n```"}} Hover src/Jsx2.res 167:16 @@ -427,5 +477,6 @@ posCursor:[167:16] posNoWhite:[167:15] Found expr:[167:10->167:25] posCursor:[167:16] posNoWhite:[167:15] Found expr:[167:10->167:24] JSX 167:14] age[167:15->167:18]=...[167:19->167:21]> _children:167:22 Completable: Cjsx([Comp], age, [age]) +Path Comp.make {"contents": {"kind": "markdown", "value": "```rescript\nint\n```"}} diff --git a/analysis/tests/src/expected/Jsx2.resi.txt b/analysis/tests/src/expected/Jsx2.resi.txt index aa95d5bc3..fa86df12c 100644 --- a/analysis/tests/src/expected/Jsx2.resi.txt +++ b/analysis/tests/src/expected/Jsx2.resi.txt @@ -10,6 +10,8 @@ Complete src/Jsx2.resi 7:19 posCursor:[7:19] posNoWhite:[7:18] Found type:[7:12->7:19] Ptyp_constr React.e:[7:12->7:19] Completable: Cpath Type[React, e] +ContextPath Type[React, e] +Path React.e [{ "label": "element", "kind": 22, @@ -22,6 +24,8 @@ Complete src/Jsx2.resi 10:18 posCursor:[10:18] posNoWhite:[10:17] Found type:[10:11->10:18] Ptyp_constr React.e:[10:11->10:18] Completable: Cpath Type[React, e] +ContextPath Type[React, e] +Path React.e [{ "label": "element", "kind": 22, diff --git a/analysis/tests/src/expected/JsxV4.res.txt b/analysis/tests/src/expected/JsxV4.res.txt index 3ae47a79e..fc6552084 100644 --- a/analysis/tests/src/expected/JsxV4.res.txt +++ b/analysis/tests/src/expected/JsxV4.res.txt @@ -5,6 +5,7 @@ Complete src/JsxV4.res 11:20 posCursor:[11:20] posNoWhite:[11:19] Found expr:[11:4->11:20] JSX 11:6] first[11:7->11:12]=...[11:13->11:18] f[11:19->11:20]=...[11:19->11:20]> _children:None Completable: Cjsx([M4], f, [first, f]) +Path M4.make [{ "label": "fun", "kind": 4, diff --git a/analysis/tests/src/expected/RecordCompletion.res.txt b/analysis/tests/src/expected/RecordCompletion.res.txt index d5d0b47dc..a898b97d4 100644 --- a/analysis/tests/src/expected/RecordCompletion.res.txt +++ b/analysis/tests/src/expected/RecordCompletion.res.txt @@ -1,6 +1,12 @@ Complete src/RecordCompletion.res 8:9 posCursor:[8:9] posNoWhite:[8:8] Found expr:[8:3->8:9] Completable: Cpath Value[t].n->m +ContextPath Value[t].n->m +ContextPath Value[t].n +ContextPath Value[t] +Path t +CPPipe env:RecordCompletion +Path Js.Array2.m [{ "label": "Js.Array2.mapi", "kind": 12, @@ -18,6 +24,13 @@ Completable: Cpath Value[t].n->m Complete src/RecordCompletion.res 11:13 posCursor:[11:13] posNoWhite:[11:12] Found expr:[11:3->11:13] Completable: Cpath Value[t2].n2.n->m +ContextPath Value[t2].n2.n->m +ContextPath Value[t2].n2.n +ContextPath Value[t2].n2 +ContextPath Value[t2] +Path t2 +CPPipe env:RecordCompletion +Path Js.Array2.m [{ "label": "Js.Array2.mapi", "kind": 12, @@ -36,6 +49,8 @@ Complete src/RecordCompletion.res 19:7 posCursor:[19:7] posNoWhite:[19:6] Found expr:[19:3->19:7] Pexp_field [19:3->19:4] R.:[19:5->19:7] Completable: Cpath Module[R]."" +ContextPath Module[R]."" +Path R. [{ "label": "name", "kind": 5, @@ -48,6 +63,8 @@ Complete src/RecordCompletion.res 22:7 posCursor:[22:7] posNoWhite:[22:6] Found expr:[22:3->22:10] Pexp_field [22:3->22:4] R.xx:[22:5->22:10] Completable: Cpath Module[R]."" +ContextPath Module[R]."" +Path R. [{ "label": "name", "kind": 5, diff --git a/analysis/tests/src/expected/RecoveryOnProp.res.txt b/analysis/tests/src/expected/RecoveryOnProp.res.txt index fe509d768..b7e3bc268 100644 --- a/analysis/tests/src/expected/RecoveryOnProp.res.txt +++ b/analysis/tests/src/expected/RecoveryOnProp.res.txt @@ -7,7 +7,12 @@ posCursor:[6:26] posNoWhite:[6:25] Found expr:[6:16->8:5] posCursor:[6:26] posNoWhite:[6:25] Found pattern:[6:20->8:5] posCursor:[6:26] posNoWhite:[6:25] Found type:[6:23->8:5] Ptyp_constr Res:[6:23->8:5] +posCursor:[6:26] posNoWhite:[6:25] Found pattern:[6:20->8:5] +posCursor:[6:26] posNoWhite:[6:25] Found type:[6:23->8:5] +Ptyp_constr Res:[6:23->8:5] Completable: Cpath Type[Res] +ContextPath Type[Res] +Path Res [{ "label": "RescriptReactErrorBoundary", "kind": 9, diff --git a/analysis/tests/src/expected/SignatureHelp.res.txt b/analysis/tests/src/expected/SignatureHelp.res.txt index 802874b2f..5ed218e47 100644 --- a/analysis/tests/src/expected/SignatureHelp.res.txt +++ b/analysis/tests/src/expected/SignatureHelp.res.txt @@ -3,6 +3,9 @@ posCursor:[16:19] posNoWhite:[16:18] Found expr:[16:11->16:20] Pexp_apply ...[16:11->16:19] (...[46:0->16:20]) posCursor:[16:19] posNoWhite:[16:18] Found expr:[16:11->16:19] Pexp_ident someFunc:[16:11->16:19] +Completable: Cpath Value[someFunc] +ContextPath Value[someFunc] +Path someFunc argAtCursor: unlabelled<0> extracted params: [( @@ -22,6 +25,9 @@ posCursor:[19:19] posNoWhite:[19:18] Found expr:[19:11->19:21] Pexp_apply ...[19:11->19:19] (...[19:20->19:21]) posCursor:[19:19] posNoWhite:[19:18] Found expr:[19:11->19:19] Pexp_ident someFunc:[19:11->19:19] +Completable: Cpath Value[someFunc] +ContextPath Value[someFunc] +Path someFunc argAtCursor: unlabelled<0> extracted params: [( @@ -41,6 +47,9 @@ posCursor:[22:19] posNoWhite:[22:18] Found expr:[22:11->22:29] Pexp_apply ...[22:11->22:19] (...[22:20->22:23], ~two22:26->22:29=...[22:26->22:29]) posCursor:[22:19] posNoWhite:[22:18] Found expr:[22:11->22:19] Pexp_ident someFunc:[22:11->22:19] +Completable: Cpath Value[someFunc] +ContextPath Value[someFunc] +Path someFunc argAtCursor: ~two extracted params: [( @@ -60,6 +69,9 @@ posCursor:[25:19] posNoWhite:[25:18] Found expr:[25:11->25:35] Pexp_apply ...[25:11->25:19] (...[25:20->25:23], ~two25:26->25:29=...[25:30->25:35]) posCursor:[25:19] posNoWhite:[25:18] Found expr:[25:11->25:19] Pexp_ident someFunc:[25:11->25:19] +Completable: Cpath Value[someFunc] +ContextPath Value[someFunc] +Path someFunc argAtCursor: ~two extracted params: [( @@ -79,6 +91,9 @@ posCursor:[28:19] posNoWhite:[28:18] Found expr:[28:11->28:42] Pexp_apply ...[28:11->28:19] (...[28:20->28:23], ~two28:26->28:29=...[28:30->28:35], ~four28:38->28:42=...[28:38->28:42]) posCursor:[28:19] posNoWhite:[28:18] Found expr:[28:11->28:19] Pexp_ident someFunc:[28:11->28:19] +Completable: Cpath Value[someFunc] +ContextPath Value[someFunc] +Path someFunc argAtCursor: ~four extracted params: [( @@ -98,6 +113,9 @@ posCursor:[31:19] posNoWhite:[31:18] Found expr:[31:11->31:44] Pexp_apply ...[31:11->31:19] (...[31:20->31:23], ~two31:26->31:29=...[31:30->31:35], ~four31:38->31:42=...[31:43->31:44]) posCursor:[31:19] posNoWhite:[31:18] Found expr:[31:11->31:19] Pexp_ident someFunc:[31:11->31:19] +Completable: Cpath Value[someFunc] +ContextPath Value[someFunc] +Path someFunc argAtCursor: ~four extracted params: [( @@ -117,6 +135,9 @@ posCursor:[34:20] posNoWhite:[34:19] Found expr:[34:11->34:21] Pexp_apply ...[34:11->34:20] (...[46:0->34:21]) posCursor:[34:20] posNoWhite:[34:19] Found expr:[34:11->34:20] Pexp_ident otherFunc:[34:11->34:20] +Completable: Cpath Value[otherFunc] +ContextPath Value[otherFunc] +Path otherFunc argAtCursor: unlabelled<0> extracted params: [(string, int, float] @@ -134,6 +155,9 @@ posCursor:[37:20] posNoWhite:[37:19] Found expr:[37:11->37:26] Pexp_apply ...[37:11->37:20] (...[37:21->37:26]) posCursor:[37:20] posNoWhite:[37:19] Found expr:[37:11->37:20] Pexp_ident otherFunc:[37:11->37:20] +Completable: Cpath Value[otherFunc] +ContextPath Value[otherFunc] +Path otherFunc argAtCursor: unlabelled<0> extracted params: [(string, int, float] @@ -151,6 +175,9 @@ posCursor:[40:20] posNoWhite:[40:19] Found expr:[40:11->40:39] Pexp_apply ...[40:11->40:20] (...[40:21->40:26], ...[40:28->40:31], ...[40:33->40:38]) posCursor:[40:20] posNoWhite:[40:19] Found expr:[40:11->40:20] Pexp_ident otherFunc:[40:11->40:20] +Completable: Cpath Value[otherFunc] +ContextPath Value[otherFunc] +Path otherFunc argAtCursor: unlabelled<2> extracted params: [(string, int, float] @@ -168,6 +195,9 @@ posCursor:[43:29] posNoWhite:[43:28] Found expr:[43:11->43:34] Pexp_apply ...[43:11->43:29] (~age43:31->43:34=...[43:31->43:34]) posCursor:[43:29] posNoWhite:[43:28] Found expr:[43:11->43:29] Pexp_ident Completion.Lib.foo:[43:11->43:29] +Completable: Cpath Value[Completion, Lib, foo] +ContextPath Value[Completion, Lib, foo] +Path Completion.Lib.foo argAtCursor: ~age extracted params: [(~age: int, ~name: string] @@ -185,6 +215,9 @@ posCursor:[50:23] posNoWhite:[50:22] Found expr:[50:11->50:24] Pexp_apply ...[50:11->50:23] (...[56:0->50:24]) posCursor:[50:23] posNoWhite:[50:22] Found expr:[50:11->50:23] Pexp_ident iAmSoSpecial:[50:11->50:23] +Completable: Cpath Value[iAmSoSpecial] +ContextPath Value[iAmSoSpecial] +Path iAmSoSpecial argAtCursor: unlabelled<0> extracted params: [string] @@ -203,6 +236,9 @@ posCursor:[53:29] posNoWhite:[53:28] Found expr:[53:20->53:31] Pexp_apply ...[53:20->53:29] (...[53:30->53:31]) posCursor:[53:29] posNoWhite:[53:28] Found expr:[53:20->53:29] Pexp_ident otherFunc:[53:20->53:29] +Completable: Cpath Value[otherFunc] +ContextPath Value[otherFunc] +Path otherFunc argAtCursor: unlabelled<1> extracted params: [(string, int, float] @@ -220,6 +256,9 @@ posCursor:[62:13] posNoWhite:[62:12] Found expr:[62:11->62:19] Pexp_apply ...[62:11->62:13] (...[62:14->62:16]) posCursor:[62:13] posNoWhite:[62:12] Found expr:[62:11->62:13] Pexp_ident fn:[62:11->62:13] +Completable: Cpath Value[fn] +ContextPath Value[fn] +Path fn argAtCursor: unlabelled<1> extracted params: [(int, string, int] @@ -237,6 +276,9 @@ posCursor:[65:13] posNoWhite:[65:12] Found expr:[65:11->65:25] Pexp_apply ...[65:11->65:13] (...[65:14->65:16], ...[65:20->65:24]) posCursor:[65:13] posNoWhite:[65:12] Found expr:[65:11->65:13] Pexp_ident fn:[65:11->65:13] +Completable: Cpath Value[fn] +ContextPath Value[fn] +Path fn argAtCursor: unlabelled<1> extracted params: [(int, string, int] @@ -254,6 +296,9 @@ posCursor:[68:13] posNoWhite:[68:12] Found expr:[68:11->68:28] Pexp_apply ...[68:11->68:13] (...[68:14->68:16], ...[68:18->68:25]) posCursor:[68:13] posNoWhite:[68:12] Found expr:[68:11->68:13] Pexp_ident fn:[68:11->68:13] +Completable: Cpath Value[fn] +ContextPath Value[fn] +Path fn argAtCursor: unlabelled<2> extracted params: [(int, string, int] @@ -273,6 +318,9 @@ posCursor:[71:28] posNoWhite:[71:27] Found expr:[71:16->71:30] Pexp_apply ...[71:16->71:28] (...[71:29->71:30]) posCursor:[71:28] posNoWhite:[71:27] Found expr:[71:16->71:28] Pexp_ident iAmSoSpecial:[71:16->71:28] +Completable: Cpath Value[iAmSoSpecial] +ContextPath Value[iAmSoSpecial] +Path iAmSoSpecial argAtCursor: unlabelled<0> extracted params: [string] @@ -294,6 +342,9 @@ posCursor:[74:39] posNoWhite:[74:38] Found expr:[74:31->74:41] Pexp_apply ...[74:31->74:39] (...[74:40->74:41]) posCursor:[74:39] posNoWhite:[74:38] Found expr:[74:31->74:39] Pexp_ident someFunc:[74:31->74:39] +Completable: Cpath Value[someFunc] +ContextPath Value[someFunc] +Path someFunc argAtCursor: unlabelled<0> extracted params: [(