1

我是haskell的新手,所以我对haskell世界的ghc-mod工作原理和类似构建工具如何在幕后移动没有深入的了解。cabal-install

但我不知何故从 github 找到了 vim haskell 插件,包括neco-ghc自动完成插件,ghc-mod它对我来说似乎很有吸引力。

问题是它仅适用于已初始化项目的项目级 haskell 源代码,cabal-install而在stack-initialized 项目中根本不起作用。

我的目录结构是通过以下命令生成的:

~ $ mkdir my_project && cd my_project
~/my_project $ cabal init
~/my_project $ cabal sandbox init

产生

my_project  
|-- Setup.hs  
|-- cabal.sandbox.config  
|-- src / Lib.hs

自动完成在我编辑时有效(它建议 Prelude 模块的关键字),Setup.hs但在我尝试 edit 时我没有任何建议src/Lib.hs

我的:NecoGhcDiagnotics命令输出

Current filetype: haskell                                                                                                                                                                                                    
ghc-mod is executable: 1                                                                                                                                                                                                     
omnifunc: necoghc#omnifunc                                                                                                                                                                                                   
neocomplete.vim: 0                                                                                                                                                                                                           
neocomplcache.vim: 2                                                                                                                                                                                                         
YouCompleteMe: 0                                                                                                                                                                                                             
vimproc.vim: 900                                                                                                                                                                                                             
ghc-mod: 5.4.0.0                                                                                                                                                                                                             
Imported modules: Prelude                                                                                                                                                                                                    
Number of symbols in Prelude: 0     

当我编辑src/Lib.hs

Current filetype: haskell                                                                                                                                                                                                    
ghc-mod is executable: 1                                                                                                                                                                                                     
omnifunc: necoghc#omnifunc                                                                                                                                                                                                   
neocomplete.vim: 0                                                                                                                                                                                                           
neocomplcache.vim: 2                                                                                                                                                                                                         
YouCompleteMe: 0                                                                                                                                                                                                             
vimproc.vim: 900                                                                                                                                                                                                             
ghc-mod: 5.4.0.0                                                                                                                                                                                                             
Imported modules: Distribution.Simple, Prelude                                                                                                                                                                               
Number of symbols in Prelude: 235   

是我编辑时命令的输出Setup.hs

ghc-mod很明显,我在编辑时似乎没有检测到任何符号src/Lib.hs..为什么会这样?

4

1 回答 1

4

按要求发布答案:ghc-mod5.4.0 坚持从项目的根目录运行。这破坏了各种依赖ghc-mod. 该neco-ghc插件已更新以应对此问题,其他程序正在放弃对ghc-mod.

于 2015-10-19T15:20:17.913 回答