From 589976321c8210a586d4c278c9bbf2b4d480ee19 Mon Sep 17 00:00:00 2001 From: Matthias Hoelzl Date: Sat, 18 Nov 2017 18:09:18 +0100 Subject: [PATCH] Add cpp.hint file to improve IntelliSense --- .gitignore | 3 +++ SConstruct | 1 + methods.py | 11 +++++++++++ 3 files changed, 15 insertions(+) diff --git a/.gitignore b/.gitignore index b347b348a59..0de1e682a09 100644 --- a/.gitignore +++ b/.gitignore @@ -88,6 +88,9 @@ bld/ [Tt]est[Rr]esult*/ [Bb]uild[Ll]og.* +# Hints for improving IntelliSense, created together with VS project +cpp.hint + #NUNIT *.VisualState.xml TestResult.xml diff --git a/SConstruct b/SConstruct index c3ecdafd45d..856994ef154 100644 --- a/SConstruct +++ b/SConstruct @@ -452,6 +452,7 @@ if selected_platform in platform_list: if env['vsproj']: env['CPPPATH'] = [Dir(path) for path in env['CPPPATH']] methods.generate_vs_project(env, GetOption("num_jobs")) + methods.generate_cpp_hint_file("cpp.hint") # Check for the existence of headers conf = Configure(env) diff --git a/methods.py b/methods.py index 8fc7f87a413..c8cc84eb4c2 100644 --- a/methods.py +++ b/methods.py @@ -1686,6 +1686,17 @@ def find_visual_c_batch_file(env): (host_platform, target_platform,req_target_platform) = get_host_target(env) return find_batch_file(env, version, host_platform, target_platform)[0] +def generate_cpp_hint_file(filename): + import os.path + if os.path.isfile(filename): + # Don't overwrite an existing hint file since the user may have customized it. + pass + else: + try: + fd = open(filename, "w") + fd.write("#define GDCLASS(m_class, m_inherits)\n") + except IOError: + print("Could not write cpp.hint file.") def generate_vs_project(env, num_jobs): batch_file = find_visual_c_batch_file(env)