dante icon indicating copy to clipboard operation
dante copied to clipboard

Feature Request: Auto complete for language pragmas

Open Fresheyeball opened this issue 7 years ago • 8 comments

Remembering how to spell language pragmas sucks. Ghc-mod has this so I know it's possible.

Fresheyeball avatar Aug 04 '17 17:08 Fresheyeball

The best method is to use autofix: use the extension first then use autofix on the error.

jyp avatar Aug 20 '17 19:08 jyp

@Fresheyeball structured-haskell-mode also does this (I think … at least, some mode I’m using does) and should work fine with Dante.

sellout avatar Oct 06 '17 03:10 sellout

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

hvr avatar Oct 06 '17 07:10 hvr

@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.

Fresheyeball avatar Nov 17 '17 18:11 Fresheyeball

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.)

jyp avatar Nov 19 '17 14:11 jyp

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))))

bezirg avatar Feb 01 '19 09:02 bezirg

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:

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.

purcell avatar May 01 '19 23:05 purcell

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.

purcell avatar May 02 '19 21:05 purcell

Yep, this works. Thanks @purcell.

jyp avatar Oct 12 '22 13:10 jyp