Merge pull request #82 from erw7/fix-completion

Fix completion
This commit is contained in:
zah 2018-02-10 12:19:04 +02:00 committed by GitHub
commit 124697270e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -140,17 +140,25 @@ fun! NimComplete(findstart, base)
if synIDattr(synIDtrans(synID(line("."),col("."),1)), "name") == 'Comment'
return -1
endif
return col('.')
let line = getline('.')
let start = col('.') - 1
while start > 0 && line[start - 1] =~? '\w'
let start -= 1
endwhile
return start
else
let result = []
let sugOut = NimExec("--suggest")
for line in split(sugOut, '\n')
let lineData = split(line, '\t')
if len(lineData) > 0 && lineData[0] == "sug"
let word = split(lineData[2], '\.')[-1]
if a:base ==? '' || word =~# '^' . a:base
let kind = get(g:nim_symbol_types, lineData[1], '')
let c = { 'word': lineData[2], 'kind': kind, 'menu': lineData[3], 'dup': 1 }
let c = { 'word': word, 'kind': kind, 'menu': lineData[3], 'dup': 1 }
call add(result, c)
endif
endif
endfor
return result
endif