Repository navigation
HdevtoolsType generates errors as if not configured using hdevtools_options #32
Copy link
Copy link
Open
Description
Hello, working with vim (nvim) with the integration of hdevtools improves my workflow a great deal. Thank you for this contribution.
Issue
When I call HdevtoolsType from vim's command line I get errors that say the binary can't find the modules in the project. I suspect this is an issue because of the following:
- in terminal,
hdevtools check -g -isrc -g -Wall -g -hide-package -g transformers src/Render/Pre.hsworks as expected - in vim's command line,
echo hdevtools_optionsI get what is expect:-g -isrc -g -Wall -g -hide-package -g transformers
... so why might I be getting the following when I call HdevtoolsType from vim's command line?
Failed to load targets
/Users/.../src/Render/Pre.hs:12:1: error:
Could not find module ‘Models’
Use -v to see a list of the files searched for.
/Users/.../src/Render/Pre.hs:13:1: error:
Could not find module ‘Lib.Lens’
Use -v to see a list of the files searched for.
Finally, when I look at the list of files searched, it seems to find them!
Failed to load targets
<no location info>: *** Chasing dependencies:
<no location info>:
Chasing modules from: */Users/.../src/Render/Pre.hs
<no location info>:
!!! Chasing dependencies: finished in 0.52 milliseconds, allocated 0.228 megabytes
<no location info>: *** Chasing dependencies:
<no location info>:
Chasing modules from: */Users/.../src/Render/Pre.hs
<no location info>:
!!! Chasing dependencies: finished in 0.52 milliseconds, allocated 0.225 megabytes
<no location info>:
Stable obj: []
Stable BCO: []
<no location info>:
Ready for upsweep
[NONREC
ModSummary {
ms_hs_date = 2018-04-07 13:34:20.687163728 UTC
ms_mod = Render.Pre,
ms_textual_imps = [(Nothing, Prelude), (Nothing, Lib.Lens),
(Nothing, Models)]
ms_srcimps = []
}]
<no location info>: *** Deleting temp files:
<no location info>: Deleting:
<no location info>:
compile: input file /Users/.../src/Render/Pre.hs
<no location info>:
*** Checking old interface for Render.Pre (use -ddump-hi-diffs for more details):
<no location info>:
[1 of 1] Compiling Render.Pre ( /Users/.../src/Render/Pre.hs, nothing )
<no location info>: *** Parser [Render.Pre]:
<no location info>:
!!! Parser [Render.Pre]: finished in 1.96 milliseconds, allocated 2.882 megabytes
<no location info>: *** Renamer/typechecker [Render.Pre]:
<no location info>:
!!! Renamer/typechecker [Render.Pre]: finished in 0.04 milliseconds, allocated 0.020 megabytes
/Users/.../src/Render/Pre.hs:12:1: error:
Could not find module ‘Models’
Locations searched:
Models.hs
Models.lhs
Models.hsig
Models.lhsig
src/Models.hs
src/Models.lhs
src/Models.hsig
src/Models.lhsig
/Users/.../src/Render/Pre.hs:13:1: error:
Could not find module ‘Lib.Lens’
Locations searched:
Lib/Lens.hs
Lib/Lens.lhs
Lib/Lens.hsig
Lib/Lens.lhsig
src/Lib/Lens.hs
src/Lib/Lens.lhs
src/Lib/Lens.hsig
src/Lib/Lens.lhsig
<no location info>: Upsweep partially successful.
<no location info>: *** Deleting temp files:
<no location info>: Deleting:
Thank you in advance for any pointers to resolving this issue.
- E
Metadata
Metadata
Assignees
Labels
No labels
Activity
bitc commentedon Apr 8, 2018
It looks like the problem might be that
hdevtoolsis being invoked from vim with the absolute path/Users/.../src/Render/Pre.hsrather than the relative pathsrc/Render/Pre.hsNote that it is important that you run vim from your project root directory, so that the relative paths will work
EdmundsEcho commentedon Apr 8, 2018
I normally do run vim from root... this said, not always. Thank you for reminding me. I'll try it out again and report back accordingly. This all said, my vim configuration enables the working directory to change based on the current buffer (
autochdir). It is a vim state that augments the functionality of<C-x><C-f>.Update: I tried it out making sure I started from root... it works. I opened vim from somewhere else, it fails. Thank you for figuring this out.
Key question: Does the plugin record the root directory once when first opened? In other words, can the plugin operate with the vim register
autochdir?bitc commentedon Apr 8, 2018
It is likely that
autochdirwill cause problems with this plugin.During a single session, all invocations of the
hdevtoolscommand must be called from the same directory. The first timehdevtoolsis run, it creates a socket file in the current directory called.hdevtools.sock. All subsequent commands look for this file in the current directory.The plugin uses
expand("%")to get the path to the current file. You can see what this evaluates by running this in vim:It may be possible to modify this plugin to work well with
autochdir, probably need to make use ofhdevtool's--socketoption.EdmundsEcho commentedon Apr 9, 2018
When starting vim from the root project directly, to open a file elsewhere in the project,
HdevtoolsTypeworks.:echo expand('%')=> the file name only.:echo expand('%:p')provides the file name and full path. Finally,:pwdconfirms I'm in a directory that is no longer root... interesting.I'll report back on what the output is when the plugin fails while using
autochdir.