Closed AlainODea closed 5 years ago
The problem is something in how HoogleComponent encodes the arguments for the hoogle command. It seems like searching for +
literally in hoogle on the CLI also does not work.
Literally running this command brings up the documentation for (++):
/Users/alain_odea/Library/Caches/com.github.rikvdkleij.intellij-haskell/lts-13/bin/hoogle --database=/Users/alain_odea/Library/Caches/com.github.rikvdkleij.intellij-haskell/finding-success-and-failure/hoogle -i + +GHC.Num +Prelude
It looks like the bug is in hoogle. I'll see how to encode + to work around this.
Show Type (Option-Command-P) correctly shows (+) :: Num a => a -> a -> a
.
The Edit Source (Command-Down Arrow) option in the gear menu on the quick documentation popup works as expected: it takes me to GHC.Num to the line where (+) is defined. This appears to be isolated to how the Hoogle CLI handles an undocumented element. Excluding +Prelude from the query correctly returns no docs, but isn't a viable fix since it would break quick doc on things like map.
This may actually be a weird corner case in that (+) has no documentation and (++) is in Prelude and using hoogle from the command line allows partial matches, so (++) is the best match with documentation. The problem is that it is partial matching. How do we get Hoogle to partial match? We need a search tag. Tags are defined here, and particularly the exact tag: https://github.com/ndmitchell/hoogle/blob/de11775da67547079d3e8069aa57e221eec4ea5e/src/Output/Tags.hs#L85
Thankfully, this has a direct solution: add is:exact
to the query. I have done some cursory testing and should have a PR shortly. I'm open to performing additional tests.
Your fix is released in beta49, https://github.com/rikvdkleij/intellij-haskell/releases/tag/v1.0.0-beta49
Thank you!
If I have the following code:
And I place my caret before the
+
and click View > Quick Documentation (or hit F1 on macOS or Ctrl-Q on Windows/Linux) I get the following popup:Here's a screenshot of the behaviour:
I tried to follow HaskellDocumentationProvider's use of TypeInfoComponent and StringUtils. I couldn't find the issue in StringUtils so I suspect it is somewhere down the TypeInfoComponent rabbit hole.
I've gotten the development setup working following your excellent CONTRIBUTING.md, so I will debug this and hopefully have a PR to fix it fairly soon.