Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(192)

Unified Diff: tools/vim/chromium.ycm_extra_conf.py

Issue 2305443004: YCM: Support Objective-C and Objective-C++ (Closed)
Patch Set: This `continue` was weird. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/vim/chromium.ycm_extra_conf.py
diff --git a/tools/vim/chromium.ycm_extra_conf.py b/tools/vim/chromium.ycm_extra_conf.py
index e9397ce25420ce40e68f3e21ecb48cd94107a866..21a76d43dfa97ca4dd061dcac88505f1092fd6b0 100644
--- a/tools/vim/chromium.ycm_extra_conf.py
+++ b/tools/vim/chromium.ycm_extra_conf.py
@@ -63,6 +63,10 @@ _default_flags = [
'c++',
]
+_extension_flags = {
+ '.m': ['-x', 'objective-c'],
+ '.mm': ['-x', 'objective-c++'],
+}
def PathExists(*args):
return os.path.exists(os.path.join(*args))
@@ -348,6 +352,7 @@ def FlagsForFile(filename):
'flags': (List of Strings) Command line flags.
'do_cache': (Boolean) True if the result should be cached.
"""
+ ext = os.path.splitext(filename)[1]
abs_filename = os.path.abspath(filename)
chrome_root = FindChromeSrcFromFilename(abs_filename)
clang_flags = GetClangOptionsFromNinjaForFilename(chrome_root, abs_filename)
@@ -357,7 +362,7 @@ def FlagsForFile(filename):
# determine the flags again.
should_cache_flags_for_file = bool(clang_flags)
- final_flags = _default_flags + clang_flags
+ final_flags = _default_flags + _extension_flags.get(ext, []) + clang_flags
return {
'flags': final_flags,

Powered by Google App Engine
This is Rietveld 408576698