diff --git a/CHANGELOG.md b/CHANGELOG.md
index d972b6fbb..918829d73 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -37,6 +37,8 @@
- Fix issue with completing `foo. x` where `x` should not be part of the completion https://github.com/rescript-lang/rescript-vscode/pull/644
+- Fix issue with references to elements defined in an interface file https://github.com/rescript-lang/rescript-vscode/issues/645
+
- Fix issue where code analysis would not track types in inner modules across implementations and interfaces https://github.com/rescript-association/reanalyze/issues/186
- Fix issue with references to elements defined in an interface file https://github.com/rescript-lang/rescript-vscode/pull/646
diff --git a/analysis/src/Commands.ml b/analysis/src/Commands.ml
index 756c6fb43..7baa0892e 100644
--- a/analysis/src/Commands.ml
+++ b/analysis/src/Commands.ml
@@ -172,9 +172,11 @@ let references ~path ~pos ~debug =
| Some loc -> loc
| None -> Uri.toTopLevelLoc uri2
in
- Protocol.stringifyLocation
- {uri = Uri.toString uri2; range = Utils.cmtLocToRange loc}
- :: acc)
+ if loc.loc_ghost then acc
+ else
+ Protocol.stringifyLocation
+ {uri = Uri.toString uri2; range = Utils.cmtLocToRange loc}
+ :: acc)
[])
in
print_endline
diff --git a/analysis/tests/src/References.res b/analysis/tests/src/References.res
index 959a7b235..b6127999e 100644
--- a/analysis/tests/src/References.res
+++ b/analysis/tests/src/References.res
@@ -19,4 +19,6 @@ module M: {
let bb = M.aa
let cc = bb
let dd = M.aa
-// ^ref
\ No newline at end of file
+// ^ref
+
+let _ =
diff --git a/analysis/tests/src/inner/ComponentInner.res b/analysis/tests/src/inner/ComponentInner.res
new file mode 100644
index 000000000..aa3f50cb0
--- /dev/null
+++ b/analysis/tests/src/inner/ComponentInner.res
@@ -0,0 +1,2 @@
+@react.component
+let make = () => React.null
diff --git a/analysis/tests/src/inner/ComponentInner.resi b/analysis/tests/src/inner/ComponentInner.resi
new file mode 100644
index 000000000..1ca44ce26
--- /dev/null
+++ b/analysis/tests/src/inner/ComponentInner.resi
@@ -0,0 +1,2 @@
+@react.component
+let make: unit => React.element
diff --git a/analysis/tests/src/inner/ReferencesInner.res b/analysis/tests/src/inner/ReferencesInner.res
new file mode 100644
index 000000000..261d0b396
--- /dev/null
+++ b/analysis/tests/src/inner/ReferencesInner.res
@@ -0,0 +1,2 @@
+@react.component
+let make = () =>
\ No newline at end of file
diff --git a/analysis/tests/src/inner/ReferencesInner.resi b/analysis/tests/src/inner/ReferencesInner.resi
new file mode 100644
index 000000000..1ca44ce26
--- /dev/null
+++ b/analysis/tests/src/inner/ReferencesInner.resi
@@ -0,0 +1,2 @@
+@react.component
+let make: unit => React.element