Printing an error when no ycm_clang_options.py file

This commit is contained in:
Strahinja Val Markovic 2013-01-22 17:13:14 -08:00
parent 482de517ba
commit 6ba2dd8caa
2 changed files with 6 additions and 1 deletions

View File

@ -19,7 +19,7 @@
import os import os
# Given an interable object that produces strings (flags for Clang), removes the # Given an iterable object that produces strings (flags for Clang), removes the
# '-c' and '-o' options that Clang does not like to see when it's producing # '-c' and '-o' options that Clang does not like to see when it's producing
# completions for a file. # completions for a file.
def PrepareClangFlags( flags, filename ): def PrepareClangFlags( flags, filename ):

View File

@ -23,8 +23,12 @@ import ycm_core
import random import random
import string import string
import sys import sys
import vimsupport
CLANG_OPTIONS_FILENAME = '.ycm_clang_options.py' CLANG_OPTIONS_FILENAME = '.ycm_clang_options.py'
NO_OPTIONS_FILENAME_MESSAGE = ('No {0} file detected, so no compile flags '
'are available. Thus no semantic support for C/C++/ObjC/ObjC++.').format(
CLANG_OPTIONS_FILENAME )
class Flags( object ): class Flags( object ):
def __init__( self ): def __init__( self ):
@ -41,6 +45,7 @@ class Flags( object ):
except KeyError: except KeyError:
flags_module = self._FlagsModuleForFile( filename ) flags_module = self._FlagsModuleForFile( filename )
if not flags_module: if not flags_module:
vimsupport.PostVimMessage( NO_OPTIONS_FILENAME_MESSAGE )
return ycm_core.StringVec() return ycm_core.StringVec()
results = flags_module.FlagsForFile( filename ) results = flags_module.FlagsForFile( filename )