-
Notifications
You must be signed in to change notification settings - Fork 208
Could not obtain flags for: "Setup.hs" #1650
Comments
I dont think you may delete it. Other work-around that got into my mind and I havent tested: cradle:
direct:
arguments:
- "-package Cabal-3.0.0.0"
- "-package base-4.12.0.0" |
afaik |
This work-around might not actually work, I did not try, yet :) |
Finally the error was throwed cause |
I mean, this issue can still be a feature request to load |
Uh, i thought abot that option but given it is handled by cabal in a exceptional way i guess it would be tricky: afaik cabal does not expose its build (or does it? dont know tbh) and we will have to replicate manually the ghc flags cabal uses to compile/interpret it, including the setup-config if the build-type is custom (see #1638) Maybe cabal-helper could do that? But more important, does it worth the effort? |
Maybe we should skip |
Cabal-Helper could be able to do it (not yet, but maybe in the future), or at least, we should modify Cabal to expose an interface to load the Problem with skipping
I think a custom |
@fendor a stupidly naive question: can I put in in one Something like cradle:
stack:
cabal: Or for a project that should support builds by both Stack and Cabal I need two files - |
No, you can not add entries for both build tools, since hie would then not know what to use! You only need a |
That's a pity.
Hmm... According to this, HIE should by default (if none of these files is present) use Stack (no ambiguity, no confusion, nothing points at Cabal - therefore use Stack), and only resort to Cabal if (a) In my experience, HIE got confused and failed to properly proceed when none of the above was present (though the project dir had both Before I saw your reply here, I decided to experiment, and created cradle:
stack:
cabal: HIE (invoked by VS Code) appeared to perform flawlessly, not displaying any confusion whatsoever. Then I successfully built this project by Stack (both "run" and "test") and Cabal (again, both "run" and "test"). What am I missing??? |
No, default is not stack but direct
then |
Is it likely that it would remain so?
What would be the impact of this? HIE doesn't build the project by itself, right? So, e.g., if it picks Stack but the project was actually intended for Cabal - what would be the harm? My use case - HIE as a part of VS Code-based IDE. How to actually build the project - ultimately I decide, and VS Code plugin(s) provides convenience buttons and task scripts (which again, I edit) to do that. |
I dont see a reason why it should, it is an implementation detail.
I am not sure what you are trying to ask and, moreover, this is completely unrelated to the issue, right? If you have questions in particular, please open another issue, dont hijack the issue described here, which is about opening a projects' Regarding your question: dont use |
Good point, thanks. Done: #1667 Although, I experienced the problem described here, which was remedied by adding |
What I'm using coc.nvim, and starting hie with with {
"languageserver": {
"haskell": {
"command": "hie-wrapper",
"args": ["--lsp", "--debug"],
"rootPatterns": [
"stack.yaml",
"cabal.config",
"package.yaml"
],
"filetypes": [
"hs",
"lhs",
"haskell"
],
"initializationOptions": {
"languageServerHaskell": {
"hlintOn": false,
"completionSnippetsOn": true
}
}
}
}
} Here is the output of my
|
@drewboardman With messages such as cradle:
stack: Also, this is still hijacking the issue. Just because the issue occurs in your problem, does not mean it is related. |
I appreciate the response. The issue was indeed fixed by using an |
I'm afraid it wasn't. Showed up on a test-project ( With everything current, and
cradle:
cabal:
module Main where
main :: IO ()
main = putStrLn "Hello, Haskell!"
cabal-version: 2.2
-- Initial package description 'h-tst1.cabal' generated by 'cabal init'.
-- For further documentation, see http://haskell.org/cabal/users-guide/
name: h-tst1
version: 0.1.0.0
-- synopsis:
-- description:
-- bug-reports:
license: MIT
license-file: LICENSE
-- author:
-- maintainer:
-- copyright:
-- category:
extra-source-files: CHANGELOG.md
executable h-tst1
main-is: Main.hs
-- other-modules:
-- other-extensions:
build-depends: base ^>=4.13.0.0
-- hs-source-dirs:
default-language: Haskell2010 Right now I don't use |
@mouse07410 It is currently not supported to open the If you really need to work on it, you are currently out of luck with hie/hls/ghcide. An untested work-around I thought about could be (same as here: #1650 (comment)): cradle:
multi:
- path: ./Setup.hs
config:
cradle:
direct:
- "-package Cabal"
- "-package base"
- path: ./
config:
cradle:
cabal: |
Ah, OK. Then I'm not missing anything. Thankfully, I don't really need it right now.
Thanks! Will try it and report. UpdateDoesn't seem to work: |
You made me look... The error is in the hie.yaml, it should be: cradle:
multi:
- path: ./Setup.hs
config:
cradle:
direct:
arguments:
- "-package Cabal"
- "-package base"
- path: ./
config:
cradle:
cabal: Then it actually works |
Thank you!! Now there's a working workaround! ;-) Appreciate! |
The workaround could be creating a implicit configuration with a
hie.yaml
file to make hie ignoreMain.hs
More drastic one: if
Setup.hs
is the default one, like this:and you
build-type
issimple
(the default one) in your<pkgname>.cabal
file, afaik you can delete it.The text was updated successfully, but these errors were encountered: