Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All references are not being found for module component #645

Closed
aspeddro opened this issue Dec 1, 2022 · 7 comments · Fixed by #646
Closed

All references are not being found for module component #645

aspeddro opened this issue Dec 1, 2022 · 7 comments · Fixed by #646

Comments

@aspeddro
Copy link
Contributor

aspeddro commented Dec 1, 2022

ApiLayout.res on ReScript lang website.

The analysis return two locations:

dune exec rescript-editor-analysis references ~/Desktop/projects/rescript-lang.org/src/layouts/ApiLayout.res 130 9

[ 
{"uri": "file:///home/pedro/Desktop/projects/rescript-lang.org/src/layouts/SidebarLayout.res", "range": {"start": {"line": 209, "character": 4}, "end": {"line": 209, "character": 8}}},
{"uri": "file:///home/pedro/Desktop/projects/rescript-lang.org/src/layouts/SidebarLayout.resi", "range": {"start": {"line": 64, "character": 4}, "end": {"line": 64, "character": 8}}}
]

The locations above are of make function, i.e, definition.

The real references occur in other files:

@cristianoc
Copy link
Collaborator

As a simpler example:

module M1 = {
  let x1 = 10

  @react.component
  let make = () => React.null
}

module M2 = {
  let x2 = 10
}

No references are found for x1 (not even its own definition) while they are found for x2.
So it seems that by just being in the same module as a component breaks references.

@cristianoc
Copy link
Collaborator

Even simpler example:

module M1 = {
  let x = 10

  let a = 3
  let a = a
}

module M2 = {
  let x = 10
}

@cristianoc
Copy link
Collaborator

This could be relevant: #622
At least, same scenario of shadowing triggering the observed issue.

@cristianoc
Copy link
Collaborator

So shadowing creates a module constraint (i.e. a module type generated by the compiler), but also an example with an explicit module type has the same problem:

module M3: {
  let aa: int
} = {
  let aa = 13
}

let dd = M3.aa
//           ^ref

@cristianoc
Copy link
Collaborator

@aspeddro this should be fixed in #646

@aspeddro
Copy link
Contributor Author

aspeddro commented Dec 7, 2022

I just tested #646 and the references still point to definition.

image

@cristianoc
Copy link
Collaborator

Seems to work on the project used to test the extension. Might need a separate small repro.

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 a pull request may close this issue.

2 participants