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

Commit 6bdd10f

Browse files
committed
Fix jump to type definition for types defined in an inner module.
Fix cross-reference for type definitions belonging to an inner module. The lookup used to search values instead of types. Fixes #54
1 parent 9d9347f commit 6bdd10f

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

Changes.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
- Fix autocomplete issue where `open Foo` would be picked up inside line comments (see https://github.com/rescript-lang/rescript-editor-support/issues/15).
55
- Don't print parens as in `A()` for 0-ary variants.
66
- Fix infinite loop in autocomplete that can cause `rescript-editor-support.exe` processes to use up 100% cpu.
7+
- Fix jump to type definition for types defined in an inner module.
78

89
## Release 1.0.3 of rescript-vscode
910
This [commit](https://github.com/rescript-lang/rescript-editor-support/commit/214d220d8573f9f0c8d54e623c163e01617bf124) is vendored in [rescript-vscode 1.0.3](https://github.com/rescript-lang/rescript-vscode/releases/tag/1.0.3).

examples/example-project/src/ZZ.res

+9
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,12 @@ let v1 = V1
8686
module DoubleNested = ModuleWithDocComment.Nested.NestedAgain
8787

8888
let uncurried = (. x) => x+1;
89+
90+
module Inner = {
91+
type tInner = int;
92+
let vInner = 34
93+
}
94+
95+
type typeInner = Inner.tInner;
96+
97+
let valueInner = Inner.vInner;

src/rescript-editor-support/ProcessExtra.re

+7-7
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,12 @@ module F =
144144
addExternalReference(moduleName, path, tip, identLoc);
145145
GlobalReference(moduleName, path, tip);
146146
| `Exported(env, name) =>
147-
switch (Hashtbl.find_opt(env.exported.values, name)) {
147+
switch (
148+
Hashtbl.find_opt(
149+
tip == Type ? env.exported.types : env.exported.values,
150+
name,
151+
)
152+
) {
148153
| Some(stamp) =>
149154
addReference(stamp, identLoc);
150155
LocalReference(stamp, tip);
@@ -230,12 +235,7 @@ module F =
230235
| None => NotFound
231236
}
232237
| `Global(moduleName, path) =>
233-
addExternalReference(
234-
moduleName,
235-
path,
236-
Field(name),
237-
nameLoc,
238-
);
238+
addExternalReference(moduleName, path, Field(name), nameLoc);
239239
GlobalReference(moduleName, path, Field(name));
240240
| _ => NotFound
241241
};

0 commit comments

Comments
 (0)