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

Commit

Permalink
Fix issue where values declared with type annotation would not show u…
Browse files Browse the repository at this point in the history
…p in autocomplete, and would show no doc comment on hover.

Fixes rescript-lang/rescript-vscode#72.

E.g.

```res
@ocaml.doc("Doc comment for functionWithTypeAnnotation")
let functionWithTypeAnnotation : unit => int = () => 1
```
  • Loading branch information
cristianoc committed Feb 15, 2021
1 parent c0544d1 commit bb6f155
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
- 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).
- 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).


## 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
5 changes: 4 additions & 1 deletion examples/example-project/src/ZZ.res
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,7 @@ module Inner = {

type typeInner = Inner.tInner;

let valueInner = Inner.vInner;
let valueInner = Inner.vInner;

@ocaml.doc("Doc comment for functionWithTypeAnnotation")
let functionWithTypeAnnotation : unit => int = () => 1
3 changes: 2 additions & 1 deletion src/rescript-editor-support/ProcessCmt.re
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,8 @@ let rec forItem = (~env, ~exported: exported, item) =>
({vb_loc, vb_pat: {pat_desc, pat_type}, vb_attributes}) =>
/* TODO get all the things out of the var. */
switch (pat_desc) {
| Tpat_var(ident, name) =>
| Tpat_var(ident, name)
| Tpat_alias({pat_desc: Tpat_any}, ident, name) /* let x : t = ... */ =>
let item = pat_type;
let declared =
addItem(
Expand Down

0 comments on commit bb6f155

Please sign in to comment.