dante
dante copied to clipboard
Feature Request: Auto complete for language pragmas
Remembering how to spell language pragmas sucks. Ghc-mod has this so I know it's possible.
The best method is to use autofix: use the extension first then use autofix on the error.
@Fresheyeball structured-haskell-mode also does this (I think … at least, some mode I’m using does) and should work fine with Dante.
Fwiw, if you M-x package-install haskell-snippets
, you get autocompletion via https://github.com/haskell/haskell-snippets/blob/master/snippets/haskell-mode/lang-pragma
@sellout I'm using the structured-haskell-mode
for this now. But I would rather have better separation of concerns. structured-haskell-mode
does it through stack
I'd like it to be independent.
The way that company mode is structured, you can add a completer which only completes pragmas. (This functionality has nothing to do with GHCi and thus I do not think that it belongs in dante.)
I do have completion of LANGUAGE pragmas, when using the standard haskell-mode
package combined with company
auto-completion package. Just make sure that company-capf
is part of the local variable company-backends
:
(add-hook 'dante-mode-hook
(lambda ()
(company-mode)
(set (make-local-variable 'company-backends)
'(company-capf))))
I do have completion of LANGUAGE pragmas, when using the standard
haskell-mode
package combined withcompany
auto-completion package. Just make sure thatcompany-capf
is part of the local variablecompany-backends
:
The issue I found with this is that company-capf
and dante-company
fight about who should get to complete a symbol. I submitted https://github.com/jyp/dante/pull/118 in order to have dante-company
punt when asked to complete inside a comment, which allows the haskell-mode
pragma completion to kick in with just the standard dante config.
The fix for this has been merged, so the issue can probably be closed if someone would like to confirm it works for them with the stock company
configuration.
Yep, this works. Thanks @purcell.