Upgrade VSCode CPP manifest to v3

This commit is contained in:
Ivan Kravets
2018-04-20 13:56:04 +03:00
parent 6a04f52620
commit b77160d363
2 changed files with 27 additions and 6 deletions

View File

@ -53,7 +53,7 @@ def _dump_includes(env):
if unity_dir: if unity_dir:
includes.append(unity_dir) includes.append(unity_dir)
# remove dupicates # remove duplicates
result = [] result = []
for item in includes: for item in includes:
if item not in result: if item not in result:
@ -101,8 +101,8 @@ def _dump_defines(env):
.replace("ATMEGA", "ATmega").replace("ATTINY", "ATtiny"))) .replace("ATMEGA", "ATmega").replace("ATTINY", "ATtiny")))
# built-in GCC marcos # built-in GCC marcos
if env.GetCompilerType() == "gcc": # if env.GetCompilerType() == "gcc":
defines.extend(_get_gcc_defines(env)) # defines.extend(_get_gcc_defines(env))
return defines return defines

View File

@ -1,8 +1,19 @@
{ {
"!!! WARNING !!!": "PLEASE DO NOT MODIFY THIS FILE! USE http://docs.platformio.org/page/projectconf/section_env_build.html#build-flags",
"configurations": [ "configurations": [
{ {
% import platform % import platform
% from os.path import commonprefix, dirname
%
% systype = platform.system().lower() % systype = platform.system().lower()
%
% cleaned_includes = []
% for include in includes:
% if "toolchain-" not in dirname(commonprefix([include, cc_path])):
% cleaned_includes.append(include)
% end
% end
%
% if systype == "windows": % if systype == "windows":
"name": "Win32", "name": "Win32",
% elif systype == "darwin": % elif systype == "darwin":
@ -11,7 +22,7 @@
"name": "Linux", "name": "Linux",
% end % end
"includePath": [ "includePath": [
% for include in includes: % for include in cleaned_includes:
"{{include.replace('\\\\', '/').replace('\\', '/').replace('"', '\\"')}}", "{{include.replace('\\\\', '/').replace('\\', '/').replace('"', '\\"')}}",
% end % end
"" ""
@ -20,7 +31,7 @@
"limitSymbolsToIncludedHeaders": true, "limitSymbolsToIncludedHeaders": true,
"databaseFilename": "${workspaceRoot}/.vscode/.browse.c_cpp.db", "databaseFilename": "${workspaceRoot}/.vscode/.browse.c_cpp.db",
"path": [ "path": [
% for include in includes: % for include in cleaned_includes:
"{{include.replace('\\\\', '/').replace('\\', '/').replace('"', '\\"')}}", "{{include.replace('\\\\', '/').replace('\\', '/').replace('"', '\\"')}}",
% end % end
"" ""
@ -32,7 +43,17 @@
% end % end
"" ""
], ],
"intelliSenseMode": "clang-x64" "intelliSenseMode": "clang-x64",
% import re
% STD_RE = re.compile(r"\-std=[a-z\+]+(\d+)")
%
% if STD_RE.search(cc_flags):
"cStandard": "c{{ STD_RE.search(cc_flags).group(1) }}",
% end
% if STD_RE.search(cxx_flags):
"cppStandard": "c++{{ STD_RE.search(cxx_flags).group(1) }}",
% end
"compilerPath": "{{ cc_path }}"
} }
] ]
} }