Per-filetype turning off of filetype completion
So things like the ClangCompleter can be turned off fully and the user can rely on identifier completion only.
This commit is contained in:
parent
dc2f52edbf
commit
0c17c49a66
@ -68,11 +68,9 @@ function! youcompleteme#Enable()
|
|||||||
py import ycm
|
py import ycm
|
||||||
py ycm_state = ycm.YouCompleteMe()
|
py ycm_state = ycm.YouCompleteMe()
|
||||||
|
|
||||||
if g:ycm_filetype_completion_enabled
|
" <c-x><c-o> trigger omni completion, <c-p> deselects the first completion
|
||||||
" <c-x><c-o> trigger omni completion, <c-p> deselects the first completion
|
" candidate that vim selects by default
|
||||||
" candidate that vim selects by default
|
inoremap <unique> <C-Space> <C-X><C-O><C-P>
|
||||||
inoremap <unique> <C-Space> <C-X><C-O><C-P>
|
|
||||||
endif
|
|
||||||
|
|
||||||
" TODO: make this a nicer, customizable map
|
" TODO: make this a nicer, customizable map
|
||||||
nnoremap <unique> <leader>d :call <sid>ShowDetailedDiagnostic()<cr>
|
nnoremap <unique> <leader>d :call <sid>ShowDetailedDiagnostic()<cr>
|
||||||
@ -87,7 +85,7 @@ endfunction
|
|||||||
function! s:AllowedToCompleteInCurrentFile()
|
function! s:AllowedToCompleteInCurrentFile()
|
||||||
" If the user set the current filetype as a filetype that YCM should ignore,
|
" If the user set the current filetype as a filetype that YCM should ignore,
|
||||||
" then we don't do anything
|
" then we don't do anything
|
||||||
return !get( g:ycm_filetypes_to_ignore, &filetype, 0 )
|
return !get( g:ycm_filetypes_to_completely_ignore, &filetype, 0 )
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
@ -34,12 +34,11 @@ let g:loaded_youcompleteme = 1
|
|||||||
let g:ycm_min_num_of_chars_for_completion =
|
let g:ycm_min_num_of_chars_for_completion =
|
||||||
\ get( g:, 'ycm_min_num_of_chars_for_completion', 2 )
|
\ get( g:, 'ycm_min_num_of_chars_for_completion', 2 )
|
||||||
|
|
||||||
let g:ycm_filetypes_to_ignore =
|
let g:ycm_filetypes_to_completely_ignore =
|
||||||
\ get( g:, 'ycm_filetypes_to_ignore', { 'notes' : 1 } )
|
\ get( g:, 'ycm_filetypes_to_completely_ignore', { 'notes' : 1 } )
|
||||||
|
|
||||||
" TODO: make this more granular
|
let g:ycm_filetype_specific_completion_to_disable =
|
||||||
let g:ycm_filetype_completion_enabled =
|
\ get( g:, 'ycm_filetype_specific_completion_to_disable', {} )
|
||||||
\ get( g:, 'ycm_filetype_completion_enabled', 1 )
|
|
||||||
|
|
||||||
let g:ycm_allow_changing_updatetime =
|
let g:ycm_allow_changing_updatetime =
|
||||||
\ get( g:, 'ycm_allow_changing_updatetime', 1 )
|
\ get( g:, 'ycm_allow_changing_updatetime', 1 )
|
||||||
|
@ -25,6 +25,9 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
from completers.all.identifier_completer import IdentifierCompleter
|
from completers.all.identifier_completer import IdentifierCompleter
|
||||||
|
|
||||||
|
FILETYPE_SPECIFIC_COMPLETION_TO_DISABLE = vim.eval(
|
||||||
|
'g:ycm_filetype_specific_completion_to_disable' )
|
||||||
|
|
||||||
|
|
||||||
class YouCompleteMe( object ):
|
class YouCompleteMe( object ):
|
||||||
def __init__( self ):
|
def __init__( self ):
|
||||||
@ -76,7 +79,8 @@ class YouCompleteMe( object ):
|
|||||||
|
|
||||||
|
|
||||||
def FiletypeCompletionEnabledForCurrentFile( self ):
|
def FiletypeCompletionEnabledForCurrentFile( self ):
|
||||||
return ( bool( int( vim.eval( 'g:ycm_filetype_completion_enabled' ) ) ) and
|
return ( vimsupport.CurrentFiletype() not in
|
||||||
|
FILETYPE_SPECIFIC_COMPLETION_TO_DISABLE and
|
||||||
self.FiletypeCompletionAvailableForFile() )
|
self.FiletypeCompletionAvailableForFile() )
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user