Skip to content
This repository has been archived by the owner on Oct 7, 2020. It is now read-only.

HIE does not handle multiple source directories correctly #1576

Closed
fendor opened this issue Jan 19, 2020 · 4 comments · Fixed by #1577
Closed

HIE does not handle multiple source directories correctly #1576

fendor opened this issue Jan 19, 2020 · 4 comments · Fixed by #1577

Comments

@fendor
Copy link
Collaborator

fendor commented Jan 19, 2020

Error message:

2020-01-19 11:54:16.3609472 [ThreadId 103] - Fail on cradle initialisation: (ExitFailure 2)["Could not obtain flags for: \"src\\schema\\AnswerChoice.hs\".","","This module was not part of any component we are aware of.","","Component: ChLibName ChMainLibName with source directory: [\"src\",\"src/schema\",\"src/api\",\"src/Questions\",\"src/Users\"]","Component: ChExeName \"healthbot-api-exe\" with source directory: [\"app\"]","Component: ChExeName \"migrations\" with source directory: [\"migrations\"]","","","To expose a module, refer to:","https://docs.haskellstack.org/en/stable/GUIDE/","If you are using `package.yaml` then you don't have to manually expose modules.","Maybe you didn't set the source directories for your project correctly."]
2020-01-19 11:54:16.361947 [ThreadId 38] - ghcDispatcher:Got error for a request: IdeError {ideCode = OtherError, ideMessage = "Fail on initialisation for \"D:\\dev\\healthbot\\healthbot-api\\src\\schema\\AnswerChoice.hs\". Could not obtain flags for: \"src\\schema\\AnswerChoice.hs\".", ideInfo = Null} with mid: Nothing

Generated .cabal file.

-- This file has been generated from package.yaml by hpack version 0.31.1.
--
-- see: https://github.com/sol/hpack
--
-- hash: 8313da4611145f153645f4cdd683b1e59fa8a667a9a62f5484494f7a39934dfd

name:           healthbot-api
cabal-version:  >= 1.8
version:        0.1.0.0
description:    Please see the README on GitHub at <https://github.com/tuomohopia/healthbot-api#readme>
homepage:       https://github.com/tuomohopia/healthbot-api#readme
bug-reports:    https://github.com/tuomohopia/healthbot-api/issues
author:         Tuomo Hopia
maintainer:     [email protected]
copyright:      2019 Tuomo Hopia
build-type:     Simple
extra-source-files:
    README.md
    ChangeLog.md

source-repository head
  type: git
  location: https://github.com/tuomohopia/healthbot-api

library
  default-language: Haskell2010
  exposed-modules:
      Lib
      , Config
      , Geolocation
      , AnswerChoice
      -- , QuestionBattery
      , Helpers
      , Gender
      , Api
      , ApiDocs
      -- , RootEndpoint
      , Auth
      , Schema
      , Database.Database
      , Database.Setup
      -- Users:
      , Users.Types
      , UsersEndpoint
      , Database.Query.Users
      -- Questions:
      , Questions.Types
      , QuestionsEndpoint
      , Database.Query.Questions
      -- Answers:
      , Answers.Types
      , Answers.AnswerMapping
      , AnswersEndpoint
      , Database.Query.Answers
      -- Next Questions
      , Nexts.QuestionBattery
  other-modules:
      Paths_healthbot_api
  hs-source-dirs:
      src
      , src/schema
      , src/api
      , src/Questions
      , src/Users
  build-depends:
      base >=4.7 && <5
      , text
      , time
      , aeson
      , mtl
      , bytestring
      , containers >=0.6.0.1
      , persistent-database-url
      , envy
      , transformers
      , monad-logger
      , servant
      , servant-server
      , servant-docs
      , wai
      , warp
      , email-validate
      , servant-auth
      , servant-auth-server
      , servant-auth-docs
      , servant-swagger
      , servant-auth-swagger
      , swagger2
      , jose
      , cookie
      , persistent-postgresql
      , squeal-postgresql
      , postgresql-binary
      , generics-sop
      , resource-pool
      , lens
      , aeson-pretty

