Open fduxiao opened 4 years ago
What is the content of the generated cabal file?
It looks like this:
cabal-version: 1.12
-- This file has been generated from package.yaml by hpack version 0.31.2.
--
-- see: https://github.com/sol/hpack
--
-- hash: 0237d3eaa901762b9786046b053689250944bf6f8f5cd71ad3894e00fc5f5a72
name: mal
version: 0.1.0.0
description: Please see the README on GitHub at <https://github.com/githubuser/mal2#readme>
homepage: https://github.com/githubuser/mal2#readme
bug-reports: https://github.com/githubuser/mal2/issues
author: Author name here
maintainer: example@example.com
copyright: 2019 Author name here
license: BSD3
license-file: LICENSE
build-type: Simple
extra-source-files:
README.md
ChangeLog.md
source-repository head
type: git
location: https://github.com/githubuser/mal2
library
exposed-modules:
Eval
Lexer
Mal
Reader
Repl
Runtime
other-modules:
Paths_mal
hs-source-dirs:
src
build-depends:
base >=4.7 && <5
, haskeline
, hspec
, parsec
default-language: Haskell2010
executable mal-exe
main-is: Main.hs
other-modules:
Paths_mal
hs-source-dirs:
app
ghc-options: -threaded -rtsopts -with-rtsopts=-N
build-depends:
base >=4.7 && <5
, haskeline
, hspec
, mal
, parsec
default-language: Haskell2010
test-suite mal-test
type: exitcode-stdio-1.0
main-is: Spec.hs
other-modules:
Helper
NumberSpec
Paths_mal
hs-source-dirs:
test
ghc-options: -threaded -rtsopts -with-rtsopts=-N
build-depends:
base >=4.7 && <5
, haskeline
, hspec
, mal
, parsec
default-language: Haskell2010
Can you maybe share the project so I can try, too?
Sure, the repo is here. I am following this guide writing a lisp.
I had the same error today with a simple servant project. When I ran the stack test
command the error seem to be disappeared
Same problem here, I'm able to reproduce this error with this project that contains test files.
I am also facing same issue.
Problem is related to stack. By default test-components are not in the global project definition, and executing stack test
enables test components. That is why stack test
does solve that problem.
Another possible work-around is to use an explicit hie.yaml
cradle:
stack:
- path: ./test
component: "project:test:test-name"
- path: ./src
component: "project:lib"
...
All available targets can be shown with stack ide targets
.
Problem is related to stack. By default test-components are not in the global project definition, and executing
stack test
enables test components. That is whystack test
does solve that problem. Another possible work-around is to use an explicithie.yaml
cradle: stack: - path: ./test component: "project:test:test-name" - path: ./src component: "project:lib" ...
All available targets can be shown with
stack ide targets
.
My project is not using stack. I am facing this issue when running cabal test
.
@prophet1906 You are running into the described problem and after running cabal test
, the problem is solved? Do you have any special changes in your cabal project?
On my test project using cabal, I can load test-files.
Problem is related to stack. By default test-components are not in the global project definition, and executing
stack test
enables test components. That is whystack test
does solve that problem. Another possible work-around is to use an explicithie.yaml
cradle: stack: - path: ./test component: "project:test:test-name" - path: ./src component: "project:lib" ...
All available targets can be shown with
stack ide targets
.
I wonder if we should not automatically construct this cradle, or its effect anyway. It seems it should be a straightforward generalisation, perhaps for when there is no hie.yaml
.
I would argue that cabal-helper does exactly that, in a sophisticated way and true to the original build plan. In the original build plan, some components are not active or hidden by flags in the *.cabal
file.
And what about change cabal-helper to configure/build the project with --test --bench --no-run-tests --no-run-benchmarks
here: https://github.com/DanielG/cabal-helper/blob/5b6cefdbe03ebc4ec6451751fbaba72cab663766/lib/Distribution/Helper.hs#L522-L531?
And what about change cabal-helper to configure/build the project with --test --bench --no-run-tests --no-run-benchmarks
I like that idea, to make it at least configurable.
I'm seeing this all over my codebase now, not just the tests.
This is what I get as the actual 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
From what I can tell, it's not looking at the library
in my cabal file, where the module is exposed.
@tuomohopia
ChLibName ChMainLibName with source directory: [\"src\",\"src/schema\",\"src/api\",\"src/Questions\",\"src/Users\"]
this is your library component. Can you share the resulting .cabal file? I thought that multiple source directories are invalid, so maybe we are not covering this case.
@fendor My full .cabal
file looks like this
-- 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: tuomo.hopia@gmail.com
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
Got same problem with a stack/hpack-based project, but for Setup.hs
(the one for test files indeed goes away after doing stack test
):
2020-02-09 18:48:25.020555898 [ThreadId 4] - Fail on cradle initialisation: (ExitFailure 2)["Could not obtain flags for: \"Setup.hs\".","","This module was not part of any component we are aware of.","","Component: ChLibName ChMainLibName with source directory: [\"src\"]","Component: ChExeName \"hwc-exe\" with source directory: [\"app\"]","Component: ChTestName \"hwc-test\" with source directory: [\"test\"]","","","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."]
The project in question is here. Is there any workaround for this one?
This error pops up like every second, it's annoying (I guess that it is the main problem, not the actual error?) So maybe there is a way, as a temporary solution, to just hide the error? Or to hide any errors in vscode.
@0xd34df00d We are currently not supporting diagnostics for Setup.hs
. E.g. we can not load this into the IDE.
@kirillFedorov1 Unless you have the same issue as @0xd34df00d, you should not ignore this message, as it means that something can not be loaded. If you just want to ignore special files, take a look at https://github.com/haskell/haskell-ide-engine#project-configuration where you can specify that certain source files should not be loaded by hie.
@fendor I wasn't trying to load Setup.hs
, this appeared when I tried to open the usual app/Main.hs
. Sorry for omitting that!
@0xd34df00d Maybe you have opened it by accident before that? Requests to compile files are queued and executed in order. I can not imagine any other reason why else hie was trying to load Setup.hs
if you didnt open it explicitly yourself
@fendor that's unlikely, I can reproduce this by just opening a fresh instance of vim (+ coc + hie) with that single file as an argument.
Then please post the logs for it. Alternatively, you can also try to invoke hie --debug app/Main.hs
and see if this reproduces the error.
@fendor here's the log as per :CocInfo
: https://gist.github.com/0xd34df00d/c34916ec411bd1a58445d3cbd09cd881
Interestingly, hie --debug app/Main.hs
looks fine and does not even mention Setup.hs
.
The line:
2020-02-10 15:06:26.976459722 [ThreadId 4] - args:[]
and
2020-02-10 15:06:28.48306779 [ThreadId 4] - args:[]
seem to be wrong, it should be ["--lsp"] Without it hie is in "trace" mode and tries to load everything int the project instead start the lsp server, needed to connect the editor as a client. So i would revise the editor config.
EDIT: However, the output does not match the actual ouput of hie without --lsp
. What version of hie are you using?
When running hie
without --lsp
there should be a line telling:
To run as a LSP server on stdio, provide the '--lsp' argument
@jneira that explains it! Looks like I did my :CocConfig
before this flag was introduced/mentioned in the README
, and I missed it when I skimmed the README yesterday.
Re the version, I'm on 49c6185efdec715a4b2954efa7887520f7196cc8 — pulled a couple of days ago.
Problem is related to stack. By default test-components are not in the global project definition, and executing
stack test
enables test components. That is whystack test
does solve that problem. Another possible work-around is to use an explicithie.yaml
cradle: stack: - path: ./test component: "project:test:test-name" - path: ./src component: "project:lib" ...
All available targets can be shown with
stack ide targets
.
Hi I tried using this as a work around. But manually specifying the yaml
file can soon becomes tedious due to the fact that I have 15 components and also even when I take the pain to create the HIE file. It will complain about cannot find certain modules that I imported in my file.
For example in my test file the lines go like:
import Test.Hspec
import Control.Exception.Safe
And if I specify the hie.yaml
explicitly, it will say:
Could not load module ‘Test.Hspec’
It is a member of the hidden package ‘hspec-2.7.1’.
You can run ‘:set -package hspec’ to expose it.
(Note: this unloads all the modules in the current scope.)
Use -v to see a list of the files searched for.
This never happen if I don't explicitly specify the hie.yaml
.
@524119574 have you tried to run stack build --test --no-run-tests
and reload the project?
From my own comment in #1676:
I've just tested a similar configuration (using stack with an explicit hie-yaml
) and it seems once that stack has built the project with stack build --test
the module is loaded succesfully even after a stack clean
.
stack needs to build the dependencies in the global cache (in the $(stack path --snapshot-install-root)
directory) and the error only is reproduced for me if i delete that dir.
In fact i am not sure it would be a stack bug cause the behaviour is reproduced only using stack commands:
$ rm -rf $(stack path --snapshot-install-root)
$ rm -rf .stack-work/
$ stack repl project:test:test-name
....
Warning: Didn't find expected autogen file:
D:\dev\ws\haskell\project\.stack-work\dist\e626a42b\build\stack-test-test\autogen\cabal_macros.h
GHCi, version 8.6.5: http://www.haskell.org/ghc/ :? for help
<command line>: cannot satisfy -package hspec-2.7.1
(use -v for more information)
$ stack build --test --no-run-tests
....
Completed 29 action(s)
$ stack repl project:test:test-name
.....
Configuring GHCi with the following packages: stack-test
GHCi, version 8.6.5: http://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling Main ( D:\dev\ws\haskell\project\test\MyLibTest.hs, interpreted )
Ok, one module loaded.
Loaded GHCi configuration from D:\\dev\\....
*Main>
@524119574 have you tried to run
stack build --test --no-run-tests
and reload the project?From my own comment in #1676:
I've just tested a similar configuration (using stack with an explicit
hie-yaml
) and it seems once that stack has built the project withstack build --test
the module is loaded succesfully even after astack clean
. stack needs to build the dependencies in the global cache (in the$(stack path --snapshot-install-root)
directory) and the error only is reproduced for me if i delete that dir.
Ah it seems like working now. Thanks a lot!
Opened a issue upstream: https://github.com/commercialhaskell/stack/issues/5213 to fix the issue with a explicit hie.yaml
file
To fix it using the cabal-helper
cradle we need to change it: https://github.com/DanielG/cabal-helper/pull/92
Can someone please explain how can I specify that tests/tests.hs should not be loaded by hie? Should I just delete - path: ./test/dispatcher/
- path: ./test/functional/
- path: ./test/unit/
sections in hie.yaml?
@kirillFedorov1 You have to specify a none
- cradle.
Given this hie.yaml
cradle:
cabal:
- path: "./test/dispatcher/"
component: "test:dispatcher-test"
- path: "./test/functional/"
component: "test:func-test"
- path: "./test/unit/"
component: "test:unit-test"
- path: "./hie-plugin-api/"
component: "lib:hie-plugin-api"
- path: "./app/MainHie.hs"
component: "exe:hie"
- path: "./app/HieWrapper.hs"
component: "exe:hie-wrapper"
- path: "./"
component: "lib:haskell-ide-engine"
And now you dont want to load any test files, you can do:
cradle:
multi:
# Usual cradle for all paths
- path: ./
config:
cradle:
cabal:
- path: "./hie-plugin-api/"
component: "lib:hie-plugin-api"
- path: "./app/MainHie.hs"
component: "exe:hie"
- path: "./app/HieWrapper.hs"
component: "exe:hie-wrapper"
- path: "./"
component: "lib:haskell-ide-engine"
# None cradle, dont load any module in that folder
- path: ./test
config:
cradle:
none:
@fendor I made a hie.yaml in my working root, now the error doesn't appear, but another message appears every time: Saving 'tests.hs': Running 'Haskell Language Server' Formatter (configure).
And it seems something happened with my autosave setting.
Can you provide all logs please? For vscode, https://github.com/alanz/vscode-hie-server#investigating-and-reporting-problems
@fendor I use stack, by the way. I have just realized that in hie.yaml
you provided cabal is used.
2020-03-16 11:55:39.1848944 [ThreadId 8] - Command `ghc --print-libdir` failed.
2020-03-16 11:55:39.1848944 [ThreadId 8] - Could not obtain the libdir.
Using hie version: Version 1.0.0.0, Git revision 4bec07d79cf77c8ee855957d20e315a89f799d75 (3745 commits) x86_64 ghc-8.6.5
2020-03-16 11:55:39.1868945 [ThreadId 8] - Scheduler thread exited unexpectedly: hie.exe: panic! (the 'impossible' happened)
(GHC version 8.6.5 for x86_64-unknown-mingw32):
can't decompose ghc.exe path: "C:\\Users\\user\\AppData\\Roaming\\local\\bin\\hie.exe"
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
Then you have to change the component syntax and the tool at the top to stack
.
For stack components, see the command stack ide targets
@fendor Sorry I tried to figure out I swear
So stack ide targets
gives me exercises:lib, exercises:test:tests
How should hie.yaml
look? This is wrong:
cradle:
multi:
# Usual cradle for all paths
- path: ./
config:
cradle:
stack:
- path: "./hie-plugin-api/"
component: "exercises:lib:hie-plugin-api"
- path: "./app/MainHie.hs"
component: "exercises:lib:hie"
- path: "./app/HieWrapper.hs"
component: "exercises:lib:hie-wrapper"
- path: "./"
component: "exercises:lib:haskell-ide-engine"
# None cradle, dont load any module in that folder
- path: ./test
config:
cradle:
none:
No need to apologize :) I think it looks already almost correct, Ill take a stab in the dark and suggest it should look like this:
cradle:
multi:
# Usual cradle for all paths
- path: ./
config:
cradle:
stack:
- path: "./src/"
component: "exercises:lib"
# None cradle, dont load any module in that folder
- path: "./test"
config:
cradle:
none:
This means that your library component is located in the directory "src" and that you do not want to load anything that is in the "./test" directory.
If this does still not work, would you mind showing the output of invoking hie --debug .
in the root of your project?
@fendor it still doesn't work.
Running HIE(hie)
Version 1.0.0.0, Git revision 4bec07d79cf77c8ee855957d20e315a89f799d75 (3745 commits) x86_64 ghc-8.6.5
To run as a LSP server on stdio, provide the '--lsp' argument
Current directory:D:\ssd-data\work\exercises
args:["--debug","."]
Looking for project config cradle...
2020-03-16 16:34:08.8436322 [ThreadId 3] - Found "D:\ssd-data\work\exercises\hie.yaml" for "D:\ssd-data\work\exercises\File.hs"
2020-03-16 16:34:08.9436379 [ThreadId 3] - Module "D:\ssd-data\work\exercises\File.hs" is loaded by Cradle: Cradle {cradleRootDir
= "D:\\ssd-data\\work\\exercises", cradleOptsProg = CradleAction: Stack}
2020-03-16 16:34:08.9746397 [ThreadId 3] - Executing Stack GHC with args: --numeric-version
2020-03-16 16:34:09.9176936 [ThreadId 3] - GHC Output: "Just "8.6.5""
2020-03-16 16:34:09.9296943 [ThreadId 3] - Executing Stack GHC with args: --print-libdir
2020-03-16 16:34:10.8147449 [ThreadId 3] - GHC Output: "Just "C:\\Users\\user\\AppData\\Local\\Programs\\stack\\x86_64-windows\\ghc-8.6.5\\lib""
###################################################
Cradle: Stack project
Project Ghc version: 8.6.5
Libdir: Just "C:\\Users\\user\\AppData\\Local\\Programs\\stack\\x86_64-windows\\ghc-8.6.5\\lib"
Searching for Haskell source files...
Found 4 Haskell source files.
###################################################
Found the following files:
D:\ssd-data\work\exercises\tests\tests.hs
D:\ssd-data\work\exercises\src\Exercises.hs
D:\ssd-data\work\exercises\Setup.hs
D:\ssd-data\work\exercises\app\Main.hs
Load them all now. This may take a very long time.
2020-03-16 16:34:10.9117505 [ThreadId 3] - New cradle: D:\ssd-data\work\exercises\tests\tests.hs
2020-03-16 16:34:10.9157507 [ThreadId 3] - Found "D:\ssd-data\work\exercises\hie.yaml" for "D:\ssd-data\work\exercises\tests\tests.hs"
2020-03-16 16:34:10.9267513 [ThreadId 3] - Module "D:\ssd-data\work\exercises\tests\tests.hs" is loaded by Cradle: Cradle {cradleRootDir = "D:\\ssd-data\\work\\exercises", cradleOptsProg = CradleAction: Stack}
2020-03-16 16:34:10.9277514 [ThreadId 3] - Found cradle: Cradle {cradleRootDir = "D:\\ssd-data\\work\\exercises", cradleOptsProg = CradleAction: Stack}
2020-03-16 16:34:10.956753 [ThreadId 3] - New cradle: D:\ssd-data\work\exercises\src\Exercises.hs
2020-03-16 16:34:10.9577531 [ThreadId 3] - Found "D:\ssd-data\work\exercises\hie.yaml" for "D:\ssd-data\work\exercises\src\Exercises.hs"
2020-03-16 16:34:10.9587532 [ThreadId 3] - Module "D:\ssd-data\work\exercises\src\Exercises.hs" is loaded by Cradle: Cradle {cradleRootDir = "D:\\ssd-data\\work\\exercises", cradleOptsProg = CradleAction: Stack}
2020-03-16 16:34:10.9587532 [ThreadId 3] - Found cradle: Cradle {cradleRootDir = "D:\\ssd-data\\work\\exercises", cradleOptsProg = CradleAction: Stack}
hie: Cannot decode byte '\xad': Data.Text.Internal.Encoding.streamDecodeUtf8With: Invalid UTF-8 stream
The hie.yaml
is correct, hie trips over some windows issue. @jneira I think you have encountered this issue before?
The Cannot decode byte '\xad'
part seems to be some encoding issue, similar to this one in ghcide: https://github.com/digital-asset/ghcide/issues/321. So maybe hie-bios
could be involved.
Maybe set the encoding in console to utf8, with chcp 65001
could help.
@jneira should I just put chcp 65001
into the terminal and then restart hie? That didn't work :(
I don't quite understand why this problem appeared only after making custom hie.yaml
for my project.
No, sorry for not being precise, i wanted to mean that chcp 65001
could change the behaviour running hie --debug
in the console. Do you get the same error (Cannot decode byte '\xad'
) in the hie log or only in the console?
@jneira Yes, the same error appears in the hie log and in the console. chcp 65001
helps to get rid of it, but then I get
hie: hie: panic! (the 'impossible' happened)
(GHC version 8.6.5 for x86_64-unknown-mingw32):
can't decompose ghc.exe path: "C:\\Users\\user\\AppData\\Roaming\\local\\bin\\hie.exe"
@kirillFedorov1 So with chcp 65001
we get ride of the encoding problem in the console, but then we are hitting the original error shown in the hie.log
: https://github.com/haskell/haskell-ide-engine/issues/1564#issuecomment-599418331
I think we can concentrate in
can't decompose ghc.exe path: "C:\\Users\\user\\AppData\\Roaming\\local\\bin\\hie.exe"
I guess user
is not the real machine user 😉 so at least, could you tell if the user name has non-ascii or spaces in the name (or other interesting attribute)?
@jneira "user" is the real name
It seems the error is thrown in ghc: https://github.com/ghc/ghc/blob/92b6a0237e0195cee4773de4b237951addd659d9/compiler/main/SysTools/BaseDir.hs#L153-L157
Everything was working well until I recompiled HIE with commit hash 22c69c620b2707119194bb33c4ae15427e46f0a2. When I try editing a test file, vscode keeps complaining the following:
Previously (at least in November 2019) I never met this, but now vscode warns me that
Fail on initialisation for "/Users/xiao/haskell/mal2/test/NumberSpec.hs". Could not obtain flags for: "test/NumberSpec.hs".
repeatedly. (The alert flashes so quickly that I narrowly copied this line).stack test
works correctly and the test source dir is specified in thetests
section ofpackage.yaml
(The same problem occurs even if I initialize a new project withstack
). It seems that HIE doesn't consider test sources as a component to be aware of.