Fix completion
* Fix position where the completion starts. * Change to remove filename from word. * Change to filter completions.
This commit is contained in:
parent
f1d99dd8bd
commit
28c74af3a2
1 changed files with 12 additions and 4 deletions
|
|
@ -140,16 +140,24 @@ fun! NimComplete(findstart, base)
|
||||||
if synIDattr(synIDtrans(synID(line("."),col("."),1)), "name") == 'Comment'
|
if synIDattr(synIDtrans(synID(line("."),col("."),1)), "name") == 'Comment'
|
||||||
return -1
|
return -1
|
||||||
endif
|
endif
|
||||||
return col('.')
|
let line = getline('.')
|
||||||
|
let start = col('.') - 1
|
||||||
|
while start > 0 && line[start - 1] =~? '\w'
|
||||||
|
let start -= 1
|
||||||
|
endwhile
|
||||||
|
return start
|
||||||
else
|
else
|
||||||
let result = []
|
let result = []
|
||||||
let sugOut = NimExec("--suggest")
|
let sugOut = NimExec("--suggest")
|
||||||
for line in split(sugOut, '\n')
|
for line in split(sugOut, '\n')
|
||||||
let lineData = split(line, '\t')
|
let lineData = split(line, '\t')
|
||||||
if len(lineData) > 0 && lineData[0] == "sug"
|
if len(lineData) > 0 && lineData[0] == "sug"
|
||||||
let kind = get(g:nim_symbol_types, lineData[1], '')
|
let word = split(lineData[2], '\.')[-1]
|
||||||
let c = { 'word': lineData[2], 'kind': kind, 'menu': lineData[3], 'dup': 1 }
|
if a:base ==? '' || word =~# '^' . a:base
|
||||||
call add(result, c)
|
let kind = get(g:nim_symbol_types, lineData[1], '')
|
||||||
|
let c = { 'word': word, 'kind': kind, 'menu': lineData[3], 'dup': 1 }
|
||||||
|
call add(result, c)
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
return result
|
return result
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue