From 3243a84dbab3ae8fcebe74f9f4a6081aa193a9c2 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 31 May 2018 16:38:33 +0300 Subject: [PATCH] Fix incorrect handling of C/C++ standards passed via build_flags --- .../ide/tpls/vscode/.vscode/c_cpp_properties.json.tpl | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/platformio/ide/tpls/vscode/.vscode/c_cpp_properties.json.tpl b/platformio/ide/tpls/vscode/.vscode/c_cpp_properties.json.tpl index e5868d7c..d481de89 100644 --- a/platformio/ide/tpls/vscode/.vscode/c_cpp_properties.json.tpl +++ b/platformio/ide/tpls/vscode/.vscode/c_cpp_properties.json.tpl @@ -46,12 +46,14 @@ "intelliSenseMode": "clang-x64", % import re % STD_RE = re.compile(r"\-std=[a-z\+]+(\d+)") +% cc_stds = STD_RE.findall(cc_flags) +% cxx_stds = STD_RE.findall(cxx_flags) % -% if STD_RE.search(cc_flags): - "cStandard": "c{{ STD_RE.search(cc_flags).group(1) }}", +% if cc_stds: + "cStandard": "c{{ cc_stds[-1] }}", % end -% if STD_RE.search(cxx_flags): - "cppStandard": "c++{{ STD_RE.search(cxx_flags).group(1) }}", +% if cxx_stds: + "cppStandard": "c++{{ cxx_stds[-1] }}", % end "compilerPath": "{{ cc_path.replace('\\\\', '/').replace('\\', '/').replace('"', '\\"') }}" }