Completion now off for comments and strings
This commit is contained in:
parent
02a1f8780c
commit
a8f095ec0a
@ -104,11 +104,26 @@ function! s:AddIdentifierIfNeeded()
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
function! s:InsideCommentOrString()
|
||||||
|
" Has to be col('.') -1 because col('.') doesn't exist at this point. We are
|
||||||
|
" in insert mode when this func is called.
|
||||||
|
let syntax_group = synIDattr( synID( line( '.' ), col( '.' ) - 1, 1 ), 'name')
|
||||||
|
if stridx(syntax_group, 'Comment') > -1 || stridx(syntax_group, 'String') > -1
|
||||||
|
return 1
|
||||||
|
endif
|
||||||
|
return 0
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
function! s:InvokeCompletion()
|
function! s:InvokeCompletion()
|
||||||
if &completefunc != "youcompleteme#Complete"
|
if &completefunc != "youcompleteme#Complete"
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if s:InsideCommentOrString()
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
py vim.command( "let cursor_text = '" + ycm.CurrentCursorTextVim() + "'" )
|
py vim.command( "let cursor_text = '" + ycm.CurrentCursorTextVim() + "'" )
|
||||||
|
|
||||||
" infinite loops are bad, mkay?
|
" infinite loops are bad, mkay?
|
||||||
|
Loading…
Reference in New Issue
Block a user