eagletmt/neco-ghc

Completion isn't working for local functions or modules

wedens opened this issue · 8 comments

Completion works only for system-wide and cabal libraries. If I create some very simple source file it will not complete functions from this file, or any other module created by me.
NecoGhcDiagnostics output:

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

I think it is same problem.

#35

In #35 completion works only for Prelude. In my case it also works in other imported modules (e.g. Xmonad)

You should create minimal .vimrc and reproduce ways.

vimrc:

set nocompatible
filetype off
call plug#begin('~/.vim/plugged')

Plug 'Shougo/vimproc.vim'
Plug 'eagletmt/neco-ghc'
call plug#end()
filetype plugin indent on

autocmd FileType haskell setlocal omnifunc=necoghc#omnifunc

some very simple source file:

myfun x y = x * y

myfun2 = my<C-X><C-O>

result is Pattern not found

It's the limitation of ghc-mod.
ghc-mod can show symbols of installed modules only.
ghc-mod cannot show symbols of developping modules or current source file.

As for completion for current source file, <C-x><C-p> or <C-x><C-n> could help.
It's Vim's built-in keyword completion. See :help compl-current .

I think this should be in some "FAQ" or "Limitations" section of README.

Added it.

Completion works only for system-wide and cabal libraries.

From my tests, it works fine if you are in a cabal sandbox and did cabal install to install the project into the projects sandbox.

Then you have all the symbols of your current project, but only from that installed state.