Commit cb9d4e3
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 282e820 commit cb9d4e3
File tree
1 file changed
+23
-4
lines changed- plugins/hls-refactor-plugin/src/Development/IDE/Plugin
1 file changed
+23
-4
lines changedLines changed: 23 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1476 | 1476 | | |
1477 | 1477 | | |
1478 | 1478 | | |
1479 | | - | |
1480 | | - | |
1481 | 1479 | | |
1482 | 1480 | | |
1483 | 1481 | | |
| |||
1574 | 1572 | | |
1575 | 1573 | | |
1576 | 1574 | | |
| 1575 | + | |
| 1576 | + | |
| 1577 | + | |
| 1578 | + | |
| 1579 | + | |
| 1580 | + | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
| 1585 | + | |
| 1586 | + | |
| 1587 | + | |
| 1588 | + | |
| 1589 | + | |
| 1590 | + | |
| 1591 | + | |
| 1592 | + | |
| 1593 | + | |
| 1594 | + | |
| 1595 | + | |
1577 | 1596 | | |
1578 | 1597 | | |
1579 | 1598 | | |
1580 | 1599 | | |
1581 | 1600 | | |
1582 | | - | |
1583 | | - | |
| 1601 | + | |
| 1602 | + | |
1584 | 1603 | | |
1585 | 1604 | | |
1586 | 1605 | | |
| |||
0 commit comments