commercialhaskell / stack-ide

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

stack ide cannot detect auto-generated modules #54

Closed bixuanzju closed 6 years ago

bixuanzju commented 9 years ago

I have a project where I have Lexer.x and Parser.y files. Running stack build would automatically generate Lexer.hs and Parser.hs using alex and happy so that I don't have to manually generate those two before building. Runing stack ghci is also able to load Lexer.hs and Parser.hs. However, stack ide start complains that it cannot compile the project:

-> {"tag":"RequestGetSourceErrors","contents":[]} <- {"tag":"ResponseGetSourceErrors","contents":[{"errorSpan":{"tag":"TextSpan","contents":""},"errorKind":"KindError","errorMsg":"ide-backend-server: cannot compile this file to desired target: /Users/jeremybi/fcore/lib/Lexer.x\nUsage: For basic information, try the `--help' option."}]}

Of course I could manually generate those two files myself to satisfy stack-ide, but then stack build would complain:

There were multiple candidates for the Cabal entry "Lexer(/Users/jeremybi/fcore/lib/Lexer.x), picking /Users/jeremybi/fcore/lib/Lexer.hs There were multiple candidates for the Cabal entry "Parser(/Users/jeremybi/fcore/lib/Parser.y), picking /Users/jeremybi/fcore/lib/Parser.hs

Though the default behaviour is benign, is there any way I can both please stack and stack-ide?

robstewart57 commented 8 years ago

I'm experiencing the same benign behaviour. The .x files are converted to .hs files by the bnfc compiler generator tool. This thing: http://bnfc.digitalgrammars.com/ , for this project: https://github.com/robstewart57/cal-src .

The result of stack build is:

stack build
There were multiple candidates for the Cabal entry "LexCAL" (/home/rob/code/haskell/cal-src/LexCAL.x), picking /home/rob/code/haskell/cal-src/LexCAL.hs
There were multiple candidates for the Cabal entry "ParCAL" (/home/rob/code/haskell/cal-src/ParCAL.y), picking /home/rob/code/haskell/cal-src/ParCAL.hs
There were multiple candidates for the Cabal entry "LexCAL" (/home/rob/code/haskell/cal-src/LexCAL.x), picking /home/rob/code/haskell/cal-src/LexCAL.hs
There were multiple candidates for the Cabal entry "ParCAL" (/home/rob/code/haskell/cal-src/ParCAL.y), picking /home/rob/code/haskell/cal-src/ParCAL.hs
cocreature commented 8 years ago

@robstewart57 stack-ide is pretty much dead afaik, you probably want to use intero instead

robstewart57 commented 8 years ago

@cocreature Ah thanks. I hadn't realised that I was commenting on a stack-ide issue. My issue is to with only with the stack executable.