atom-haskell-archive / haskell-ghc-mod

haskell-ghc-mod atom package
https://atom.io/packages/haskell-ghc-mod
MIT License
69 stars 20 forks source link

lint fails with: Invalid option `--hlintOpt' #198

Closed lippling closed 7 years ago

lippling commented 7 years ago

When I use HLint options like -XNoRoleAnnotations the plugin doesn't work anymore. For example:

ghc-mod lint server/Settings/StaticFiles.hs -- --hlintOpt -XNoRoleAnnotations 

results in

Invalid option `--hlintOpt'

The problem is the --. Removing them by hand works:

ghc-mod lint server/Settings/StaticFiles.hs --hlintOpt -XNoRoleAnnotations

but the plugin adds -- automatically.

Could this be fixed easily?

eatobin commented 7 years ago

I have the same problem. Trying to reproduce this command line in atom: $ hlint src/Borrower.hs --hint=Default.hs --hint=Dollar.hs --hint=Generalise.hs. Thanks.

lierdakil commented 7 years ago

Thanks for reporting, should be fixed in the latest version. Please let me know if not (although I did test and am pretty sure everything should be fine) @eatobin, bear in mind some hlint options are ignored by ghc-mod v5.6 and v5.7 -- this is mostly a problem with hlint's API, and master switched to other hlint API, which works fine, but that hasn't been released as of yet. v5.5 is fine (but it uses older hlint)

eatobin commented 7 years ago

Thanks @lierdakil for the reply. This does work for me from the command line:

eric@linux-epth:total-beginner-haskell$ ghc-mod lint -h '--hint=Default.hs' -h '--hint=Dollar.hs' -h '--hint=Generalise.hs' src/Borrower.hs
src/Borrower.hs:44:3: Suggestion: Use mappendFound:  getName br ++    " (" `mappend` show (getMaxBooks br) `mappend` " books)"Why not:  getName br `Data.Monoid.mappend`    (" (" `mappend` show (getMaxBooks br) `mappend` " books)")

I'm using ghc-mod 5.6 built from Github.

Maybe I'm just entering the arguments wrong in Atom. Can you show me what the entry should be in Atom for the arguments above?

Thank you.

lierdakil commented 7 years ago

@eatobin, something like this should be equivalent to your command line: image Note you need hgm v1.19.7 for this to work, which was released half an hour ago, so check for updates. Sorry if it wasn't clear.

eatobin commented 7 years ago

Works fine @lierdakil. Thank you for your help!

lippling commented 7 years ago

That was quick. Thanks!