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

Commit bb6f155

Browse files
committed
Fix issue where values declared with type annotation would not show up 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 ```
1 parent c0544d1 commit bb6f155

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

Changes.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
- Add support for autocomplete for decorators such as `@module` and `@val`.
44
- 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).
55
- Fix type hint when hovering over labeled arguments of components (See https://github.com/rescript-lang/rescript-editor-support/issues/63).
6+
- 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).
7+
68

79
## Release 1.0.5 of rescript-vscode
810
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).

examples/example-project/src/ZZ.res

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,7 @@ module Inner = {
9494

9595
type typeInner = Inner.tInner;
9696

97-
let valueInner = Inner.vInner;
97+
let valueInner = Inner.vInner;
98+
99+
@ocaml.doc("Doc comment for functionWithTypeAnnotation")
100+
let functionWithTypeAnnotation : unit => int = () => 1

src/rescript-editor-support/ProcessCmt.re

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,8 @@ let rec forItem = (~env, ~exported: exported, item) =>
407407
({vb_loc, vb_pat: {pat_desc, pat_type}, vb_attributes}) =>
408408
/* TODO get all the things out of the var. */
409409
switch (pat_desc) {
410-
| Tpat_var(ident, name) =>
410+
| Tpat_var(ident, name)
411+
| Tpat_alias({pat_desc: Tpat_any}, ident, name) /* let x : t = ... */ =>
411412
let item = pat_type;
412413
let declared =
413414
addItem(

0 commit comments

Comments
 (0)