executable healthbot-api-exe
  main-is: Main.hs
  other-modules:
      Paths_healthbot_api
  exposed-modules:
      Main
  hs-source-dirs:
      app
  ghc-options: -threaded -rtsopts -with-rtsopts=-N
  build-depends:
      base >=4.7 && <5
    , healthbot-api
    , mtl
    , text
    , aeson
    , persistent
    , persistent-postgresql
    , persistent-template
    , monad-logger
    , time
    , transformers
    , containers >=0.6.0.1
    , envy
    , bytestring
    , wai
    , warp
    , persistent-database-url
    , servant
    , servant-server
    , servant-auth
    , servant-auth-server
  default-language: Haskell2010

executable migrations
  main-is: Main.hs
  other-modules:
      Paths_healthbot_api
  hs-source-dirs:
      migrations
  ghc-options: -threaded -rtsopts -with-rtsopts=-N
  build-depends:
      base >=4.7 && <5
    , healthbot-api
    , mtl
    , text
    , persistent
    , persistent-postgresql
    , monad-logger
    , transformers
    , containers >=0.6.0.1
    , envy
    , bytestring
    , persistent-database-url
  default-language: Haskell2010

test-suite unit-tests
  type: exitcode-stdio-1.0
  main-is: Spec.hs
  other-modules:
      Paths_healthbot_api, ConfigSpec, SeedData, SeedHelpers
  hs-source-dirs:
      test
      , test/unit
  ghc-options: -threaded -rtsopts -with-rtsopts=-N
  build-depends:
      base >=4.7 && <5
    , healthbot-api
    , mtl
    , text
    , aeson
    , persistent
    , persistent-postgresql
    , persistent-template
    , monad-logger
    , time
    , transformers
    , containers >=0.6.0.1
    , envy
    , hspec
    , hspec-wai
    , bytestring
    , hspec-discover
    , wai
    , warp
    , servant-client
    , http-client
    , http-types
  default-language: Haskell2010

test-suite integration-tests
  type: exitcode-stdio-1.0
  main-is: Spec.hs
  other-modules:
      Paths_healthbot_api, SeedHelpers, SeedHelpers, TestHelpers, SeedData, UsersEndpointSpec, QuestionsEndpointSpec, AnswersEndpointSpec
  hs-source-dirs:
      test
      , test/integration
      , app
  ghc-options: -threaded -rtsopts -with-rtsopts=-N
  build-depends:
      base >=4.7 && <5
    , healthbot-api
    , mtl
    , text
    , aeson
    , persistent
    , persistent-postgresql
    , persistent-template
    , persistent-database-url
    , monad-logger
    , time
    , transformers
    , containers >=0.6.0.1
    , envy
    , hspec
    , hspec-wai
    , hspec-wai-json
    , bytestring
    , hspec-discover
    , hspec-expectations-lifted
    , wai
    , warp
    , servant
    , servant-server
    , servant-client
    , http-client
    , http-types
    , servant-auth
    , servant-auth-server
    , servant-auth-client
    , jose
  default-language: Haskell2010

Originally posted by @tuomohopia in #1564 (comment)

@fendor
Copy link
Collaborator Author

fendor commented Jan 19, 2020

Paths in the error message look weird, maybe we are not normalising them enough for windows?

@fendor
Copy link
Collaborator Author

fendor commented Jan 19, 2020

Can reproduce on linux.

@fendor
Copy link
Collaborator Author

fendor commented Jan 19, 2020

I found the offending line and I even documented this behaviour 😭

@fendor
Copy link
Collaborator Author

fendor commented Jan 19, 2020

Bug fix on the way, just need to add some tests for it, too.

fendor added a commit to fendor/haskell-ide-engine that referenced this issue Jan 19, 2020
fendor added a commit to fendor/haskell-ide-engine that referenced this issue Jan 23, 2020
fendor added a commit to fendor/haskell-ide-engine that referenced this issue Jan 24, 2020
fendor added a commit that referenced this issue Jan 24, 2020
* Add failing test-cases for #1576

* Handle multiple source directories correctly

Change existing behaviour to find all source directories
which are a prefix of the given filepath.

* Relax base constraints on c-h testdata

There was probably no reason to have the constraints in the first
pace

* Lower cabal constraint for testdata

* Avoid load checks as long as AZURE CI chokes on it
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant