Force filename completer on #include
This commit is contained in:
parent
7500a94cda
commit
3ae9764451
@ -89,7 +89,7 @@ let g:ycm_add_preview_to_completeopt =
|
||||
\ get( g:, 'ycm_add_preview_to_completeopt', 0 )
|
||||
|
||||
let g:ycm_complete_in_comments_and_strings =
|
||||
\ get( g:, 'ycm_complete_in_comments_and_strings', 0 )
|
||||
\ get( g:, 'ycm_complete_in_comments_and_strings', 1 )
|
||||
|
||||
let g:ycm_collect_identifiers_from_comments_and_strings =
|
||||
\ get( g:, 'ycm_collect_identifiers_from_comments_and_strings', 0 )
|
||||
|
@ -331,3 +331,8 @@ def ClangAvailableForBuffer( buffer_object ):
|
||||
filetypes = vimsupport.FiletypesForBuffer( buffer_object )
|
||||
return any( [ filetype in CLANG_FILETYPES for filetype in filetypes ] )
|
||||
|
||||
|
||||
def InCFamilyFile():
|
||||
return any( [ filetype in CLANG_FILETYPES for filetype in
|
||||
vimsupport.CurrentFiletypes() ] )
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
# along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from completers.threaded_completer import ThreadedCompleter
|
||||
from completers.cpp.clang_completer import InCFamilyFile
|
||||
import vim
|
||||
import vimsupport
|
||||
import os
|
||||
@ -47,9 +48,17 @@ class FilenameCompleter( ThreadedCompleter ):
|
||||
\\.)*$
|
||||
""", re.X )
|
||||
|
||||
self._include_regex = re.compile( '^\s*#(?:include|import)\s*(?:"|<)$' )
|
||||
|
||||
|
||||
def AtIncludeStatmentStart( self, start_column ):
|
||||
return ( InCFamilyFile() and
|
||||
self._include_regex.match( vim.current.line[ :start_column ] ) )
|
||||
|
||||
|
||||
def ShouldUseNowInner( self, start_column ):
|
||||
return vim.current.line[ start_column - 1 ] == '/'
|
||||
return ( vim.current.line[ start_column - 1 ] == '/' or
|
||||
self.AtIncludeStatmentStart( start_column ) )
|
||||
|
||||
|
||||
def SupportedFiletypes( self ):
|
||||
|
Loading…
Reference in New Issue
Block a user