Commit 4edf9cd
committed
fix: include the field selector when looking for missing symbol
In GHC >= 9.8, the namespace for record selector changed and is now part
of a new namespace. This allows for duplicated record field names in the
same module.
This hence generated a few issues in HLS when looking for a symbol using
`lookupOccEnv`: the current implementation was only doing lookup in
type, data and var namespaces.
This commit uses `lookupOccEnv_AllNameSpaces`, so it may be more
efficient (one lookup instead of two), but it also incluse the symbols
from record field selectors and this will actually fix most import
suggestion logic when a record field selector is not found.
Note that the function is not available in `ghc` <= 9.6, hence the `CPP`
and fallsback implementation, which uses the previous implementation.
See https://gitlab.haskell.org/ghc/ghc/-/wikis/migration/9.8#new-namespace-for-record-fields1 parent 0218e46 commit 4edf9cd
File tree
1 file changed
+23
-2
lines changed- plugins/hls-refactor-plugin/src/Development/IDE/Plugin
1 file changed
+23
-2
lines changedLines changed: 23 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1574 | 1574 | | |
1575 | 1575 | | |
1576 | 1576 | | |
| 1577 | + | |
| 1578 | + | |
| 1579 | + | |
| 1580 | + | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
| 1585 | + | |
| 1586 | + | |
| 1587 | + | |
| 1588 | + | |
| 1589 | + | |
| 1590 | + | |
| 1591 | + | |
| 1592 | + | |
| 1593 | + | |
| 1594 | + | |
| 1595 | + | |
| 1596 | + | |
| 1597 | + | |
1577 | 1598 | | |
1578 | 1599 | | |
1579 | 1600 | | |
1580 | 1601 | | |
1581 | 1602 | | |
1582 | | - | |
1583 | | - | |
| 1603 | + | |
| 1604 | + | |
1584 | 1605 | | |
1585 | 1606 | | |
1586 | 1607 | | |
| |||
0 commit comments