Repository navigation
Closed
Description
Currently running ghcide on VSCode, typechecker works on a simple project (single executable) but warnings dont.
My .cabal file is:
...
executable MyFancyProject
main-is: Main.hs
build-depends: base ^>=4.13.0.0
hs-source-dirs: app
default-language: Haskell2010
ghc-options:
-Wall
-Wincomplete-record-updatesAnd this is my app/Main.hs:
module Main where
import Data.List (tails)
main :: IO ()
main = putStrLn "Hello, Haskell!"
myf :: Int
myf = 5
where
a = case (1 == 1) of
True -> 0
False -> 1
_ -> 50
b = 3When building or with cabal repl I get the expected warnings:
-Wunused-imports: The import of `Data.List` is redundant
-Wunused-top-binds: Defined but not used: `myf`
-Woverlapping-patterns: Pattern match is redundant
-Wunused-local-binds: Defined but not used `b`
...
This is the output I get from running ghcide app/Main.hs
ghcide version: 0.1.0 (GHC: 8.8.3) (PATH: C:\Users\Ryzen\AppData\Roaming\cabal\bin\ghcide.exe)
Ghcide setup tester in C:\Users\Ryzen\Desktop\MyFancyProject.
Report bugs at https://github.com/digital-asset/ghcide/issues
Step 1/6: Finding files to test in C:\Users\Ryzen\Desktop\MyFancyProject
Found 1 files
Step 2/6: Looking for hie.yaml files that control setup
Found 1 cradle
Step 3/6, Cradle 1/1: Implicit cradle for C:\Users\Ryzen\Desktop\MyFancyProject
Cradle {cradleRootDir = "C:\\Users\\Ryzen\\Desktop\\MyFancyProject", cradleOptsProg = CradleAction: Default}
Step 4/6, Cradle 1/1: Loading GHC Session
Step 5/6: Initializing the IDE
Step 6/6: Type checking the files
Completed (1 file worked, 0 files failed)
According to haskell/ghcide#200 the warnings specified in the .cabal file should set the proper warnings, yet I don't see them in my editor.
System specs:
- OS: Windows 10 v1909
- GHC: 8.8.3
- cabal-install: 3.0.0.0
Metadata
Metadata
Assignees
Labels
No labels
Activity
[-]cabal warnings don't show up as warnings[/-][+]cabal warnings don't show up[/+]mpickering commentedon Apr 8, 2020
The issue is that the naive implicit cradle finding logic is failing to identify your project is a cabal project.
If you specify an explicit
hie.yamlfile then you will see warnings.emlautarom1 commentedon Apr 8, 2020
Alright, that somewhat worked but some warnings still don't show up like
-Woverlapping-patterns. (I get why, see haskell/ghcide#107)Why can't
ghcideautomatically detect each component (see haskell/ghcide#514) and the appropriate warning/flags? What needs to be done in order to get this functionality?As far as I understand,
hie-biosis responsible for the component/flags detection, yet in its current state it fails with multiple components/components with flags like warnings (see haskell/hie-bios#122)mpickering commentedon Apr 8, 2020
@emlautarom1 See haskell/ghcide#522 for progress in this regard but the short answer is that the build tools do not yet provide the right interface to make this possible without fragile contortions.
You will have better luck writing a
hie.yamlfor each of your projects at the moment.mpickering commentedon Apr 8, 2020
-Woverlapping-patternsis not enabled because ghcide does not desugar a module, which is when this warning is emitted.jneira commentedon Oct 5, 2020
Afaiu all the points mentiones had been fixed in ghcide master, @emlautarom1 feel free to create another specific issue if it is no the case for any of them