Open
Description
Is your enhancement request related to a problem? Please describe.
- for some reason, fields when used as functions get highlighted as fields, but when used as accessors using overloaded record dot, get highlighted as functions
Describe the solution you'd like
- both get highlighted as record accessors (distinct from function highlighting)
Describe alternatives you've considered
n/a
Additional context
- I'm using semantic highlighting
Activity
soulomoon commentedon Feb 17, 2025
Should be related to how hie present the node. I'll take a look.
soulomoon commentedon Feb 17, 2025
For
The related HieAst node does not show information about
.foo
.But for typechecked source, the FieldLabelString is there. likely it does not convert to the node in hieast
soulomoon commentedon Feb 17, 2025
To fix this, we need to modify the hieast generation in ghc. More specifically at ghc source code.
We can see the
OrigExpr
is omited all togather.I would be helpful to see
Note [Overview of record dot syntax]
================ update ===========
After looking into the ghc code, I think it might not be easy. The main problem is the ".foo" remains to be just
FieldLabelString
in the artifact ghc generated and does not resolve to the actual fieldName
.For
overloadedDot
, ghc make a serious of trasformation from the source code throughHasField
type class,And the field existency checking occur in the solver during typechecking through
matchGlobalInst
.But it does not add (a reference to the actual field) in
typecheckedSource
norrenamedSource
for us to relate theFieldLabelString
back to the actual fieldName
.Possible solutions:
That is to assign a new name in the generation of HieAst and add it as a field Entity in the entity map just for the sake of semantic highlighting. But we would still be lacking the
type information
andjump over
feature a like for this symbol.