commercialhaskell / stack-ide

Stack-based JSON interface to ide-backend
98 stars 23 forks source link

Some Cabal constructs are ignored #82

Open drvink opened 8 years ago

drvink commented 8 years ago

When trying to jump to the location of maBA here, the following error occurs:

[nil] -> {"tag":"RequestGetSourceErrors","contents":[]}
 <- {"tag":"ResponseGetSourceErrors","contents":[{"errorSpan":{"tag":"ProperSpan","contents":{"spanFromLine":42,"spanFilePath":"Data/Text/Lazy/Builder/Int.hs","spanToColumn":3,"spanFromColumn":3,"spanToLine":42}},"errorKind":"KindError","errorMsg":" error: #error \"You need to use either GMP or integer-simple.\"\n # error \"You need to use either GMP or
integer-simple.\"\n   ^"},{"errorSpan":{"tag":"TextSpan","contents":"<from GhcException>"},"errorKind":"KindError","errorMsg":"ide-backend-server: phase `C pre-processor' failed (exitcode = 1)"}]}

The defines that get set in the Cabal file aren't being picked up by stack-ide/ide-backend, it seems. The problem happens even if you explicitly pass them as --ghc-options to stack build and pre-build the package on the command line, because stack-ide/ide-backend apparently insists on unregistering the package before it begins its work:

Set initial command.
Starting: ("stack:text" nil "stack" "ide" "start" "text")
 <- text-1.2.1.3-19da78d3320e4fc2461a3acfd735f379: unregistering (flags changed from ["--ghc-options","-XCPP -DINTEGER_GMP=1 -DHAVE_DEEPSEQ=1"] to [])
 <- {"tag":"ResponseWelcome","contents":[0,1,1]}
 <- {"tag":"ResponseLog","contents":"[Info] Initializing ide-backend session @(ideba_Hr9Nwev8ROnK3IGHXxVXye:IdeSession.Update ./IdeSession/Update.hs:195:3)\n"}

It then tries to invoke a recompile and fails because of the #error directive here.