Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Completion isn't working for local functions or modules #44

Closed
wedens opened this issue Feb 28, 2015 · 8 comments
Closed

Completion isn't working for local functions or modules #44

wedens opened this issue Feb 28, 2015 · 8 comments

Comments

@wedens
Copy link

wedens commented Feb 28, 2015

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
@wedens wedens changed the title completion working only for libraries Completion isn't working for local functions or modules Feb 28, 2015
@Shougo
Copy link
Collaborator

Shougo commented Feb 28, 2015

I think it is same problem.

#35

@wedens
Copy link
Author

wedens commented Feb 28, 2015

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

@Shougo
Copy link
Collaborator

Shougo commented Feb 28, 2015

You should create minimal .vimrc and reproduce ways.

@wedens
Copy link
Author

wedens commented Mar 1, 2015

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

@eagletmt
Copy link
Owner

eagletmt commented Mar 1, 2015

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 .

@wedens
Copy link
Author

wedens commented Mar 1, 2015

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

@Shougo Shougo closed this as completed in f2450ee Oct 28, 2015
@Shougo
Copy link
Collaborator

Shougo commented Oct 28, 2015

Added it.

bwbaugh added a commit to bwbaugh/dotfiles that referenced this issue Feb 22, 2016
Unfortunately, this behavior causes auto complete to fail for
definitions in the local module / buffer.

eagletmt/neco-ghc#44

Use `<C-x><C-p>` or `<C-x><C-n>` to manually get that type of
completion.

Also `g:haskellmode_completion_ghc` has to be `0` for me even though
the vim in 2016 article and associated repo show it equal to `1`.

http://www.stephendiehl.com/posts/vim_2016.html
@hasufell
Copy link

hasufell commented May 11, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants