commercialhaskell / commercialhaskell/stack-ide

Some Cabal constructs are ignored

Open
#82 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Emacs Lisp
Stars
96
Forks
23
PR merge metrics
No merged PRs in 30d

Description

When trying to jump to the location of `maBA` [here](https://github.com/bos/text/blob/9ea72a0457f3269a50c7867752f9bb19a0cdd69c/Data/Text/Array.hs#L202), 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":""},"errorKind":"KindError","errorMsg":"ide-backend-server: phase `C pre-processor' failed (exitcode = 1)"}]}
```

The defines that get set in the [Cabal file](https://github.com/bos/text/blob/9ea72a0457f3269a50c7867752f9bb19a0cdd69c/text.cabal) 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](https://github.com/bos/text/blob/9ea72a0457f3269a50c7867752f9bb19a0cdd69c/Data/Text/Lazy/Builder/Int.hs#L41).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.