Bug 1408795 - Have Eclipse CDT treat Objective-C files as C++. r=botond draft
authorJonathan Watt <jwatt@jwatt.org>
Mon, 16 Oct 2017 10:09:00 +0100
changeset 680866 ea8f01b4a59f49f6b899c0774ba4fd1250f4c6d4
parent 680865 4252f8350a9833081354b86f02f37b19ca02fd58
child 680867 b189d42e8ed068c6207c4f94a460aed549a511c2
push id84658
push userjwatt@jwatt.org
push dateMon, 16 Oct 2017 14:15:24 +0000
reviewersbotond
bugs1408795
milestone58.0a1
Bug 1408795 - Have Eclipse CDT treat Objective-C files as C++. r=botond Without this setting, eclipse will refuse to open Objective-C files (it will defer to an external editor). Adding *.mm to the file types that are treated as C++ allows Eclipse to open them, and to provide some code assistance for the bits of the files that it can understand. MozReview-Commit-ID: FRGcvqf2KFs
python/mozbuild/mozbuild/backend/cpp_eclipse.py
--- a/python/mozbuild/mozbuild/backend/cpp_eclipse.py
+++ b/python/mozbuild/mozbuild/backend/cpp_eclipse.py
@@ -112,16 +112,20 @@ class CppEclipseBackend(CommonBackend):
             fh.write(workspace_lang_settings)
 
         self._write_launch_files(launch_dir)
 
         core_resources_prefs_path = os.path.join(workspace_settings_dir, 'org.eclipse.core.resources.prefs')
         with open(core_resources_prefs_path, 'wb') as fh:
             fh.write(STATIC_CORE_RESOURCES_PREFS);
 
+        core_runtime_prefs_path = os.path.join(workspace_settings_dir, 'org.eclipse.core.runtime.prefs')
+        with open(core_runtime_prefs_path, 'wb') as fh:
+            fh.write(STATIC_CORE_RUNTIME_PREFS);
+
         ui_prefs_path = os.path.join(workspace_settings_dir, 'org.eclipse.ui.prefs')
         with open(ui_prefs_path, 'wb') as fh:
             fh.write(STATIC_UI_PREFS);
 
         cdt_ui_prefs_path = os.path.join(workspace_settings_dir, 'org.eclipse.cdt.ui.prefs')
         cdt_ui_prefs = STATIC_CDT_UI_PREFS
         # Here we generate the code formatter that will show up in the UI with
         # the name "Mozilla".  The formatter is stored as a single line of XML
@@ -541,16 +545,20 @@ tabWidth=2
 undoHistorySize=200
 """
 
 
 STATIC_CORE_RESOURCES_PREFS="""eclipse.preferences.version=1
 refresh.enabled=true
 """
 
+STATIC_CORE_RUNTIME_PREFS="""eclipse.preferences.version=1
+content-types/org.eclipse.cdt.core.cxxSource/file-extensions=mm
+"""
+
 STATIC_UI_PREFS="""eclipse.preferences.version=1
 showIntro=false
 """
 
 STATIC_CDT_CORE_PREFS="""eclipse.preferences.version=1
 """
 
 FORMATTER_SETTINGS = """org.eclipse.cdt.core.formatter.alignment_for_arguments_in_method_invocation=16