Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mention docs on hover feature in README #209

Merged
merged 2 commits into from
Jul 23, 2020

Conversation

georgefst
Copy link
Collaborator

@georgefst georgefst commented Jul 19, 2020

Thanks to @pepeiborra at #208, I discovered that it is actually currently possible to get docs for dependencies to show up in HLS. Based on a discussion about this on IRC a few days ago, I suspect this is not widely known. Indeed, AFAICT, the -haddock flag is completely undocumented.

I don't know if this is necessarily the best part of the README in which to mention the workaround for this, but I feel it ought to be in there somewhere.

I was also unsure whether it's worth explaining how to specify a GHC flag for dependencies of a project, and which method to mention for doing so. Personally, I've just decided to bite the bullet and go with:

program-default-options
  ghc-options: -haddock

in my global cabal config, but I'd guess that's not suitable for everyone.

@jneira
Copy link
Member

jneira commented Jul 20, 2020

Hi!, thanks for the doc addition. I think cabal configure alternative is better, cause it is per project but maybe we could include both alternatives, global and project local.
I think we should add some info for stack users: ideally the stack counterpart to the cabal alternative you have used.

@pepeiborra
Copy link
Collaborator

To me it makes perfect sense to put this in the global cabal config. If in doubt, why not document both the global and project setting?

@pepeiborra
Copy link
Collaborator

Worth noting that the -haddock flag can currently cause compilation errors due to invalid Haddock markup; this will change in 8.12 assuming !2377 gets merged in time.

@jneira
Copy link
Member

jneira commented Jul 20, 2020

I think we should add some info for stack users: ideally the stack counterpart to the cabal alternative you have used.

the stack equivalent is to set in $STACK_ROOT\config.yaml (globally) or in ./stack.yaml (per project):

 ghc-options:
  "$everything": -haddock

I've tested it locally and it makes docs appear in hover

@jneira
Copy link
Member

jneira commented Jul 20, 2020

HLS. Based on a discussion about this on IRC a few days ago, I suspect this is not widely known. Indeed, AFAICT, the -haddock flag is completely undocumented.

From ghc issue https://gitlab.haskell.org/ghc/ghc/-/issues/14920 the -haddock flag was documented with https://gitlab.haskell.org/ghc/ghc/commit/c35c545d3f32f092c52052349f741739a844ec0f so it should be shown in the next ghc release docs (??)
EDIT: It is in master docs: https://ghc.gitlab.haskell.org/ghc/doc/users_guide/using.html#haddock

@georgefst
Copy link
Collaborator Author

After living with -haddock enabled globally for a day, I think I can recommend it. I've built several large packages, and the only place I've hit an issue is c2hs.

It is, however, a little painful when things do go wrong, since -no-haddock isn't yet available (it's in GHC master, but no release yet).

Thanks @jneira for the stack syntax - I wouldn't have been sure of that.

@georgefst
Copy link
Collaborator Author

Kind of feels like this belongs in a footnote, but I seem to remember Github markdown doesn't really support them.

@jneira
Copy link
Member

jneira commented Jul 20, 2020

It is, however, a little painful when things do go wrong, since -no-haddock isn't yet available (it's in GHC master, but no release yet).

I think this is a good reason to not recommend seting it globally by default

@jneira jneira merged commit 4fb4998 into haskell:master Jul 23, 2020
georgefst added a commit to georgefst/haskell-language-server that referenced this pull request Jul 29, 2020
Seeing as, since haskell#209, the README suggests globally enabling `-haddock`, it's rather unfortunate for that not to work with HLS' own installation script...
fendor pushed a commit to fendor/haskell-language-server that referenced this pull request Aug 10, 2020
Seeing as, since haskell#209, the README suggests globally enabling `-haddock`, it's rather unfortunate for that not to work with HLS' own installation script...
pepeiborra pushed a commit that referenced this pull request Dec 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants