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

Fix hover on definitions inside a react component module. #68

Merged
merged 1 commit into from
Feb 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
- 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).
- Fix issue where values declared with type annotation would not show up in autocomplete, and would show no doc comment on hover. (See https://github.com/rescript-lang/rescript-vscode/issues/72).

- Fix hover on definitions inside a react component module, or whenever multiple definitins for the same value exist in the module (See https://github.com/rescript-lang/rescript-editor-support/issues/67).

## 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
7 changes: 7 additions & 0 deletions examples/example-project/src/ZZ.res
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,10 @@ let valueInner = Inner.vInner;

@ocaml.doc("Doc comment for functionWithTypeAnnotation")
let functionWithTypeAnnotation : unit => int = () => 1

module HoverInsideModuleWithComponent = {
let x = 2 // check that hover on x works

@react.component
let make = () => React.null
}
7 changes: 6 additions & 1 deletion src/rescript-editor-support/ProcessCmt.re
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,12 @@ and forModule = (env, mod_desc, moduleName) =>
modulePath: ExportedModule(moduleName, env.modulePath),
};
forModuleType(env, moduleType);
| Tmod_constraint(_expr, typ, _constraint, _coercion) =>
| Tmod_constraint(expr, _typ, Tmodtype_implicit, Tcoerce_structure(_)) =>
// implicit contraint synthesized during typechecking
// e.g. when the same id is defined twice (e.g. make with @react.component)
// skip the constraint and use the original module definition
forModule(env, expr.mod_desc, moduleName)
| Tmod_constraint(_expr, typ, constraint_, _coercion) =>
/* TODO do this better I think */
let env = {
...env,
Expand Down