diff --git a/analysis/src/hover.ml b/analysis/src/hover.ml index 4abdb4a490..a4b0bca851 100644 --- a/analysis/src/hover.ml +++ b/analysis/src/hover.ml @@ -64,6 +64,9 @@ type extracted_type = { decl: Types.type_declaration; env: Shared_types.Query_env.t; loc: Warnings.loc; + uri: Uri.t; + (** the file of [loc], which differs from [env]'s for a type + of an applied or included module of another file *) } let find_relevant_types_from_type ~state ~file ~package typ = @@ -103,9 +106,13 @@ let find_relevant_types_from_type ~state ~file ~package typ = let from_constructor_path ~env path = match References.dig_constructor ~state ~env ~package path with | None -> None - | Some (env, {name = {txt}; extent_loc; item = {decl}}) -> + | Some (env, {name = {txt}; extent_loc; item = {decl}; module_path}) -> if Utils.is_uncurried_internal path then None - else Some {name = txt; env; loc = extent_loc; decl; path} + else + let uri = + Resolve_path.get_source_uri ~state ~env ~package module_path + in + Some {name = txt; env; loc = extent_loc; decl; path; uri} in let constructors = Shared.find_type_constructors types_to_search in constructors |> List.filter_map (from_constructor_path ~env:env_to_search) @@ -142,12 +149,12 @@ let expand_types ~state ~file ~package ~supports_markdown_links typ = else ( types_seen := String_set.add type_id !types_seen; true)) - |> List.map (fun {decl; env; loc; path} -> + |> List.map (fun {decl; loc; path; uri} -> let link_to_type_definition_str = if supports_markdown_links && not (is_inline_record_definition decl path) - then Markdown.go_to_definition_text ~env ~pos:loc.Warnings.loc_start + then Markdown.go_to_definition_text ~uri ~pos:loc.Warnings.loc_start else "" in Markdown.divider diff --git a/analysis/src/markdown.ml b/analysis/src/markdown.ml index b5254b9b25..2df30561eb 100644 --- a/analysis/src/markdown.ml +++ b/analysis/src/markdown.ml @@ -8,12 +8,12 @@ let make_goto_command link = Printf.sprintf "[%s](%s#L%d,%d)" link.label link.file (link.start_pos.line + 1) (link.start_pos.character + 1) -let go_to_definition_text ~env ~pos = +let go_to_definition_text ~uri ~pos = let start_line, start_col = Pos.of_lexing pos in "\nGo to: " ^ make_goto_command { label = "Type definition"; - file = Uri.to_string env.Shared_types.Query_env.file.uri; + file = Uri.to_string uri; start_pos = {line = start_line; character = start_col}; } diff --git a/analysis/src/process_cmt.ml b/analysis/src/process_cmt.ml index 18d854a524..730c59aad4 100644 --- a/analysis/src/process_cmt.ml +++ b/analysis/src/process_cmt.ml @@ -148,7 +148,7 @@ let rec for_type_signature_item ~(env : Shared_types.Env.t) let name = Ident.name ident in let declared = add_declared ~extent:md_loc - ~item:(for_type_module ~name ~env md_type) + ~item:(for_type_module ~name ~env:(env |> Env.add_module ~name) md_type) ~name:(Location.mkloc name md_loc) ~stamp:(Ident.binding_time ident) ~env md_attributes (Exported.add exported Exported.Module) @@ -165,6 +165,28 @@ let rec for_type_signature_item ~(env : Shared_types.Env.t) loc = declared.extent_loc; }; ] + | Sig_modtype (ident, {mtd_type = Some mod_type; mtd_attributes; mtd_loc}) -> + let name = Ident.name ident in + let env = env |> Env.add_module_type ~name in + let declared = + add_declared ~extent:mtd_loc + ~item:(for_type_module ~name ~env mod_type) + ~name:(Location.mkloc name mtd_loc) + ~stamp:(Ident.binding_time ident) ~env mtd_attributes + (Exported.add exported Exported.Module) + Stamps.add_module + in + [ + { + Module.kind = + Module + {type_ = declared.item; is_module_type = is_module_type declared}; + name = declared.name.txt; + docstring = declared.docstring; + deprecated = declared.deprecated; + loc = declared.extent_loc; + }; + ] | _ -> [] and for_type_signature ~name ~env signature = @@ -185,6 +207,62 @@ and for_type_module ~name ~env module_type = | Mty_functor (_argIdent, _argType, result_type) -> for_type_module ~name ~env result_type +(* Stamps given to renamed identifiers start here, far above the stamps + in a typed tree, so that they never meet one of them. *) +let renamed_stamp_floor = 1 lsl 40 + +(* [Subst] renames the items of a signature in place, so the original and + the renamed signature list the same items in the same order. Records + each renamed stamp's original, nested signatures included, for + references to find the declarations in the functor body. *) +let rec record_renamed_stamps table (original : Types.module_type) + (renamed : Types.module_type) = + match (original, renamed) with + | Mty_signature items, Mty_signature renamed_items + when List.length items = List.length renamed_items -> + List.iter2 + (fun (item : Types.signature_item) (renamed_item : Types.signature_item) + -> + let ids = + match (item, renamed_item) with + | Sig_value (id, _), Sig_value (id', _) + | Sig_type (id, _, _), Sig_type (id', _, _) + | Sig_typext (id, _, _), Sig_typext (id', _, _) -> + Some (id, id') + | Sig_module (id, md, _), Sig_module (id', md', _) -> + record_renamed_stamps table md.md_type md'.md_type; + Some (id, id') + | Sig_modtype (id, mtd), Sig_modtype (id', mtd') -> + (match (mtd.mtd_type, mtd'.mtd_type) with + | Some mty, Some mty' -> record_renamed_stamps table mty mty' + | _ -> ()); + Some (id, id') + | _ -> None + in + match ids with + | Some (id, id') -> + Hashtbl.replace table (Ident.binding_time id') (Ident.binding_time id) + | None -> ()) + items renamed_items + | Mty_functor (_, _, result), Mty_functor (_, _, renamed_result) -> + record_renamed_stamps table result renamed_result + | _ -> () + +(* The type of an applied functor with the identifiers of the body's + declarations. The functor's result signature has them; an application's + has them only when the argument is not a path, else the compiler already + renamed them, so the results of curried applications are taken from the + functor applied first. *) +let rec body_type (mod_expr : Typedtree.module_expr) = + match mod_expr.mod_desc with + | Tmod_apply (functor_, _arg, _coercion) -> ( + match body_type functor_ with + | Types.Mty_functor (_, _, result) -> result + | mty -> mty) + | Tmod_ident _ | Tmod_structure _ | Tmod_functor _ | Tmod_constraint _ + | Tmod_unpack _ -> + mod_expr.mod_type + let get_module_type_path mod_desc = match mod_desc with | Typedtree.Tmty_ident (path, _) | Tmty_alias (path, _) -> Some path @@ -425,6 +503,10 @@ let rec get_module_path mod_desc = | Tmod_functor (_ident, _argName, _maybeType, _resultExpr) -> None | Tmod_apply (functor_, _arg, _coercion) -> get_module_path functor_.mod_desc | Tmod_unpack (_expr, _moduleType) -> None + (* A module alias used as a functor or included is wrapped with the path + the compiler resolved its chain of aliases to: the module's own file. *) + | Tmod_constraint (_expr, _typ, _constraint, Tcoerce_alias (path, _)) -> + Some path | Tmod_constraint (expr, _typ, _constraint, _coercion) -> get_module_path expr.mod_desc @@ -546,13 +628,12 @@ let rec for_structure_item ~(env : Shared_types.Env.t) ~(exported : Exported.t) bindings |> List.iter (fun {Typedtree.vb_expr} -> scan_let_modules ~env vb_expr); !items - | Tstr_module - {mb_id; mb_attributes; mb_loc; mb_name = name; mb_expr = {mod_desc}} + | Tstr_module {mb_id; mb_attributes; mb_loc; mb_name = name; mb_expr} when not (String.length name.txt >= 6 && (String.sub name.txt 0 6 = "local_") [@doesNotRaise]) (* %%private generates a dummy module called local_... *) -> - let item = for_module ~env mod_desc name.txt in + let item = for_module ~env mb_expr name.txt in let declared = add_declared ~item ~name ~extent:mb_loc ~stamp:(Ident.binding_time mb_id) ~env mb_attributes @@ -647,8 +728,8 @@ let rec for_structure_item ~(env : Shared_types.Env.t) ~(exported : Exported.t) decl |> for_type_declaration ~env ~exported ~rec_status) | _ -> [] -and for_module ~env mod_desc module_name = - match mod_desc with +and for_module ~env (mod_expr : Typedtree.module_expr) module_name = + match mod_expr.mod_desc with | Tmod_ident (path, _lident) -> Ident path | Tmod_structure structure -> let env = env |> Env.add_module ~name:module_name in @@ -665,15 +746,35 @@ and for_module ~env mod_desc module_name = ~extent:arg_name.loc ~stamp ~module_path:NotVisible false [] in Stamps.add_module env.stamps stamp declared); - for_module ~env result_expr.mod_desc module_name + for_module ~env result_expr module_name | Tmod_apply (functor_, _arg, _coercion) -> - for_module ~env functor_.mod_desc module_name + (* The functor's body has the parameter's types; the application's + signature has the argument's. Its items keep the identifiers of the + body, whose stamps are already taken, so they are renamed first, + with stamps above any that a compilation hands out. Their locations + are in the functor's body, so they are marked as coming from the + functor, like included items, for definitions to find its file. + An inline functor's parameters and declarations are registered + first, for uses inside its body to resolve. *) + ignore (for_module ~env functor_ module_name); + let env = env |> Env.add_module ~name:module_name in + let env = + match get_module_path functor_.mod_desc with + | Some path -> + {env with module_path = IncludedModule (path, env.module_path)} + | None -> env + in + if Ident.current_time () < renamed_stamp_floor then + Ident.set_current_time renamed_stamp_floor; + let renamed = Subst.modtype Subst.identity mod_expr.mod_type in + record_renamed_stamps env.renamed_stamps (body_type mod_expr) renamed; + for_type_module ~name:module_name ~env renamed | Tmod_unpack (_expr, module_type) -> let env = env |> Env.add_module ~name:module_name in for_type_module ~name:module_name ~env module_type | Tmod_constraint (expr, typ, _constraint, _coercion) -> (* TODO do this better I think *) - let mod_kind = for_module ~env expr.mod_desc module_name in + let mod_kind = for_module ~env expr module_name in let env = env |> Env.add_module ~name:module_name in let mod_type_kind = for_type_module ~name:module_name ~env typ in Constraint (mod_kind, mod_type_kind) @@ -690,7 +791,7 @@ and scan_let_modules ~env (e : Typedtree.expression) = (match expression.exp_desc with | Texp_letmodule (id, name, mexpr, _body) -> let stamp = Ident.binding_time id in - let item = for_module ~env mexpr.mod_desc name.txt in + let item = for_module ~env mexpr name.txt in let declared = Process_attributes.new_declared ~item ~extent:name.loc ~name ~stamp ~module_path:NotVisible false [] @@ -723,7 +824,11 @@ and for_structure ~name ~env str_items = let file_for_cmt_infos ~module_name ~uri ({cmt_modname; cmt_annots} : Cmt_format.cmt_infos) = let env = - {Env.stamps = Stamps.init (); module_path = File (uri, module_name)} + { + Env.stamps = Stamps.init (); + module_path = File (uri, module_name); + renamed_stamps = Hashtbl.create 1; + } in match cmt_annots with | Partial_implementation parts -> @@ -737,7 +842,13 @@ let file_for_cmt_infos ~module_name ~uri |> List.concat in let structure = for_structure ~name:module_name ~env items in - {File.uri; module_name = cmt_modname; stamps = env.stamps; structure} + { + File.uri; + module_name = cmt_modname; + stamps = env.stamps; + structure; + renamed_stamps = env.renamed_stamps; + } | Partial_interface parts -> let items = parts |> Array.to_list @@ -749,13 +860,31 @@ let file_for_cmt_infos ~module_name ~uri |> List.concat in let structure = for_signature ~name:module_name ~env items in - {uri; module_name = cmt_modname; stamps = env.stamps; structure} + { + uri; + module_name = cmt_modname; + stamps = env.stamps; + structure; + renamed_stamps = env.renamed_stamps; + } | Implementation structure -> let structure = for_structure ~name:module_name ~env structure.str_items in - {uri; module_name = cmt_modname; stamps = env.stamps; structure} + { + uri; + module_name = cmt_modname; + stamps = env.stamps; + structure; + renamed_stamps = env.renamed_stamps; + } | Interface signature -> let structure = for_signature ~name:module_name ~env signature.sig_items in - {uri; module_name = cmt_modname; stamps = env.stamps; structure} + { + uri; + module_name = cmt_modname; + stamps = env.stamps; + structure; + renamed_stamps = env.renamed_stamps; + } let file_for_cmt ~state ~module_name ~cmt ~uri = match Hashtbl.find_opt state.cmt_cache cmt with diff --git a/analysis/src/process_extra.ml b/analysis/src/process_extra.ml index 4f14dc3136..06acf01919 100644 --- a/analysis/src/process_extra.ml +++ b/analysis/src/process_extra.ml @@ -12,47 +12,64 @@ let add_reference ~extra stamp loc = Hashtbl.find extra.internal_references stamp else [])) +(* Items read from another file's signature, such as those of a functor + applied from that file, have that file's locations, so they declare + nothing at those positions of this file. *) +let declared_in_file ~(file : File.t) (d : _ Declared.t) = + let source = d.extent_loc.loc_start.pos_fname in + d.extent_loc.loc_ghost || source = "" + || Filename.basename source = Filename.basename (Lsp.Uri.to_path file.uri) + let extra_for_file ~(file : File.t) = let extra = init_extra () in file.stamps |> Stamps.iter_modules (fun stamp (d : Module.t Declared.t) -> - add_loc_item extra d.name.loc (LModule (Definition (stamp, Module))); - add_reference ~extra stamp d.name.loc); + if declared_in_file ~file d then ( + add_loc_item extra d.name.loc (LModule (Definition (stamp, Module))); + add_reference ~extra stamp d.name.loc)); file.stamps |> Stamps.iter_values (fun stamp (d : Types.type_expr Declared.t) -> - add_loc_item extra d.name.loc - (Typed (d.name.txt, d.item, Definition (stamp, Value))); - add_reference ~extra stamp d.name.loc); + if declared_in_file ~file d then ( + add_loc_item extra d.name.loc + (Typed (d.name.txt, d.item, Definition (stamp, Value))); + add_reference ~extra stamp d.name.loc)); file.stamps |> Stamps.iter_types (fun stamp (d : Type.t Declared.t) -> - add_loc_item extra d.name.loc - (TypeDefinition (d.name.txt, d.item.Type.decl, stamp)); - add_reference ~extra stamp d.name.loc; - match d.item.Type.kind with - | Record labels -> - labels - |> List.iter (fun {stamp; fname; typ} -> - add_reference ~extra stamp fname.loc; - add_loc_item extra fname.loc - (Typed (d.name.txt, typ, Definition (d.stamp, Field fname.txt)))) - | Variant constructors -> - constructors - |> List.iter (fun {Constructor.stamp; cname} -> - add_reference ~extra stamp cname.loc; - let t = - { - Types.id = 0; - level = 0; - desc = - Tconstr - ( Path.Pident {Ident.stamp; name = d.name.txt; flags = 0}, - [], - ref Types.Mnil ); - } - in - add_loc_item extra cname.loc - (Typed (d.name.txt, t, Definition (d.stamp, Constructor cname.txt)))) - | _ -> ()); + if declared_in_file ~file d then ( + add_loc_item extra d.name.loc + (TypeDefinition (d.name.txt, d.item.Type.decl, stamp)); + add_reference ~extra stamp d.name.loc; + match d.item.Type.kind with + (* Fields and constructors of a type read from a signature, such as + an applied functor's, have no location of their own; references + to them are those of the declarations they come from. *) + | Record labels -> + labels + |> List.filter (fun {fname} -> not fname.loc.loc_ghost) + |> List.iter (fun {stamp; fname; typ} -> + add_reference ~extra stamp fname.loc; + add_loc_item extra fname.loc + (Typed (d.name.txt, typ, Definition (d.stamp, Field fname.txt)))) + | Variant constructors -> + constructors + |> List.filter (fun {Constructor.cname} -> not cname.loc.loc_ghost) + |> List.iter (fun {Constructor.stamp; cname} -> + add_reference ~extra stamp cname.loc; + let t = + { + Types.id = 0; + level = 0; + desc = + Tconstr + ( Path.Pident {Ident.stamp; name = d.name.txt; flags = 0}, + [], + ref Types.Mnil ); + } + in + add_loc_item extra cname.loc + (Typed + (d.name.txt, t, Definition (d.stamp, Constructor cname.txt)))) + | _ -> ())); extra let add_external_reference ~extra module_name path tip loc = @@ -135,14 +152,55 @@ let extra_for_cmt ~(iterator : Tast_iterator.iterator) extra_for_signature_items ~iterator items; extra_for_parts parts +(* The module and path of a member of a functor applied from another file: + the functor's path followed by the member's path inside its result. *) +let applied_global ~(env : Query_env.t) stamp (tip : Tip.t) = + let declared = + let of_declared (d : _ Declared.t) = (d.module_path, d.name.txt) in + match tip with + | Value -> Stamps.find_value env.file.stamps stamp |> Option.map of_declared + | Type | Field _ | Constructor _ -> + Stamps.find_type env.file.stamps stamp |> Option.map of_declared + | Module -> + Stamps.find_module env.file.stamps stamp |> Option.map of_declared + in + let rec loop (module_path : Module_path.t) inner = + match module_path with + | IncludedModule (functor_path, _) -> ( + match Resolve_path.from_compiler_path ~env functor_path with + | Global (module_name, path) -> Some (module_name, path @ inner) + | Stamp _ | Exported _ | GlobalMod _ | NotFound -> None) + | ExportedModule {name; module_path} -> loop module_path (name :: inner) + | File _ | NotVisible -> None + in + match declared with + | Some (module_path, name) when stamp >= Process_cmt.renamed_stamp_floor -> + loop module_path [name] + | _ -> None + +(* A use of a local declaration. A use of an applied functor's member is + also a use of the declaration in the functor's body that it was renamed + from, and when the functor is in another file, it is a use of that file's + declaration, as uses of the functor's own members are, for references + across files to find it. *) +let reference_to_stamp ~(env : Query_env.t) ~extra stamp tip loc = + match applied_global ~env stamp tip with + | Some (module_name, path) -> + add_external_reference ~extra module_name path tip loc; + GlobalReference (module_name, path, tip) + | None -> + add_reference ~extra stamp loc; + (match Hashtbl.find_opt env.file.renamed_stamps stamp with + | Some original -> add_reference ~extra original loc + | None -> ()); + LocalReference (stamp, tip) + let add_for_path ~env ~extra path lident loc typ tip = let ident_name = Longident.last lident in let ident_loc = Utils.end_of_location loc (String.length ident_name) in let loc_type = match Resolve_path.from_compiler_path ~env path with - | Stamp stamp -> - add_reference ~extra stamp ident_loc; - LocalReference (stamp, tip) + | Stamp stamp -> reference_to_stamp ~env ~extra stamp tip ident_loc | NotFound -> NotFound | Global (module_name, path) -> add_external_reference ~extra module_name path tip ident_loc; @@ -153,9 +211,7 @@ let add_for_path ~env ~extra path lident loc typ tip = | Type -> Exported.find env.exported Exported.Type name | _ -> Exported.find env.exported Exported.Value name with - | Some stamp -> - add_reference ~extra stamp ident_loc; - LocalReference (stamp, tip) + | Some stamp -> reference_to_stamp ~env ~extra stamp tip ident_loc | None -> NotFound) | GlobalMod _ -> NotFound in @@ -167,22 +223,28 @@ let add_for_path_parent ~env ~extra path loc = | GlobalMod module_name -> add_file_reference ~extra module_name loc; TopLevelModule module_name - | Stamp stamp -> - add_reference ~extra stamp loc; - LModule (LocalReference (stamp, Module)) + | Stamp stamp -> LModule (reference_to_stamp ~env ~extra stamp Module loc) | NotFound -> LModule NotFound | Global (module_name, path) -> add_external_reference ~extra module_name path Module loc; LModule (GlobalReference (module_name, path, Module)) | Exported (env, name) -> ( match Exported.find env.exported Exported.Module name with - | Some stamp -> - add_reference ~extra stamp loc; - LModule (LocalReference (stamp, Module)) + | Some stamp -> LModule (reference_to_stamp ~env ~extra stamp Module loc) | None -> LModule NotFound) in add_loc_item extra loc loc_type +(* A type of a functor applied from another file is that file's type, as + for its other members. *) +let get_type_at_stamp ~env stamp = + match applied_global ~env stamp Type with + | Some (module_name, path) -> `Global (module_name, path) + | None -> ( + match Stamps.find_type env.file.stamps stamp with + | Some declared_type -> `Local declared_type + | None -> `Not_found) + let get_type_at_path ~env path = match Resolve_path.from_compiler_path ~env path with | GlobalMod _ -> `Not_found @@ -191,16 +253,8 @@ let get_type_at_path ~env path = | Exported (env, name) -> ( match Exported.find env.exported Exported.Type name with | None -> `Not_found - | Some stamp -> ( - let declared_type = Stamps.find_type env.file.stamps stamp in - match declared_type with - | Some declared_type -> `Local declared_type - | None -> `Not_found)) - | Stamp stamp -> ( - let declared_type = Stamps.find_type env.file.stamps stamp in - match declared_type with - | Some declared_type -> `Local declared_type - | None -> `Not_found) + | Some stamp -> get_type_at_stamp ~env stamp) + | Stamp stamp -> get_type_at_stamp ~env stamp let add_for_field ~env ~extra ~record_type ~field_type {Asttypes.txt; loc} = match (Shared.dig record_type).desc with diff --git a/analysis/src/references.ml b/analysis/src/references.ml index a0da5bc553..1b2886eb86 100644 --- a/analysis/src/references.ml +++ b/analysis/src/references.ml @@ -124,27 +124,68 @@ let declared_for_tip ~(stamps : Stamps.t) stamp (tip : Tip.t) = Stamps.find_module stamps stamp |> Option.map (fun x -> {x with Declared.item = ()}) +(* The type a renamed type of an applied functor comes from, whose fields + and constructors have source locations. *) +let original_type_stamp (file : File.t) stamp = + match Hashtbl.find_opt file.renamed_stamps stamp with + | Some original -> original + | None -> stamp + +let field_of_type ({item = {kind}} : Type.t Declared.t) name = + match kind with + | Record fields -> fields |> List.find_opt (fun f -> f.fname.txt = name) + | _ -> None + +let constructor_of_type ({item = {kind}} : Type.t Declared.t) name = + match kind with + | Variant constructors -> + constructors + |> List.find_opt (fun const -> const.Constructor.cname.txt = name) + | _ -> None + let get_field (file : File.t) stamp name = - match Stamps.find_type file.stamps stamp with + match Stamps.find_type file.stamps (original_type_stamp file stamp) with | None -> None - | Some {item = {kind}} -> ( - match kind with - | Record fields -> fields |> List.find_opt (fun f -> f.fname.txt = name) - | _ -> None) + | Some declared -> field_of_type declared name let get_constructor (file : File.t) stamp name = - match Stamps.find_type file.stamps stamp with + match Stamps.find_type file.stamps (original_type_stamp file stamp) with | None -> None - | Some {item = {kind}} -> ( - match kind with - | Variant constructors -> ( + | Some declared -> constructor_of_type declared name + +(* The file a declaration is in. Items read from a signature, such as those + of an applied functor, are declared in this file but come from the + functor's file, which their module path records. *) +let declared_uri ~state ~package (file : File.t) (declared : _ Declared.t) = + Resolve_path.get_source_uri ~state ~env:(Query_env.from_file file) ~package + declared.module_path + +(* A type with its declaring file, for the locations of its fields and + constructors. A type of a functor applied from another file was renamed + from one that no file declares, and is looked up in the functor's file by + its location, among the types declared there rather than read from a + signature. *) +let source_type ~state ~package (file : File.t) stamp = + match Stamps.find_type file.stamps (original_type_stamp file stamp) with + | Some declared -> Some (file, declared) + | None -> ( + match Stamps.find_type file.stamps stamp with + | None -> None + | Some declared -> ( match - constructors - |> List.find_opt (fun const -> const.Constructor.cname.txt = name) + Cmt.full_from_uri ~state + ~uri:(declared_uri ~state ~package file declared) with | None -> None - | Some const -> Some const) - | _ -> None) + | Some {file = source} -> + Stamps.get_entries source.stamps + |> List.find_map (fun (source_stamp, kind) -> + match kind with + | Stamps.KType source_declared + when source_stamp < Process_cmt.renamed_stamp_floor + && source_declared.extent_loc = declared.extent_loc -> + Some (source, source_declared) + | _ -> None))) let exported_for_tip ~state ~env ~path ~package ~(tip : Tip.t) = match Resolve_path.resolve_path ~state ~env ~path ~package with @@ -303,24 +344,29 @@ let resolve_module_definition ~state ~(file : File.t) ~package stamp = | Some md -> ( match resolve_module_reference ~state ~file ~package md with | None -> None - | Some (file, declared) -> - let loc = - match declared with - | None -> Uri.to_top_level_loc file.uri - | Some declared -> validate_loc declared.name.loc declared.extent_loc - in - Some (file.uri, loc)) + | Some (file, declared) -> ( + match declared with + | None -> Some (file.uri, Uri.to_top_level_loc file.uri) + | Some declared -> + Some + ( declared_uri ~state ~package file declared, + validate_loc declared.name.loc declared.extent_loc ))) let definition ~state ~file ~package stamp (tip : Tip.t) = match tip with | Constructor name -> ( - match get_constructor file stamp name with + match source_type ~state ~package file stamp with | None -> None - | Some constructor -> Some (file.uri, constructor.cname.loc)) + | Some (file, declared) -> + constructor_of_type declared name + |> Option.map (fun (constructor : Constructor.t) -> + (file.uri, constructor.cname.loc))) | Field name -> ( - match get_field file stamp name with + match source_type ~state ~package file stamp with | None -> None - | Some field -> Some (file.uri, field.fname.loc)) + | Some (file, declared) -> + field_of_type declared name + |> Option.map (fun field -> (file.uri, field.fname.loc))) | Module -> resolve_module_definition ~state ~file ~package stamp | _ -> ( match declared_for_tip ~stamps:file.stamps stamp tip with @@ -334,11 +380,7 @@ let definition ~state ~file ~package stamp (tip : Tip.t) = | _ -> (file, declared) in let loc = validate_loc declared_impl.name.loc declared_impl.extent_loc in - let env = Query_env.from_file file_impl in - let uri = - Resolve_path.get_source_uri ~state ~env ~package - declared_impl.module_path - in + let uri = declared_uri ~state ~package file_impl declared_impl in maybe_log ("Inner uri " ^ Uri.to_string uri); Some (uri, loc)) @@ -418,7 +460,10 @@ let type_definition_for_loc_item ~state ~full:{file; package} loc_item = | None -> None | Some path -> ( match dig_constructor ~state ~env ~package path with - | Some (env, declared) -> Some (env.file.uri, declared.item.decl.type_loc) + | Some (env, declared) -> + Some + ( declared_uri ~state ~package env.file declared, + declared.item.decl.type_loc ) | None -> None)) let is_visible (declared : _ Declared.t) = @@ -440,6 +485,11 @@ type references = { let for_local_stamp ~state ~full:{file; extra; package} stamp (tip : Tip.t) = let env = Query_env.from_file file in + let stamp = + match Hashtbl.find_opt file.renamed_stamps stamp with + | Some original -> original + | None -> stamp + in match match tip with | Constructor name -> diff --git a/analysis/src/shared_types.ml b/analysis/src/shared_types.ml index 5333f40832..d23303fe4a 100644 --- a/analysis/src/shared_types.ml +++ b/analysis/src/shared_types.ml @@ -274,6 +274,7 @@ module File = struct stamps: Stamps.t; module_name: string; structure: Module.structure; + renamed_stamps: (int, int) Hashtbl.t; } let create module_name uri = @@ -281,6 +282,7 @@ module File = struct uri; stamps = Stamps.init (); module_name; + renamed_stamps = Hashtbl.create 1; structure = { name = module_name; @@ -404,7 +406,13 @@ and completion_type = } module Env = struct - type t = {stamps: Stamps.t; module_path: Module_path.t} + type t = { + stamps: Stamps.t; + module_path: Module_path.t; + renamed_stamps: (int, int) Hashtbl.t; + (** the stamps of an applied functor's renamed members, mapped to + those of the functor body's declarations they come from *) + } let add_exported_module ~name ~is_type env = { env with diff --git a/analysis/src/signature_help.ml b/analysis/src/signature_help.ml index 3462855f54..0f25de5f2d 100644 --- a/analysis/src/signature_help.ml +++ b/analysis/src/signature_help.ml @@ -9,10 +9,10 @@ let docs_for_label type_expr ~file ~state ~package ~supports_markdown_links = let type_names = types |> List.map (fun {Hover.name} -> name) in let type_definitions = types - |> List.map (fun {Hover.decl; name; env; loc; path} -> + |> List.map (fun {Hover.decl; name; loc; path; uri} -> let link_to_type_definition_str = if supports_markdown_links then - Markdown.go_to_definition_text ~env ~pos:loc.Warnings.loc_start + Markdown.go_to_definition_text ~uri ~pos:loc.Warnings.loc_start else "" in (* Since printing the whole name via its path can get quite long, and diff --git a/changes/applied-functor-analysis-types.fix.md b/changes/applied-functor-analysis-types.fix.md new file mode 100644 index 0000000000..2905eaf477 --- /dev/null +++ b/changes/applied-functor-analysis-types.fix.md @@ -0,0 +1 @@ +- Hover and completion on a module created by applying a functor show the applied types, such as `array`, instead of the functor body's `array`. diff --git a/tests/analysis_tests/tests/src/AppliedFunctor.res b/tests/analysis_tests/tests/src/AppliedFunctor.res new file mode 100644 index 0000000000..cccf4d99a5 --- /dev/null +++ b/tests/analysis_tests/tests/src/AppliedFunctor.res @@ -0,0 +1,158 @@ +module type Ord = { + type t + let compare: (t, t) => int +} + +module MakeSet = (O: Ord) => { + type t = array + let add = (s: t, x: O.t) => s->Array.concat([x]) + // ^ref +} + +module IntSet = MakeSet({ + type t = int + let compare = (a: int, b) => a - b +}) + +let s = IntSet.add([], 1) +// ^hov + +let s3 = IntSet.add([], 3) +// ^ref + +let s4 = IntSet.add([], 4) +// ^ren insert + +let t: IntSet.t = [] +// ^hov + +// let s2 = IntSet. +// ^com + +module WithNested = (O: Ord) => { + module Nested = { + // ^ref + let value = 1 + // ^ren nestedValue + } +} + +module IntOrd = { + type t = int + let compare = (a: int, b) => a - b +} + +module N = WithNested(IntOrd) + +let n = N.Nested.value +// ^ref + +module WithShapes = (O: Ord) => { + type point = {x: int} + // ^ref + type shape = Dot | Box(int) +} + +module Shapes = WithShapes(IntOrd) + +let p: Shapes.point = {x: 1} +let px = p.x +// ^def + +let shape = Shapes.Box(1) +// ^def + +let py = p.x +// ^ren y + +module WithModType = (O: Ord) => { + module type S = { + let value: int + // ^ref + } + module Nested: S = { + let value = 1 + } +} + +module Applied = WithModType(IntOrd) + +let nv = Applied.Nested.value +// ^hov + +// let nv2 = Applied.Nested. +// ^com + +let nv3 = Applied.Nested.value +// ^ren renamed + +module WithDeepModType = (O: Ord) => { + module Outer = { + module type T = { + module Inner: { + let deep: int + // ^ref + } + module type Abstract + } + module First: T = { + module Inner = { + let deep = 1 + } + module type Abstract = {} + } + module Second: T = { + module Inner = { + let deep = 2 + } + module type Abstract = {} + } + } +} + +module Deep = WithDeepModType(IntOrd) + +let d1 = Deep.Outer.First.Inner.deep +let d2 = Deep.Outer.Second.Inner.deep +// ^ref + +module type WithSig = { + module type S = { + let sigValue: int + // ^ref + } + module Nested: S +} + +module WithSigResult = (O: Ord): WithSig => { + module type S = { + let sigValue: int + } + module Nested = { + let sigValue = 1 + } +} + +module AppliedSig = WithSigResult(IntOrd) + +let sv = AppliedSig.Nested.sigValue +// ^ref + +module UseAppliedModType = (X: Applied.S) => { + let v = X.value + // ^ref +} + +module UseDeepModType = (Y: Deep.Outer.T) => { + let d = Y.Inner.deep + // ^ref +} + +let nm = N.Nested.value +// ^def + +let sp: Shapes.point = {x: 2} +// ^typ + +let spx = sp.x +// ^def diff --git a/tests/analysis_tests/tests/src/AppliedFunctorShapes.res b/tests/analysis_tests/tests/src/AppliedFunctorShapes.res new file mode 100644 index 0000000000..e8bd28306c --- /dev/null +++ b/tests/analysis_tests/tests/src/AppliedFunctorShapes.res @@ -0,0 +1,64 @@ +module type Ord = { + type t + let compare: (t, t) => int +} + +module IntOrd = { + type t = int + let compare = (a: int, b) => a - b +} + +module Inline = ((O: Ord) => { + let cmp = O.compare + // ^def + let one = 1 +})(IntOrd) + +let one = Inline.one +// ^def + +module InlineCurried = ((A: Ord, B: Ord) => { + let both = (A.compare, B.compare) + // ^hov +})(IntOrd, IntOrd) + +let both = InlineCurried.both +// ^ref + +module Generative = (() => { + let fresh = 1 +})() + +let fresh = Generative.fresh +// ^def + +module MakeTwo = (A: Ord, B: Ord) => { + let pair = (A.compare, B.compare) +} + +module Two = MakeTwo(IntOrd, IntOrd) + +let pair = Two.pair +// ^ref + +module Constrained = ((O: Ord) => { + let c = O.compare + // ^def +}: (O: Ord) => { + let c: (O.t, O.t) => int +})(IntOrd) + +let c = Constrained.c +// ^def + +module ToIdent = (O: Ord) => IntOrd + +module Ident = ToIdent(IntOrd) + +let ic = Ident.compare +// ^def + +module Nest = MakeTwo(ToIdent(IntOrd), IntOrd) + +let np = Nest.pair +// ^def diff --git a/tests/analysis_tests/tests/src/AppliedFunctorUse.res b/tests/analysis_tests/tests/src/AppliedFunctorUse.res new file mode 100644 index 0000000000..a25765ea10 --- /dev/null +++ b/tests/analysis_tests/tests/src/AppliedFunctorUse.res @@ -0,0 +1,103 @@ +module StrSet = AppliedFunctor.MakeSet({ + type t = string + let compare = (a: string, b) => a < b ? -1 : a > b ? 1 : 0 +}) + +let s = StrSet.add([], "a") +// ^def + +let t: StrSet.t = [] +// ^hov + +// let _ = StrSet.add( +// ^she + +let value: StrSet.t = [] +// ^typ + +let s2 = StrSet.add([], "b") +// ^ref + +module N = AppliedFunctor.WithNested(AppliedFunctor.IntOrd) + +let nv = N.Nested.value +// ^def + +let nv2 = N.Nested.value +// ^def + +let nv3 = N.Nested.value +// ^ref + +module Shapes = AppliedFunctor.WithShapes(AppliedFunctor.IntOrd) + +let p: Shapes.point = {x: 1} +// ^typ + +let px = p.x +// ^def + +let box = Shapes.Box(1) +// ^def + +module Local = (O: AppliedFunctor.Ord) => { + module Inner = { + type t = O.t + } +} + +module LocalApplied = Local(AppliedFunctor.IntOrd) + +let li: LocalApplied.Inner.t = 1 +// ^typ + +let li2: LocalApplied.Inner.t = 2 +// ^def + +let nv4 = N.Nested.value +// ^ref + +let p2: Shapes.point = {x: 2} +// ^ref + +let s3 = StrSet.add([], "c") +// ^ren addItem + +let p3: Shapes.point = {x: 3} +// ^ren location + +let nv5 = N.Nested.value +// ^ren renamedValue + +let px2 = p.x +// ^ref + +let box2 = Shapes.Box(2) +// ^ren Square + +module Make = AppliedFunctor.MakeSet + +module Aliased = Make(AppliedFunctor.IntOrd) + +let a = Aliased.add([], 1) +// ^def + +let av: Aliased.t = [] +// ^typ + +module Make2 = Make + +module Functors = { + module Make = Make2 +} + +module Chained = Functors.Make(AppliedFunctor.IntOrd) + +let c = Chained.add([], 1) +// ^def + +let cv: Chained.t = [] +// ^typ + +let a2 = Aliased.add([], 2) +// ^ref diff --git a/tests/analysis_tests/tests/src/expected/AppliedFunctor.res.txt b/tests/analysis_tests/tests/src/expected/AppliedFunctor.res.txt new file mode 100644 index 0000000000..fc6160221a --- /dev/null +++ b/tests/analysis_tests/tests/src/expected/AppliedFunctor.res.txt @@ -0,0 +1,885 @@ +References src/AppliedFunctor.res 7:7 +[ + { + "range": { + "end": { "character": 18, "line": 5 }, + "start": { "character": 15, "line": 5 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 19, "line": 17 }, + "start": { "character": 16, "line": 17 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 19, "line": 62 }, + "start": { "character": 16, "line": 62 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 19, "line": 81 }, + "start": { "character": 16, "line": 81 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 19, "line": 95 }, + "start": { "character": 16, "line": 95 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 20, "line": 101 }, + "start": { "character": 17, "line": 101 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 9, "line": 7 }, + "start": { "character": 6, "line": 7 } + }, + "uri": "file:///AppliedFunctor.res" + }, + { + "range": { + "end": { "character": 18, "line": 16 }, + "start": { "character": 15, "line": 16 } + }, + "uri": "file:///AppliedFunctor.res" + }, + { + "range": { + "end": { "character": 19, "line": 19 }, + "start": { "character": 16, "line": 19 } + }, + "uri": "file:///AppliedFunctor.res" + }, + { + "range": { + "end": { "character": 19, "line": 22 }, + "start": { "character": 16, "line": 22 } + }, + "uri": "file:///AppliedFunctor.res" + } +] + +Hover src/AppliedFunctor.res 16:15 +{ + "contents": { + "kind": "markdown", + "value": "```rescript\n(IntSet.t, int) => array\n```\n\n---\n\n```\n \n```\n```rescript\ntype IntSet.t = array\n```\nGo to: [Type definition](AppliedFunctor.res#L7,3)\n" + } +} + +References src/AppliedFunctor.res 19:16 +[ + { + "range": { + "end": { "character": 18, "line": 5 }, + "start": { "character": 15, "line": 5 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 19, "line": 17 }, + "start": { "character": 16, "line": 17 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 19, "line": 62 }, + "start": { "character": 16, "line": 62 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 19, "line": 81 }, + "start": { "character": 16, "line": 81 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 19, "line": 95 }, + "start": { "character": 16, "line": 95 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 20, "line": 101 }, + "start": { "character": 17, "line": 101 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 9, "line": 7 }, + "start": { "character": 6, "line": 7 } + }, + "uri": "file:///AppliedFunctor.res" + }, + { + "range": { + "end": { "character": 18, "line": 16 }, + "start": { "character": 15, "line": 16 } + }, + "uri": "file:///AppliedFunctor.res" + }, + { + "range": { + "end": { "character": 19, "line": 19 }, + "start": { "character": 16, "line": 19 } + }, + "uri": "file:///AppliedFunctor.res" + }, + { + "range": { + "end": { "character": 19, "line": 22 }, + "start": { "character": 16, "line": 22 } + }, + "uri": "file:///AppliedFunctor.res" + } +] + +Rename src/AppliedFunctor.res 22:16 insert +[ + { + "edits": [ + { + "newText": "insert", + "range": { + "end": { "character": 18, "line": 5 }, + "start": { "character": 15, "line": 5 } + } + }, + { + "newText": "insert", + "range": { + "end": { "character": 19, "line": 17 }, + "start": { "character": 16, "line": 17 } + } + }, + { + "newText": "insert", + "range": { + "end": { "character": 19, "line": 62 }, + "start": { "character": 16, "line": 62 } + } + }, + { + "newText": "insert", + "range": { + "end": { "character": 19, "line": 81 }, + "start": { "character": 16, "line": 81 } + } + }, + { + "newText": "insert", + "range": { + "end": { "character": 19, "line": 95 }, + "start": { "character": 16, "line": 95 } + } + }, + { + "newText": "insert", + "range": { + "end": { "character": 20, "line": 101 }, + "start": { "character": 17, "line": 101 } + } + } + ], + "textDocument": { "uri": "file:///AppliedFunctorUse.res", "version": 0 } + }, + { + "edits": [ + { + "newText": "insert", + "range": { + "end": { "character": 9, "line": 7 }, + "start": { "character": 6, "line": 7 } + } + }, + { + "newText": "insert", + "range": { + "end": { "character": 18, "line": 16 }, + "start": { "character": 15, "line": 16 } + } + }, + { + "newText": "insert", + "range": { + "end": { "character": 19, "line": 19 }, + "start": { "character": 16, "line": 19 } + } + }, + { + "newText": "insert", + "range": { + "end": { "character": 19, "line": 22 }, + "start": { "character": 16, "line": 22 } + } + } + ], + "textDocument": { "uri": "file:///AppliedFunctor.res", "version": 0 } + } +] + +Hover src/AppliedFunctor.res 25:14 +{ + "contents": { + "kind": "markdown", + "value": "```rescript\nIntSet.t\n```\n\n---\n\n```\n \n```\n```rescript\ntype IntSet.t = array\n```\nGo to: [Type definition](AppliedFunctor.res#L7,3)\n" + } +} + +Complete src/AppliedFunctor.res 28:19 +pos_cursor:[28:19] pos_no_white:[28:18] Found expr:[28:12->28:19] +Pexp_ident IntSet.:[28:12->28:19] +Completable: Cpath Value[IntSet, ""] +Package opens Stdlib.place holder Pervasives.JsxModules.place holder +Resolved opens 1 Stdlib +ContextPath Value[IntSet, ""] +Path IntSet. +[ + { + "detail": "(t, int) => array", + "kind": 12, + "label": "add", + "tags": [] + } +] + +References src/AppliedFunctor.res 32:11 +[ + { + "range": { + "end": { "character": 17, "line": 22 }, + "start": { "character": 11, "line": 22 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 18, "line": 25 }, + "start": { "character": 12, "line": 25 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 18, "line": 28 }, + "start": { "character": 12, "line": 28 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 18, "line": 56 }, + "start": { "character": 12, "line": 56 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 18, "line": 68 }, + "start": { "character": 12, "line": 68 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 15, "line": 32 }, + "start": { "character": 9, "line": 32 } + }, + "uri": "file:///AppliedFunctor.res" + }, + { + "range": { + "end": { "character": 16, "line": 46 }, + "start": { "character": 10, "line": 46 } + }, + "uri": "file:///AppliedFunctor.res" + }, + { + "range": { + "end": { "character": 17, "line": 150 }, + "start": { "character": 11, "line": 150 } + }, + "uri": "file:///AppliedFunctor.res" + } +] + +Rename src/AppliedFunctor.res 34:8 nestedValue +[ + { + "edits": [ + { + "newText": "nestedValue", + "range": { + "end": { "character": 23, "line": 22 }, + "start": { "character": 18, "line": 22 } + } + }, + { + "newText": "nestedValue", + "range": { + "end": { "character": 24, "line": 25 }, + "start": { "character": 19, "line": 25 } + } + }, + { + "newText": "nestedValue", + "range": { + "end": { "character": 24, "line": 28 }, + "start": { "character": 19, "line": 28 } + } + }, + { + "newText": "nestedValue", + "range": { + "end": { "character": 24, "line": 56 }, + "start": { "character": 19, "line": 56 } + } + }, + { + "newText": "nestedValue", + "range": { + "end": { "character": 24, "line": 68 }, + "start": { "character": 19, "line": 68 } + } + } + ], + "textDocument": { "uri": "file:///AppliedFunctorUse.res", "version": 0 } + }, + { + "edits": [ + { + "newText": "nestedValue", + "range": { + "end": { "character": 13, "line": 34 }, + "start": { "character": 8, "line": 34 } + } + }, + { + "newText": "nestedValue", + "range": { + "end": { "character": 22, "line": 46 }, + "start": { "character": 17, "line": 46 } + } + }, + { + "newText": "nestedValue", + "range": { + "end": { "character": 23, "line": 150 }, + "start": { "character": 18, "line": 150 } + } + } + ], + "textDocument": { "uri": "file:///AppliedFunctor.res", "version": 0 } + } +] + +References src/AppliedFunctor.res 46:10 +[ + { + "range": { + "end": { "character": 17, "line": 22 }, + "start": { "character": 11, "line": 22 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 18, "line": 25 }, + "start": { "character": 12, "line": 25 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 18, "line": 28 }, + "start": { "character": 12, "line": 28 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 18, "line": 56 }, + "start": { "character": 12, "line": 56 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 18, "line": 68 }, + "start": { "character": 12, "line": 68 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 15, "line": 32 }, + "start": { "character": 9, "line": 32 } + }, + "uri": "file:///AppliedFunctor.res" + }, + { + "range": { + "end": { "character": 16, "line": 46 }, + "start": { "character": 10, "line": 46 } + }, + "uri": "file:///AppliedFunctor.res" + }, + { + "range": { + "end": { "character": 17, "line": 150 }, + "start": { "character": 11, "line": 150 } + }, + "uri": "file:///AppliedFunctor.res" + } +] + +References src/AppliedFunctor.res 50:7 +[ + { + "range": { + "end": { "character": 19, "line": 33 }, + "start": { "character": 14, "line": 33 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 20, "line": 59 }, + "start": { "character": 15, "line": 59 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 20, "line": 65 }, + "start": { "character": 15, "line": 65 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 12, "line": 50 }, + "start": { "character": 7, "line": 50 } + }, + "uri": "file:///AppliedFunctor.res" + }, + { + "range": { + "end": { "character": 19, "line": 57 }, + "start": { "character": 14, "line": 57 } + }, + "uri": "file:///AppliedFunctor.res" + }, + { + "range": { + "end": { "character": 20, "line": 153 }, + "start": { "character": 15, "line": 153 } + }, + "uri": "file:///AppliedFunctor.res" + } +] + +Definition src/AppliedFunctor.res 58:11 +{ + "range": { + "end": { "character": 17, "line": 50 }, + "start": { "character": 16, "line": 50 } + }, + "uri": "file:///AppliedFunctor.res" +} + +Definition src/AppliedFunctor.res 61:19 +{ + "range": { + "end": { "character": 24, "line": 52 }, + "start": { "character": 21, "line": 52 } + }, + "uri": "file:///AppliedFunctor.res" +} + +Rename src/AppliedFunctor.res 64:11 y +[ + { + "edits": [ + { + "newText": "y", + "range": { + "end": { "character": 24, "line": 33 }, + "start": { "character": 23, "line": 33 } + } + }, + { + "newText": "y", + "range": { + "end": { "character": 12, "line": 36 }, + "start": { "character": 11, "line": 36 } + } + }, + { + "newText": "y", + "range": { + "end": { "character": 25, "line": 59 }, + "start": { "character": 24, "line": 59 } + } + }, + { + "newText": "y", + "range": { + "end": { "character": 25, "line": 65 }, + "start": { "character": 24, "line": 65 } + } + }, + { + "newText": "y", + "range": { + "end": { "character": 13, "line": 71 }, + "start": { "character": 12, "line": 71 } + } + } + ], + "textDocument": { "uri": "file:///AppliedFunctorUse.res", "version": 0 } + }, + { + "edits": [ + { + "newText": "y", + "range": { + "end": { "character": 17, "line": 50 }, + "start": { "character": 16, "line": 50 } + } + }, + { + "newText": "y", + "range": { + "end": { "character": 24, "line": 57 }, + "start": { "character": 23, "line": 57 } + } + }, + { + "newText": "y", + "range": { + "end": { "character": 12, "line": 58 }, + "start": { "character": 11, "line": 58 } + } + }, + { + "newText": "y", + "range": { + "end": { "character": 12, "line": 64 }, + "start": { "character": 11, "line": 64 } + } + }, + { + "newText": "y", + "range": { + "end": { "character": 25, "line": 153 }, + "start": { "character": 24, "line": 153 } + } + }, + { + "newText": "y", + "range": { + "end": { "character": 14, "line": 156 }, + "start": { "character": 13, "line": 156 } + } + } + ], + "textDocument": { "uri": "file:///AppliedFunctor.res", "version": 0 } + } +] + +References src/AppliedFunctor.res 69:8 +[ + { + "range": { + "end": { "character": 18, "line": 69 }, + "start": { "character": 4, "line": 69 } + }, + "uri": "file:///AppliedFunctor.res" + }, + { + "range": { + "end": { "character": 29, "line": 79 }, + "start": { "character": 24, "line": 79 } + }, + "uri": "file:///AppliedFunctor.res" + }, + { + "range": { + "end": { "character": 30, "line": 85 }, + "start": { "character": 25, "line": 85 } + }, + "uri": "file:///AppliedFunctor.res" + }, + { + "range": { + "end": { "character": 17, "line": 141 }, + "start": { "character": 12, "line": 141 } + }, + "uri": "file:///AppliedFunctor.res" + } +] + +Hover src/AppliedFunctor.res 79:24 +{ "contents": { "kind": "markdown", "value": "```rescript\nint\n```" } } + +Complete src/AppliedFunctor.res 82:28 +pos_cursor:[82:28] pos_no_white:[82:27] Found expr:[82:13->82:28] +Pexp_ident Applied.Nested.:[82:13->82:28] +Completable: Cpath Value[Applied, Nested, ""] +Package opens Stdlib.place holder Pervasives.JsxModules.place holder +Resolved opens 1 Stdlib +ContextPath Value[Applied, Nested, ""] +Path Applied.Nested. +[ { "detail": "int", "kind": 12, "label": "value", "tags": [] } ] + +Rename src/AppliedFunctor.res 85:25 renamed +[ + { + "edits": [ + { + "newText": "renamed", + "range": { + "end": { "character": 18, "line": 69 }, + "start": { "character": 4, "line": 69 } + } + }, + { + "newText": "renamed", + "range": { + "end": { "character": 29, "line": 79 }, + "start": { "character": 24, "line": 79 } + } + }, + { + "newText": "renamed", + "range": { + "end": { "character": 30, "line": 85 }, + "start": { "character": 25, "line": 85 } + } + }, + { + "newText": "renamed", + "range": { + "end": { "character": 17, "line": 141 }, + "start": { "character": 12, "line": 141 } + } + } + ], + "textDocument": { "uri": "file:///AppliedFunctor.res", "version": 0 } + } +] + +References src/AppliedFunctor.res 92:12 +[ + { + "range": { + "end": { "character": 21, "line": 92 }, + "start": { "character": 8, "line": 92 } + }, + "uri": "file:///AppliedFunctor.res" + }, + { + "range": { + "end": { "character": 36, "line": 114 }, + "start": { "character": 32, "line": 114 } + }, + "uri": "file:///AppliedFunctor.res" + }, + { + "range": { + "end": { "character": 37, "line": 115 }, + "start": { "character": 33, "line": 115 } + }, + "uri": "file:///AppliedFunctor.res" + }, + { + "range": { + "end": { "character": 22, "line": 146 }, + "start": { "character": 18, "line": 146 } + }, + "uri": "file:///AppliedFunctor.res" + } +] + +References src/AppliedFunctor.res 115:33 +[ + { + "range": { + "end": { "character": 21, "line": 92 }, + "start": { "character": 8, "line": 92 } + }, + "uri": "file:///AppliedFunctor.res" + }, + { + "range": { + "end": { "character": 36, "line": 114 }, + "start": { "character": 32, "line": 114 } + }, + "uri": "file:///AppliedFunctor.res" + }, + { + "range": { + "end": { "character": 37, "line": 115 }, + "start": { "character": 33, "line": 115 } + }, + "uri": "file:///AppliedFunctor.res" + }, + { + "range": { + "end": { "character": 22, "line": 146 }, + "start": { "character": 18, "line": 146 } + }, + "uri": "file:///AppliedFunctor.res" + } +] + +References src/AppliedFunctor.res 120:8 +get_loc_item #8: heuristic for JSX with at most one child +heuristic for: [makeProps, make, createElement], give the loc of `make` +[ + { + "range": { + "end": { "character": 21, "line": 120 }, + "start": { "character": 4, "line": 120 } + }, + "uri": "file:///AppliedFunctor.res" + }, + { + "range": { + "end": { "character": 35, "line": 137 }, + "start": { "character": 27, "line": 137 } + }, + "uri": "file:///AppliedFunctor.res" + } +] + +References src/AppliedFunctor.res 137:27 +[ + { + "range": { + "end": { "character": 21, "line": 120 }, + "start": { "character": 4, "line": 120 } + }, + "uri": "file:///AppliedFunctor.res" + }, + { + "range": { + "end": { "character": 35, "line": 137 }, + "start": { "character": 27, "line": 137 } + }, + "uri": "file:///AppliedFunctor.res" + } +] + +References src/AppliedFunctor.res 141:12 +[ + { + "range": { + "end": { "character": 18, "line": 69 }, + "start": { "character": 4, "line": 69 } + }, + "uri": "file:///AppliedFunctor.res" + }, + { + "range": { + "end": { "character": 29, "line": 79 }, + "start": { "character": 24, "line": 79 } + }, + "uri": "file:///AppliedFunctor.res" + }, + { + "range": { + "end": { "character": 30, "line": 85 }, + "start": { "character": 25, "line": 85 } + }, + "uri": "file:///AppliedFunctor.res" + }, + { + "range": { + "end": { "character": 17, "line": 141 }, + "start": { "character": 12, "line": 141 } + }, + "uri": "file:///AppliedFunctor.res" + } +] + +References src/AppliedFunctor.res 146:18 +[ + { + "range": { + "end": { "character": 21, "line": 92 }, + "start": { "character": 8, "line": 92 } + }, + "uri": "file:///AppliedFunctor.res" + }, + { + "range": { + "end": { "character": 36, "line": 114 }, + "start": { "character": 32, "line": 114 } + }, + "uri": "file:///AppliedFunctor.res" + }, + { + "range": { + "end": { "character": 37, "line": 115 }, + "start": { "character": 33, "line": 115 } + }, + "uri": "file:///AppliedFunctor.res" + }, + { + "range": { + "end": { "character": 22, "line": 146 }, + "start": { "character": 18, "line": 146 } + }, + "uri": "file:///AppliedFunctor.res" + } +] + +Definition src/AppliedFunctor.res 150:11 +{ + "range": { + "end": { "character": 3, "line": 36 }, + "start": { "character": 9, "line": 32 } + }, + "uri": "file:///AppliedFunctor.res" +} + +TypeDefinition src/AppliedFunctor.res 153:4 +{ + "range": { + "end": { "character": 23, "line": 50 }, + "start": { "character": 2, "line": 50 } + }, + "uri": "file:///AppliedFunctor.res" +} + +Definition src/AppliedFunctor.res 156:13 +{ + "range": { + "end": { "character": 17, "line": 50 }, + "start": { "character": 16, "line": 50 } + }, + "uri": "file:///AppliedFunctor.res" +} + diff --git a/tests/analysis_tests/tests/src/expected/AppliedFunctorShapes.res.txt b/tests/analysis_tests/tests/src/expected/AppliedFunctorShapes.res.txt new file mode 100644 index 0000000000..0b773e67e6 --- /dev/null +++ b/tests/analysis_tests/tests/src/expected/AppliedFunctorShapes.res.txt @@ -0,0 +1,114 @@ +Definition src/AppliedFunctorShapes.res 11:14 +{ + "range": { + "end": { "character": 28, "line": 2 }, + "start": { "character": 2, "line": 2 } + }, + "uri": "file:///AppliedFunctorShapes.res" +} + +Definition src/AppliedFunctorShapes.res 16:17 +{ + "range": { + "end": { "character": 9, "line": 13 }, + "start": { "character": 6, "line": 13 } + }, + "uri": "file:///AppliedFunctorShapes.res" +} + +Hover src/AppliedFunctorShapes.res 20:27 +{ + "contents": { + "kind": "markdown", + "value": "```rescript\n(B.t, B.t) => int\n```\n\n---\n\n```\n \n```\n```rescript\ntype B.t\n```\nGo to: [Type definition](AppliedFunctorShapes.res#L2,3)\n" + } +} + +References src/AppliedFunctorShapes.res 24:25 +[ + { + "range": { + "end": { "character": 10, "line": 20 }, + "start": { "character": 6, "line": 20 } + }, + "uri": "file:///AppliedFunctorShapes.res" + }, + { + "range": { + "end": { "character": 29, "line": 24 }, + "start": { "character": 25, "line": 24 } + }, + "uri": "file:///AppliedFunctorShapes.res" + } +] + +Definition src/AppliedFunctorShapes.res 31:23 +{ + "range": { + "end": { "character": 11, "line": 28 }, + "start": { "character": 6, "line": 28 } + }, + "uri": "file:///AppliedFunctorShapes.res" +} + +References src/AppliedFunctorShapes.res 40:15 +[ + { + "range": { + "end": { "character": 10, "line": 35 }, + "start": { "character": 6, "line": 35 } + }, + "uri": "file:///AppliedFunctorShapes.res" + }, + { + "range": { + "end": { "character": 19, "line": 40 }, + "start": { "character": 15, "line": 40 } + }, + "uri": "file:///AppliedFunctorShapes.res" + }, + { + "range": { + "end": { "character": 18, "line": 62 }, + "start": { "character": 14, "line": 62 } + }, + "uri": "file:///AppliedFunctorShapes.res" + } +] + +Definition src/AppliedFunctorShapes.res 44:12 +{ + "range": { + "end": { "character": 28, "line": 2 }, + "start": { "character": 2, "line": 2 } + }, + "uri": "file:///AppliedFunctorShapes.res" +} + +Definition src/AppliedFunctorShapes.res 50:20 +{ + "range": { + "end": { "character": 26, "line": 47 }, + "start": { "character": 2, "line": 47 } + }, + "uri": "file:///AppliedFunctorShapes.res" +} + +Definition src/AppliedFunctorShapes.res 57:15 +{ + "range": { + "end": { "character": 13, "line": 7 }, + "start": { "character": 6, "line": 7 } + }, + "uri": "file:///AppliedFunctorShapes.res" +} + +Definition src/AppliedFunctorShapes.res 62:14 +{ + "range": { + "end": { "character": 10, "line": 35 }, + "start": { "character": 6, "line": 35 } + }, + "uri": "file:///AppliedFunctorShapes.res" +} + diff --git a/tests/analysis_tests/tests/src/expected/AppliedFunctorUse.res.txt b/tests/analysis_tests/tests/src/expected/AppliedFunctorUse.res.txt new file mode 100644 index 0000000000..3936096ab2 --- /dev/null +++ b/tests/analysis_tests/tests/src/expected/AppliedFunctorUse.res.txt @@ -0,0 +1,809 @@ +Definition src/AppliedFunctorUse.res 5:15 +{ + "range": { + "end": { "character": 9, "line": 7 }, + "start": { "character": 6, "line": 7 } + }, + "uri": "file:///AppliedFunctor.res" +} + +Hover src/AppliedFunctorUse.res 8:14 +{ + "contents": { + "kind": "markdown", + "value": "```rescript\nStrSet.t\n```\n\n---\n\n```\n \n```\n```rescript\ntype StrSet.t = array\n```\nGo to: [Type definition](AppliedFunctor.res#L7,3)\n" + } +} + +Signature help src/AppliedFunctorUse.res 11:22 +pos_cursor:[11:21] pos_no_white:[11:20] Found expr:[11:11->11:22] +Pexp_apply ...[11:11->11:21] (...[14:0->11:22]) +pos_cursor:[11:21] pos_no_white:[11:20] Found expr:[11:11->11:21] +Pexp_ident StrSet.add:[11:11->11:21] +Completable: Cpath Value[StrSet, add] +Package opens Stdlib.place holder Pervasives.JsxModules.place holder +Resolved opens 1 Stdlib +ContextPath Value[StrSet, add] +Path StrSet.add +arg_at_cursor: unlabelled<0> +extracted params: +[t, string] +{ + "activeParameter": 0, + "activeSignature": 0, + "signatures": [ + { + "activeParameter": 0, + "label": "(t, string) => array", + "parameters": [ + { + "documentation": { + "kind": "markdown", + "value": "```rescript\ntype t = array\n```\nGo to: [Type definition](AppliedFunctor.res#L7,3)" + }, + "label": [ 1, 2 ] + }, + { + "documentation": { "kind": "markdown", "value": "" }, + "label": [ 4, 10 ] + } + ] + } + ] +} + +TypeDefinition src/AppliedFunctorUse.res 14:5 +{ + "range": { + "end": { "character": 21, "line": 6 }, + "start": { "character": 2, "line": 6 } + }, + "uri": "file:///AppliedFunctor.res" +} + +References src/AppliedFunctorUse.res 17:16 +[ + { + "range": { + "end": { "character": 18, "line": 5 }, + "start": { "character": 15, "line": 5 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 19, "line": 17 }, + "start": { "character": 16, "line": 17 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 19, "line": 62 }, + "start": { "character": 16, "line": 62 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 19, "line": 81 }, + "start": { "character": 16, "line": 81 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 19, "line": 95 }, + "start": { "character": 16, "line": 95 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 20, "line": 101 }, + "start": { "character": 17, "line": 101 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 9, "line": 7 }, + "start": { "character": 6, "line": 7 } + }, + "uri": "file:///AppliedFunctor.res" + }, + { + "range": { + "end": { "character": 18, "line": 16 }, + "start": { "character": 15, "line": 16 } + }, + "uri": "file:///AppliedFunctor.res" + }, + { + "range": { + "end": { "character": 19, "line": 19 }, + "start": { "character": 16, "line": 19 } + }, + "uri": "file:///AppliedFunctor.res" + }, + { + "range": { + "end": { "character": 19, "line": 22 }, + "start": { "character": 16, "line": 22 } + }, + "uri": "file:///AppliedFunctor.res" + } +] + +Definition src/AppliedFunctorUse.res 22:11 +{ + "range": { + "end": { "character": 15, "line": 32 }, + "start": { "character": 9, "line": 32 } + }, + "uri": "file:///AppliedFunctor.res" +} + +Definition src/AppliedFunctorUse.res 25:19 +{ + "range": { + "end": { "character": 13, "line": 34 }, + "start": { "character": 8, "line": 34 } + }, + "uri": "file:///AppliedFunctor.res" +} + +References src/AppliedFunctorUse.res 28:19 +[ + { + "range": { + "end": { "character": 23, "line": 22 }, + "start": { "character": 18, "line": 22 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 24, "line": 25 }, + "start": { "character": 19, "line": 25 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 24, "line": 28 }, + "start": { "character": 19, "line": 28 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 24, "line": 56 }, + "start": { "character": 19, "line": 56 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 24, "line": 68 }, + "start": { "character": 19, "line": 68 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 13, "line": 34 }, + "start": { "character": 8, "line": 34 } + }, + "uri": "file:///AppliedFunctor.res" + }, + { + "range": { + "end": { "character": 22, "line": 46 }, + "start": { "character": 17, "line": 46 } + }, + "uri": "file:///AppliedFunctor.res" + }, + { + "range": { + "end": { "character": 23, "line": 150 }, + "start": { "character": 18, "line": 150 } + }, + "uri": "file:///AppliedFunctor.res" + } +] + +TypeDefinition src/AppliedFunctorUse.res 33:4 +{ + "range": { + "end": { "character": 23, "line": 50 }, + "start": { "character": 2, "line": 50 } + }, + "uri": "file:///AppliedFunctor.res" +} + +Definition src/AppliedFunctorUse.res 36:11 +{ + "range": { + "end": { "character": 17, "line": 50 }, + "start": { "character": 16, "line": 50 } + }, + "uri": "file:///AppliedFunctor.res" +} + +Definition src/AppliedFunctorUse.res 39:17 +{ + "range": { + "end": { "character": 24, "line": 52 }, + "start": { "character": 21, "line": 52 } + }, + "uri": "file:///AppliedFunctor.res" +} + +TypeDefinition src/AppliedFunctorUse.res 50:4 +{ + "range": { + "end": { "character": 16, "line": 44 }, + "start": { "character": 4, "line": 44 } + }, + "uri": "file:///AppliedFunctorUse.res" +} + +Definition src/AppliedFunctorUse.res 53:21 +{ + "range": { + "end": { "character": 19, "line": 48 }, + "start": { "character": 7, "line": 48 } + }, + "uri": "file:///AppliedFunctorUse.res" +} + +References src/AppliedFunctorUse.res 56:12 +[ + { + "range": { + "end": { "character": 17, "line": 22 }, + "start": { "character": 11, "line": 22 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 18, "line": 25 }, + "start": { "character": 12, "line": 25 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 18, "line": 28 }, + "start": { "character": 12, "line": 28 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 18, "line": 56 }, + "start": { "character": 12, "line": 56 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 18, "line": 68 }, + "start": { "character": 12, "line": 68 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 15, "line": 32 }, + "start": { "character": 9, "line": 32 } + }, + "uri": "file:///AppliedFunctor.res" + }, + { + "range": { + "end": { "character": 16, "line": 46 }, + "start": { "character": 10, "line": 46 } + }, + "uri": "file:///AppliedFunctor.res" + }, + { + "range": { + "end": { "character": 17, "line": 150 }, + "start": { "character": 11, "line": 150 } + }, + "uri": "file:///AppliedFunctor.res" + } +] + +References src/AppliedFunctorUse.res 59:15 +[ + { + "range": { + "end": { "character": 19, "line": 33 }, + "start": { "character": 14, "line": 33 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 20, "line": 59 }, + "start": { "character": 15, "line": 59 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 20, "line": 65 }, + "start": { "character": 15, "line": 65 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 12, "line": 50 }, + "start": { "character": 7, "line": 50 } + }, + "uri": "file:///AppliedFunctor.res" + }, + { + "range": { + "end": { "character": 19, "line": 57 }, + "start": { "character": 14, "line": 57 } + }, + "uri": "file:///AppliedFunctor.res" + }, + { + "range": { + "end": { "character": 20, "line": 153 }, + "start": { "character": 15, "line": 153 } + }, + "uri": "file:///AppliedFunctor.res" + } +] + +Rename src/AppliedFunctorUse.res 62:16 addItem +[ + { + "edits": [ + { + "newText": "addItem", + "range": { + "end": { "character": 18, "line": 5 }, + "start": { "character": 15, "line": 5 } + } + }, + { + "newText": "addItem", + "range": { + "end": { "character": 19, "line": 17 }, + "start": { "character": 16, "line": 17 } + } + }, + { + "newText": "addItem", + "range": { + "end": { "character": 19, "line": 62 }, + "start": { "character": 16, "line": 62 } + } + }, + { + "newText": "addItem", + "range": { + "end": { "character": 19, "line": 81 }, + "start": { "character": 16, "line": 81 } + } + }, + { + "newText": "addItem", + "range": { + "end": { "character": 19, "line": 95 }, + "start": { "character": 16, "line": 95 } + } + }, + { + "newText": "addItem", + "range": { + "end": { "character": 20, "line": 101 }, + "start": { "character": 17, "line": 101 } + } + } + ], + "textDocument": { "uri": "file:///AppliedFunctorUse.res", "version": 0 } + }, + { + "edits": [ + { + "newText": "addItem", + "range": { + "end": { "character": 9, "line": 7 }, + "start": { "character": 6, "line": 7 } + } + }, + { + "newText": "addItem", + "range": { + "end": { "character": 18, "line": 16 }, + "start": { "character": 15, "line": 16 } + } + }, + { + "newText": "addItem", + "range": { + "end": { "character": 19, "line": 19 }, + "start": { "character": 16, "line": 19 } + } + }, + { + "newText": "addItem", + "range": { + "end": { "character": 19, "line": 22 }, + "start": { "character": 16, "line": 22 } + } + } + ], + "textDocument": { "uri": "file:///AppliedFunctor.res", "version": 0 } + } +] + +Rename src/AppliedFunctorUse.res 65:15 location +[ + { + "edits": [ + { + "newText": "location", + "range": { + "end": { "character": 19, "line": 33 }, + "start": { "character": 14, "line": 33 } + } + }, + { + "newText": "location", + "range": { + "end": { "character": 20, "line": 59 }, + "start": { "character": 15, "line": 59 } + } + }, + { + "newText": "location", + "range": { + "end": { "character": 20, "line": 65 }, + "start": { "character": 15, "line": 65 } + } + } + ], + "textDocument": { "uri": "file:///AppliedFunctorUse.res", "version": 0 } + }, + { + "edits": [ + { + "newText": "location", + "range": { + "end": { "character": 12, "line": 50 }, + "start": { "character": 7, "line": 50 } + } + }, + { + "newText": "location", + "range": { + "end": { "character": 19, "line": 57 }, + "start": { "character": 14, "line": 57 } + } + }, + { + "newText": "location", + "range": { + "end": { "character": 20, "line": 153 }, + "start": { "character": 15, "line": 153 } + } + } + ], + "textDocument": { "uri": "file:///AppliedFunctor.res", "version": 0 } + } +] + +Rename src/AppliedFunctorUse.res 68:19 renamedValue +[ + { + "edits": [ + { + "newText": "renamedValue", + "range": { + "end": { "character": 23, "line": 22 }, + "start": { "character": 18, "line": 22 } + } + }, + { + "newText": "renamedValue", + "range": { + "end": { "character": 24, "line": 25 }, + "start": { "character": 19, "line": 25 } + } + }, + { + "newText": "renamedValue", + "range": { + "end": { "character": 24, "line": 28 }, + "start": { "character": 19, "line": 28 } + } + }, + { + "newText": "renamedValue", + "range": { + "end": { "character": 24, "line": 56 }, + "start": { "character": 19, "line": 56 } + } + }, + { + "newText": "renamedValue", + "range": { + "end": { "character": 24, "line": 68 }, + "start": { "character": 19, "line": 68 } + } + } + ], + "textDocument": { "uri": "file:///AppliedFunctorUse.res", "version": 0 } + }, + { + "edits": [ + { + "newText": "renamedValue", + "range": { + "end": { "character": 13, "line": 34 }, + "start": { "character": 8, "line": 34 } + } + }, + { + "newText": "renamedValue", + "range": { + "end": { "character": 22, "line": 46 }, + "start": { "character": 17, "line": 46 } + } + }, + { + "newText": "renamedValue", + "range": { + "end": { "character": 23, "line": 150 }, + "start": { "character": 18, "line": 150 } + } + } + ], + "textDocument": { "uri": "file:///AppliedFunctor.res", "version": 0 } + } +] + +References src/AppliedFunctorUse.res 71:12 +[ + { + "range": { + "end": { "character": 24, "line": 33 }, + "start": { "character": 23, "line": 33 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 12, "line": 36 }, + "start": { "character": 11, "line": 36 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 25, "line": 59 }, + "start": { "character": 24, "line": 59 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 25, "line": 65 }, + "start": { "character": 24, "line": 65 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 13, "line": 71 }, + "start": { "character": 12, "line": 71 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 17, "line": 50 }, + "start": { "character": 16, "line": 50 } + }, + "uri": "file:///AppliedFunctor.res" + }, + { + "range": { + "end": { "character": 24, "line": 57 }, + "start": { "character": 23, "line": 57 } + }, + "uri": "file:///AppliedFunctor.res" + }, + { + "range": { + "end": { "character": 12, "line": 58 }, + "start": { "character": 11, "line": 58 } + }, + "uri": "file:///AppliedFunctor.res" + }, + { + "range": { + "end": { "character": 12, "line": 64 }, + "start": { "character": 11, "line": 64 } + }, + "uri": "file:///AppliedFunctor.res" + }, + { + "range": { + "end": { "character": 25, "line": 153 }, + "start": { "character": 24, "line": 153 } + }, + "uri": "file:///AppliedFunctor.res" + }, + { + "range": { + "end": { "character": 14, "line": 156 }, + "start": { "character": 13, "line": 156 } + }, + "uri": "file:///AppliedFunctor.res" + } +] + +Rename src/AppliedFunctorUse.res 74:18 Square +[ + { + "edits": [ + { + "newText": "Square", + "range": { + "end": { "character": 20, "line": 39 }, + "start": { "character": 17, "line": 39 } + } + }, + { + "newText": "Square", + "range": { + "end": { "character": 21, "line": 74 }, + "start": { "character": 18, "line": 74 } + } + } + ], + "textDocument": { "uri": "file:///AppliedFunctorUse.res", "version": 0 } + }, + { + "edits": [ + { + "newText": "Square", + "range": { + "end": { "character": 24, "line": 52 }, + "start": { "character": 21, "line": 52 } + } + }, + { + "newText": "Square", + "range": { + "end": { "character": 22, "line": 61 }, + "start": { "character": 19, "line": 61 } + } + } + ], + "textDocument": { "uri": "file:///AppliedFunctor.res", "version": 0 } + } +] + +Definition src/AppliedFunctorUse.res 81:17 +{ + "range": { + "end": { "character": 9, "line": 7 }, + "start": { "character": 6, "line": 7 } + }, + "uri": "file:///AppliedFunctor.res" +} + +TypeDefinition src/AppliedFunctorUse.res 84:4 +{ + "range": { + "end": { "character": 21, "line": 6 }, + "start": { "character": 2, "line": 6 } + }, + "uri": "file:///AppliedFunctor.res" +} + +Definition src/AppliedFunctorUse.res 95:17 +{ + "range": { + "end": { "character": 9, "line": 7 }, + "start": { "character": 6, "line": 7 } + }, + "uri": "file:///AppliedFunctor.res" +} + +TypeDefinition src/AppliedFunctorUse.res 98:4 +{ + "range": { + "end": { "character": 21, "line": 6 }, + "start": { "character": 2, "line": 6 } + }, + "uri": "file:///AppliedFunctor.res" +} + +References src/AppliedFunctorUse.res 101:18 +[ + { + "range": { + "end": { "character": 18, "line": 5 }, + "start": { "character": 15, "line": 5 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 19, "line": 17 }, + "start": { "character": 16, "line": 17 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 19, "line": 62 }, + "start": { "character": 16, "line": 62 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 19, "line": 81 }, + "start": { "character": 16, "line": 81 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 19, "line": 95 }, + "start": { "character": 16, "line": 95 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 20, "line": 101 }, + "start": { "character": 17, "line": 101 } + }, + "uri": "file:///AppliedFunctorUse.res" + }, + { + "range": { + "end": { "character": 9, "line": 7 }, + "start": { "character": 6, "line": 7 } + }, + "uri": "file:///AppliedFunctor.res" + }, + { + "range": { + "end": { "character": 18, "line": 16 }, + "start": { "character": 15, "line": 16 } + }, + "uri": "file:///AppliedFunctor.res" + }, + { + "range": { + "end": { "character": 19, "line": 19 }, + "start": { "character": 16, "line": 19 } + }, + "uri": "file:///AppliedFunctor.res" + }, + { + "range": { + "end": { "character": 19, "line": 22 }, + "start": { "character": 16, "line": 22 } + }, + "uri": "file:///AppliedFunctor.res" + } +] +