File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -326,8 +326,9 @@ def _normalize_define(define_string):
326326 define_string = define_string .strip ()
327327 if "=" in define_string :
328328 define , value = define_string .split ("=" , maxsplit = 1 )
329- if '"' in value and not value .startswith ("\\ " ):
330- # Escape only raw values
329+ if any (char in value for char in (' ' , '<' , '>' )):
330+ value = f'"{ value } "'
331+ elif '"' in value and not value .startswith ("\\ " ):
331332 value = value .replace ('"' , '\\ "' )
332333 return (define , value )
333334 return define_string
@@ -338,8 +339,11 @@ def _normalize_define(define_string):
338339 ]
339340
340341 for f in compile_group .get ("compileCommandFragments" , []):
341- if f .get ("fragment" , "" ).startswith ("-D" ):
342- result .append (_normalize_define (f ["fragment" ][2 :]))
342+ fragment = f .get ("fragment" , "" ).strip ()
343+ if fragment .startswith ('"' ):
344+ fragment = fragment .strip ('"' )
345+ if fragment .startswith ("-D" ):
346+ result .append (_normalize_define (fragment [2 :]))
343347
344348 return result
345349
You can’t perform that action at this time.
0 commit comments