Skip to content
This repository was archived by the owner on Apr 24, 2021. It is now read-only.

Commit

Permalink
Fix issue for uncurried functions where the internal definition of `J…
Browse files Browse the repository at this point in the history
…s.Fn.arity` is shown on hover

Uncurried types are handled by the outcome printer. Add some additional logic on hover to recognize `Js.Fn.arityxx`, and avoid showing the type definition, which is internal.
  • Loading branch information
cristianoc committed Feb 15, 2021
1 parent 5afdd84 commit e103940
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions Changes.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## 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).

## 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).
Expand Down
8 changes: 7 additions & 1 deletion src/rescript-editor-support/Hover.re
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit e103940

Please sign in to comment.