diff --git a/Changes.md b/Changes.md index fed973ab..d4f38838 100644 --- a/Changes.md +++ b/Changes.md @@ -1,6 +1,8 @@ ## master - Add support for autocomplete for `foo->`: the type of `foo` is used to determine the module to take completions from. - Add support for autocomplete for decorators such as `@module` and `@val`. +- Fix issue for uncurried functions where the internal definition of `Js.Fn.arity` is shown on hover. (See https://github.com/rescript-lang/rescript-editor-support/issues/62). +- Fix type hint when hovering over labeled arguments of components (See https://github.com/rescript-lang/rescript-editor-support/issues/63). ## Release 1.0.5 of rescript-vscode This [commit](https://github.com/rescript-lang/rescript-editor-support/commit/6bdd10f6af259edc5f9cbe5b9df06836de3ab865) is vendored in [rescript-vscode 1.0.5](https://github.com/rescript-lang/rescript-vscode/releases/tag/1.0.5). diff --git a/src/rescript-editor-support/Hover.re b/src/rescript-editor-support/Hover.re index c7faa81f..52ae3f89 100644 --- a/src/rescript-editor-support/Hover.re +++ b/src/rescript-editor-support/Hover.re @@ -120,7 +120,13 @@ let newHover = (~rootUri, ~file: SharedTypes.file, ~getModule, loc) => { let%opt path = typ |> Shared.digConstructor; let%opt (_env, {docstring, name: {txt}, item: {decl}}) = digConstructor(~env, ~getModule, path); - Some((decl |> Shared.declToString(txt), docstring)); + let isUncurriedInternal = + Utils.startsWith(Path.name(path), "Js.Fn.arity"); + if (isUncurriedInternal) { + None; + } else { + Some((decl |> Shared.declToString(txt), docstring)); + }; }; let (typeString, docstring) = switch (extraTypeInfo) { diff --git a/src/rescript-editor-support/References.re b/src/rescript-editor-support/References.re index 8322ab29..7e5019e5 100644 --- a/src/rescript-editor-support/References.re +++ b/src/rescript-editor-support/References.re @@ -29,6 +29,19 @@ let locsForPos = (~extra, pos) => { let locForPos = (~extra, pos) => { switch (locsForPos(~extra, pos)) { + | [ + (loc1, Typed(_, LocalReference(_))), + ( + loc2, + Typed(_, GlobalReference("Js_OO", Tip("unsafe_downgrade"), _)), + ), + (loc3, _) as l3, + ] + when loc1 == loc2 && loc2 == loc3 => + // JSX and compiler combined: + // ~x becomes Js_OO.unsafe_downgrade(Props)#x + // heuristic for: [Props, unsafe_downgrade, x], give loc of `x` + Some(l3) | [(loc1, _), (loc2, _) as l, (loc3, _)] when loc1 == loc2 && loc2 == loc3 => // JSX with at most one child