Skip to content

Fix Signature Help inside do Notation in GHC >= 9.10#4904

Open
vidit-od wants to merge 4 commits intohaskell:masterfrom
vidit-od:Do-Signature-Traversal
Open

Fix Signature Help inside do Notation in GHC >= 9.10#4904
vidit-od wants to merge 4 commits intohaskell:masterfrom
vidit-od:Do-Signature-Traversal

Conversation

@vidit-od
Copy link
Copy Markdown
Collaborator

@vidit-od vidit-od commented Apr 19, 2026

Closes : #4769

As recommended, Type information of Some nodes were stored in GHC generated nodes.
This PR keeps the old pipeline and add a Fall back to traverse these generated nodes in case source node lack type information.

Attached image of signature help in cases where we did not get them before;
image

Prerequisite :

  • passes all hls-signature-help-plugin tests on GHC 9.12.2 :
image
Major Finding credits : @jian-lin

Some nodes have there type info stored in nodes generated by ghc. In case no type info found in source node, fall back to traversing ghc generated nodes for types

Signed-off-by: vidit-od <vidit894@gmail.com>
@vidit-od vidit-od requested review from fendor and jian-lin April 19, 2026 11:06
@vidit-od vidit-od changed the title Traverse Generated Nodes Fix Signature Help inside do Notation Apr 19, 2026
Copy link
Copy Markdown
Collaborator

@jian-lin jian-lin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I'll do a more careful review later.

In the meantime, it would be good to add a test case for the issue.

Signed-off-by: vidit-od <vidit894@gmail.com>
@vidit-od vidit-od requested a review from jian-lin April 21, 2026 06:41
Comment thread plugins/hls-signature-help-plugin/test/Main.hs
@fendor
Copy link
Copy Markdown
Collaborator

fendor commented Apr 30, 2026

@jian-lin I think this is ready for a review now

@fendor fendor added the status: needs review This PR is ready for review label Apr 30, 2026
Comment thread plugins/hls-signature-help-plugin/test/Main.hs Outdated
Comment thread plugins/hls-signature-help-plugin/test/Main.hs Outdated
Comment thread plugins/hls-signature-help-plugin/src/Ide/Plugin/SignatureHelp.hs
@jian-lin jian-lin changed the title Fix Signature Help inside do Notation Fix Signature Help inside do Notation in GHC >= 9.10 Apr 30, 2026
Signed-off-by: vidit-od <vidit894@gmail.com>
@vidit-od vidit-od force-pushed the Do-Signature-Traversal branch from c891a41 to 9344a71 Compare May 1, 2026 08:21
@vidit-od vidit-od requested review from fendor and jian-lin May 1, 2026 11:44
@vidit-od vidit-od force-pushed the Do-Signature-Traversal branch from 6c39a93 to 20e9d05 Compare May 1, 2026 11:49
If source -> identifier info -> details == Nothing, then we fallback to generated by ghc node and explore generated by ghc -> identifier info -> details

Signed-off-by: vidit-od <vidit894@gmail.com>
Comment on lines +300 to +303
let mTypeOfName = identType identifierDetails <|> do
nodeInfo <- generatedNodeInfo hieAst
details <- M.lookup identifier (nodeIdentifiers nodeInfo)
identType details
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jian-lin This should take care of lookup to generated nodes on fallback for identifier details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: needs review This PR is ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Signature Help should provide signature in the do notation

3 participants