haskell / haskell/haskell-language-server
textDocument/references returns references only in the current file for Stack projects
- Dominant language
- Haskell
- Stars
- 3k
- Forks
- 455
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 11
Description
`textDocument/references` method returns results for type references found only in the current file for a Stack project.
Given the following project structure:
```
app/
| Main.hs
src/
| Game/
| State.hs
package.yaml
Setup.hs
stack.yaml
example.cabal
```
And the State.hs content:
```hs
-- State.hs
module Game.State (GameState (..)) where
import Game.Core.Position (Position)
data GameState where
GameState :: {position :: Position, message :: String} -> GameState
```
GameState is used in the Main.hs as well.
Sending the textDocument/definition request to the LSP with the following params
```json
{
"textDocument": {
"uri": "file:///example/src/Game/State.hs"
},
"position": {
"line": 5,
"character": 7
},
"context": {
"includeDeclaration": true
}
}
```
Results in the following response
```json
[
{
"range": {
"end": {
"character": 11,
"line": 5
},
"start": {
"character": 2,
"line": 5
}
},
"uri": "file:///example/src/Game/State.hs"
},
{
"range": {
"end": {
"character": 24,
"line": 5
},
"start": {
"character": 16,
"line": 5
}
},
"uri": "file:///example/src/Game/State.hs"
},
{
"range": {
"end": {
"character": 45,
"line": 5
},
"start": {
"character": 38,
"line": 5
}
},
"uri": "file:///example/src/Game/State.hs"
}
]
```
Results for `example/src/app/Main.hs` are missing.
### Your environment
Which OS do you use?
macOS
Which version of GHC do you use and how did you install it?
9.10.2 from ghcup
How is your project built?
Stack 3.7.1
Which version of HLS do you use and how did you install it?
2.11.0
Have you configured HLS in any way (especially: a `hie.yaml` file)?
No
### Steps to reproduce
Send `textDocument/references` request for a data definition using GADTs.
### Expected behaviour
Results are found in the whole project.
### Actual behaviour
Results are found only in the file where the data is defined.
### Debug information
Request/Response from LSP above
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.