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

don't push company-ghc when ghc-mod is disabled #3543

Closed
wants to merge 1 commit into from

Conversation

d12frosted
Copy link
Contributor

Because it forces ghc-mod, so haskell layer doesn't respects the value of haskell-enable-ghc-mod-support.

Also, the question - company-dabbrev-code is already in company-backends-haskell-mode - so is it necessary to add it here? And is it safe?

@TheBB
Copy link
Contributor

TheBB commented Oct 25, 2015

company-backends is a list of backends. Company tries each of them in turn until it finds one that can offer completions, at which point it stops and doesn't try any more. However, an element of this list can also be another list of backends, in which case all those backends are tried at the same time and their completions are bundled together.

Probably that's what's happening here with dabbrev: someone wanted dabbrev to offer completions even when the other backends do.

So you should consider whether this code shouldn't be like this instead:

(push (if company-enable-ghc-mod-support
          '(company-dabbrev-code company-yasnippet company-ghc)
        '(company-dabbrev-code company-yasnippet)
      company-backends-haskell-mode)

In your version, dabbrev and yasnippet will block ghc-mod from offering completions, which wasn't the case in the original code.

@d12frosted
Copy link
Contributor Author

Ah I see. Thanks for explanations. It makes more sense now. So like it walks the list of backends and stops at (company-ghc company-dabbrev-code company-yasnippet) because it can complete code in haskell-mode. Neat.

In your version, dabbrev and yasnippet will block ghc-mod from offering completions, which wasn't the case in the original code.

Originally it was

(push '(company-ghc company-dabbrev-code company-yasnippet)
      company-backends-haskell-mode)))

So shouldn't it be

(push (if company-enable-ghc-mod-support
          '(company-ghc company-dabbrev-code company-yasnippet)
        '(company-dabbrev-code company-yasnippet)
      company-backends-haskell-mode)

then? OK, I just wanted to avoid code duplication, but didn't understand how backends works. 😊

Because it forces `ghc-mod`, so haskell layer doesn't respects the value of `haskell-enable-ghc-mod-support`.
@d12frosted
Copy link
Contributor Author

@TheBB updated

@TheBB
Copy link
Contributor

TheBB commented Oct 29, 2015

Thanks! Cherry-picked in develop. You can safely delete your branch.

I had to fix the variable name. :-P 7b8e996

@TheBB TheBB closed this Oct 29, 2015
@d12frosted
Copy link
Contributor Author

Oops, my bad @TheBB ! Thanks for covering my back 😄

@d12frosted d12frosted deleted the patch-2 branch October 29, 2015 13:15
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.

2 participants