Open WnP opened 5 years ago
What is the working directory you're in when you're editing Foo/Baz.hs
? This is usually caused by the "project root" directory being different from the current directory, such as if you were to cd
into the directory, and edit the file from there.
Hi @RyanSquared I've try from src
directory and src
parent directory (which is the project's root directory)
On v2.4.0
this error occure when I'm not in src
directory, right now whatever the directory I'm in this error is raised
I can see this as well. From the project root, I get these import errors. If I cd
into the src
directory, they are gone.
@ford-prefect which release/version have you tested?
Not sure which things you want, so here goes:
ale
: commit aae6d30b1ec135e37ec3bea1885d161c6174572b
cabal-install
: 2.4.1.0
ghc
: 8.6.5
Happens with vim 8.1
and nvim 0.3.8
.
The fix in 2eb68f6 is incorrect.
ale#path#BufferCdString
is not a good way to locate the project root — the directory containing foopkg.cabal
.
For stack ghc
and cabal exec -- ghc
to work, the CWD must be at the project root — not the dirname
of the currently edited file.
Locating the project root dir is tricky (esp. if you want it reused cross-languages). One way:
dirname
of current buffer file;*.cabal
file;.git
repo root reached (return non-success).Since this logic is so tricky and fragile, the best method is actually allowing the user to set it; i.e. use Vim's CWD for project root. I.e. exactly what 2eb68f6 broke while trying to fix.
I'd recommend reverting 2eb68f6 ASAP, and try to arrive at a better solution later.
I'm seeing this too. It's also manifesting as ALE being unaware of enabled extensions until my PWD matches the directory of the active buffer.
Information
Operating System:
What went wrong
Haskell
cabal ghc
checker return import error on sub module source:Reproducing the bug
Project structure:
when editing
Main.hs
which importFoo.Bar
there is no issue, but when editingFoo.Baz
which importFoo.Bar
then the error occure.I've made a
git bisect
to find when this issue was added, and it came from PR #2345, commit2eb68f6d23f51c33f3d64a15172c869e71d7829b
, prior to that PR / commit this issue is not present.So
ale v2.4.0
is not affected.:ALEInfo