Skip to content

analysis: fix namespaced reference lookup#8453

Open
benjamin-thomas wants to merge 1 commit into
rescript-lang:masterfrom
benjamin-thomas:fix-analysis-namespaced-references
Open

analysis: fix namespaced reference lookup#8453
benjamin-thomas wants to merge 1 commit into
rescript-lang:masterfrom
benjamin-thomas:fix-analysis-namespaced-references

Conversation

@benjamin-thomas
Copy link
Copy Markdown

@benjamin-thomas benjamin-thomas commented May 31, 2026

Hello!

This is an attempt at fixing this problem:

image

2 problems were occurring when activating the namespace feature

  • The generated namespace module's path would be searched by its "double name" (MyNamespace-MyNamespace)
  • The references command (from rescript-editor-analysis.exe references) would try to find the namespaced module (MyModule1-MyNamespace) against the indexed "public paths" and so would fail.

This PR solves the problem by:

  • not trying to find the module name via file URI resolution when we already have its name in the package module index.
  • mapping the "internal paths" (MyModule1-MyNamespace) to their public path equivalent (MyNamespace.MyModule1)

It looks like this is a long standing issue. I found this old open issue on the vscode plugin repo.

[EDIT] the latest commit on master related to yojson (166253d) broke the namespace config parsing (from rescript.json) so I branched off the commit before that (otherwise the test would break; no value could be provided for the namespace key)

Signed-off-by: Benjamin Thomas <benjamin.guy.thomas@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant