Update VSCode template

Starting with cpptools v0.29 escaped paths in compilerArgs field don't work on Windows.
This commit is contained in:
Valerii Koval
2020-07-28 15:10:52 +03:00
parent def149a29e
commit adc2d5fe7c

View File

@ -10,10 +10,6 @@
% return to_unix_path(text).replace('"', '\\"') % return to_unix_path(text).replace('"', '\\"')
% end % end
% %
% def _escape_required(flag):
% return " " in flag and systype == "windows"
% end
%
% def split_args(args_string): % def split_args(args_string):
% return click.parser.split_arg_string(to_unix_path(args_string)) % return click.parser.split_arg_string(to_unix_path(args_string))
% end % end
@ -53,10 +49,7 @@
% def _find_forced_includes(flags, inc_paths): % def _find_forced_includes(flags, inc_paths):
% result = [] % result = []
% include_args = ("-include", "-imacros") % include_args = ("-include", "-imacros")
% for f in flags: % for f in filter_args(flags, include_args):
% if not f.startswith(include_args):
% continue
% end
% for arg in include_args: % for arg in include_args:
% inc = "" % inc = ""
% if f.startswith(arg) and f.split(arg)[1].strip(): % if f.startswith(arg) and f.split(arg)[1].strip():
@ -66,6 +59,7 @@
% end % end
% if inc: % if inc:
% result.append(_find_abs_path(inc, inc_paths)) % result.append(_find_abs_path(inc, inc_paths))
% break
% end % end
% end % end
% end % end
@ -134,8 +128,7 @@
"compilerPath": "{{ cc_path }}", "compilerPath": "{{ cc_path }}",
"compilerArgs": [ "compilerArgs": [
% for flag in [ % for flag in [
% '"%s"' % _escape(f) if _escape_required(f) else f % f for f in filter_args(cc_m_flags, ["-m", "-i", "@"], ["-include", "-imacros"])
% for f in filter_args(cc_m_flags, ["-m", "-i", "@"], ["-include", "-imacros"])
% ]: % ]:
"{{ flag }}", "{{ flag }}",
% end % end