Shougo / neocomplcache.vim

Ultimate auto-completion system for Vim.
http://www.vim.org/scripts/script.php?script_id=2620
1.72k stars 135 forks source link

Integration with third-party plugin. #401

Closed naquad closed 10 years ago

naquad commented 11 years ago

I'm trying to integrate with vim-lua-ftplugin (https://github.com/xolox/vim-lua-ftplugin).

For this I did following configuration:

" configure vim-lua-ftplugin

let g:lua_check_syntax = 0
let g:lua_compiler_name = 'luac5.1'
let g:lua_complete_omni = 1

" configure NeoComplCache to use vim-lua-ftplugin omnifunc

let g:neocomplcache_force_overwrite_completefunc = 1
if !exists('g:neocomplcache_omni_functions')
  let g:neocomplcache_omni_functions = {}
endif
if !exists('g:neocomplcache_force_omni_patterns')
  let g:neocomplcache_force_omni_patterns = {}
endif

let g:neocomplcache_omni_functions['lua'] = 'xolox#lua#omnifunc'
let g:neocomplcache_force_omni_patterns['lua'] = '\w\+[.:]\|require\s*(\?["'']\w*'

It partially works: whenever I type require(' I get list of completions from vim-lua-ftplugin omnifunc, but when I continue typing I'm not getting suggestions from omnifunc anymore.

So what am I doing wrong and how should it be done? Maybe some how to doc on doing similar stuff?

Shougo commented 11 years ago

I tested vim-xorox-ftplugin, but it displayes errors. I cannot fix it. I think xorox-ftplugin is broken...

naquad commented 11 years ago

summoning @Xorox . @Shougo could you please post errors you've ran into?

Shougo commented 11 years ago

OK.

In below script,

package.

and I pressed <C-x><C-o> keys.

Error detected while processing function xolox#lua#omnifunc..xolox#lua#getomnivariables..xolox#lua#dofile:
line    5:
...ndle/vim-lua-ftplugin/misc/lua-ftplugin/omnicomplete.lua:77: bad argument #1 to 'ipairs' (table expected, got userdata)
Error detected while processing function xolox#lua#omnifunc..xolox#lua#getomnivariables:
line    3:
E121: Undefined variable: Error
Error detected while processing function xolox#lua#omnifunc..xolox#lua#getomnivariables:
line    4:
E686: Argument of sort() must be a List
Error detected while processing function xolox#lua#omnifunc..<SNR>148_addsignatures:
line    1:
E714: List required
Error detected while processing function xolox#lua#omnifunc:
line   21:
E712: Argument of filter() must be a List or Dictionary
xolox commented 11 years ago

Just for the record the username is @xolox :-). I'm looking into the issue. Thanks for the feedback!

xolox commented 11 years ago

I just released a new version of the Lua file type plug-in for Vim (vim-lua-ftplugin) that fixes the issue mentioned here. Thanks for the heads up!

Shougo commented 11 years ago

This error was fixed. Thanks.

I used below settings and it works.

  " For vim-lua-ftplugin.
  let g:lua_check_syntax = 0
  let g:lua_complete_omni = 1
  let g:lua_complete_dynamic = 0

  let g:neocomplcache_omni_functions.lua =
        \ 'xolox#lua#omnifunc'
  let g:neocomplcache_omni_patterns.lua =
        \ '\w\+[.:]\|require\s*(\?["'']\w*'
  " let g:neocomplcache_force_omni_patterns.lua =
        " \ '\w\+[.:]\|require\s*(\?["'']\w*'
Shougo commented 11 years ago

screenshot_from_2013-05-12

But in vim-lua-ftplugin omni completion, the menu items are broken(for example, package.config and package.cpath and package.path).

@xolox Can you fix it?

xolox commented 11 years ago

Define 'broken'? They look fine to me?

Shougo commented 11 years ago

Are /\n;\n?\n!\n-\n and /usr/local/lib/lua/5.2/?.so;/usr/lib/i38.. correct menus?

xolox commented 10 years ago

I ran into the following error message today after compiling Vim from source and editing a Lua script:

bad argument #1 to 'ipairs' (table expected, got userdata)

It turns out the problem wasn't properly solved before (because I wasn't able to test back then). I now fixed this in 4746f4d4bddb51619c2956d73adfb22b73e066dd.

@Shougo: Sorry I never saw your most recent message, yes it works fine now, those are the proper menu items. They are not the completion candidates but a preview of the values (strings in this case, with embedded newlines, which are rendered as \n so that more than one line can be shown).

If you ask me this issue can be closed now.

Shougo commented 10 years ago

Thank you. I will close it.