Completion now off for comments and strings

This commit is contained in:
Strahinja Val Markovic 2012-06-24 12:04:45 -07:00
parent 02a1f8780c
commit a8f095ec0a

View File

@ -104,11 +104,26 @@ function! s:AddIdentifierIfNeeded()
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()
if &completefunc != "youcompleteme#Complete"
return
endif
if s:InsideCommentOrString()
return
endif
py vim.command( "let cursor_text = '" + ycm.CurrentCursorTextVim() + "'" )
" infinite loops are bad, mkay?