xolox / vim-lua-ftplugin

Lua file type plug-in for the Vim text editor
http://peterodding.com/code/vim/lua-ftplugin
187 stars 27 forks source link

add sanity check for module names #42

Closed vzhong closed 6 years ago

vzhong commented 8 years ago

Fix for #40. I added a small sanity check to make sure that the output of omnicomplete.lua starts with "{" (eg. is valid dictionary object).

idbrii commented 6 years ago

Using this commit causes an error when stdlib autocompletion.

Error:

~/.vim/bundle/lua-xolox/autoload/xolox/lua.vim|435| xolox#lua#getomnivariables[4]
|| E15: Invalid expression: [{'word':'local','kind':'k'},{'word':'elseif','kind':'k'},{'word':'true','kind':'k'},{'word':'while','kind':'k'},{'word':'if','kind':'k'},{'word':'break','kind':'k'},{'word':'end','kind':'k'},{'word':'goto','kind':'k'},{'word':'then','kind':'k'},{'word':'do','kind':'k'},{'word':'and','kind':'k'},{'word':'not','kind':'k'},{'word':'or','kind':'k'},{'word':'in','kind':'k'},{'word':'until','kind':'k'},{'word':'return','kind':'k'},{'word':'function','kind':'k'},{'word':'repeat','kind':'k'},{'word':'nil','kind':'k'},{'word':'for','kind':'k'},{'word':'false','kind':'k'},{'word':'else','kind':'k'},{'word':'xpcall','kind':'f','menu':'xpcall()'},{'word':'rawlen','kind':'f','menu':'rawlen()'},{'word':'collectgarbage','kind':'f','menu':'collectgarbage()'},{'word':'arg','kind':'t','menu':'arg[]'},{'word':'ipairs','kind':'f','menu':'ipairs()'},{'word':'vim.list','kind':'f','menu':'vim.list()'},{'word':'vim.eval','kind':'f','menu':'vim.eval()'},{'word':'vim.buffer','kind':'f','menu':'vim.buffer()

Vader test:

Given lua (some code):
  local a = 9

Do:
* Two completions to ensure we insert a word
  ostring.\<C-n>\<C-n>

Expect (second result):
  local a = 9
  string.char

(Vader test doesn't fail when run from bash. And it gives a different error from what I see in editor. But it demonstrates the repro.)

vzhong commented 6 years ago

I no longer use lua actively so I don't think I would be a good person to follow up with this. Closing this PR due to lack of activity.