Refactoring the ClangAvailableForBuffer method
This commit is contained in:
parent
e72652e463
commit
ba6b40e485
@ -246,9 +246,6 @@ def DiagnosticsToDiagStructure( diagnostics ):
|
|||||||
|
|
||||||
|
|
||||||
def ClangAvailableForBuffer( buffer_object ):
|
def ClangAvailableForBuffer( buffer_object ):
|
||||||
filetypes = vim.eval( 'getbufvar({0}, "&ft")'.format( buffer_object.number ) )
|
filetypes = vimsupport.FiletypesForBuffer( buffer_object )
|
||||||
supported_fts = [ft for ft in filetypes.split('.') if ft in CLANG_FILETYPES]
|
return any( [ filetype in CLANG_FILETYPES for filetype in filetypes ] )
|
||||||
if supported_fts:
|
|
||||||
return True
|
|
||||||
else:
|
|
||||||
return False
|
|
||||||
|
@ -104,6 +104,13 @@ def CurrentFiletypes():
|
|||||||
return ft_string.split( '.' )
|
return ft_string.split( '.' )
|
||||||
|
|
||||||
|
|
||||||
|
def FiletypesForBuffer( buffer_object ):
|
||||||
|
# NOTE: Getting &ft for other buffers only works when the buffer has been
|
||||||
|
# visited by the user at least once, which is true for modified buffers
|
||||||
|
ft_string = vim.eval( 'getbufvar({0}, "&ft")'.format( buffer_object.number ) )
|
||||||
|
return ft_string.split( '.' )
|
||||||
|
|
||||||
|
|
||||||
def GetVariableValue( variable ):
|
def GetVariableValue( variable ):
|
||||||
return vim.eval( variable )
|
return vim.eval( variable )
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user