Tuesday, December 22, 2009

SQL completion questions/bug?

In vim 7.2, SQL completion fails on virtually any input with:

"Omni complete (^O^N^P) Pattern not found"

Looking into the function, I see
in /usr/share/vim/vim72/autoload/sqlcomplete.vim
in function sqlcomplete#Complete(findstart,base)

98 if a:findstart
99 " Locate the start of the item, including "."
100 let line = getline('.')
101 let start = col('.') - 1
102 let lastword = -1
103 let begindot = 0
104 " Check if the first character is a ".", for column completion
105 if line[start - 1] == '.'
106 let begindot = 1
107 endif
108 while start > 0
109 if line[start - 1] =~ '\(\w\|\s\+\)'
110 let start -= 1

If I change line 109's pattern from '\(\w\|\s\+\)' to '\w', completion
seems to work fine. I also noticed that I get completion if I'm in the
first column. So... what's that alternation *supposed* to catch? Or is
this a bug?


And, probably a simpler question: I couldn't figure out how to limit table
name completion to the 'current' database (current via the dbext plugin).
So, everything is annoyingly prefixed with the database name.

e.g. instead of:

insert into tablen<C-C>t

yielding:

insert into tablename

I get:

insert into database_name.tablename

Anyone have a slick setup for this?


Best,
Ben

--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php

No comments: