@@ -756,7 +756,7 @@ export class CppProperties {
756756 let compilerPathAndArgs : util . CompilerPathAndArgs ;
757757 if ( this . CurrentConfiguration . compilerPath ) {
758758 compilerPathAndArgs = util . extractCompilerPathAndArgs ( this . CurrentConfiguration . compilerPath ) ;
759- paths . add ( `" ${ compilerPathAndArgs . compilerPath } ` ) ; // It may not end with ".
759+ paths . add ( `${ compilerPathAndArgs . compilerPath } ` ) ; // It may not start or end with ".
760760 }
761761
762762 // Get the start/end for properties that are file-only.
@@ -765,15 +765,15 @@ export class CppProperties {
765765 let compileCommandsStart : number = curText . search ( / \s * \" c o m p i l e C o m m a n d s \" \s * : \s * \" / ) ;
766766 let compileCommandsEnd : number = compileCommandsStart === - 1 ? - 1 : curText . indexOf ( '"' , curText . indexOf ( '"' , curText . indexOf ( ":" , compileCommandsStart ) ) + 1 ) ;
767767 let compilerPathStart : number = curText . search ( / \s * \" c o m p i l e r P a t h \" \s * : \s * \" / ) ;
768- let compilerPathEnd : number = compilerPathStart === - 1 ? - 1 : curText . indexOf ( '"' , curText . indexOf ( '"' , curText . indexOf ( ":" , compilerPathStart ) ) + 1 ) ;
768+ let compilerPathEnd : number = compilerPathStart === - 1 ? - 1 : curText . indexOf ( '"' , curText . indexOf ( '"' , curText . indexOf ( ":" , compilerPathStart ) ) + 1 ) + 1 ;
769769
770770 if ( this . prevSquiggleMetrics [ this . CurrentConfiguration . name ] === undefined ) {
771771 this . prevSquiggleMetrics [ this . CurrentConfiguration . name ] = { PathNonExistent : 0 , PathNotAFile : 0 , PathNotADirectory : 0 } ;
772772 }
773773 let newSquiggleMetrics : { [ key : string ] : number } = { PathNonExistent : 0 , PathNotAFile : 0 , PathNotADirectory : 0 } ;
774774
775775 for ( let curPath of paths ) {
776- let resolvedPath : string = curPath . substr ( 1 , ( curPath . endsWith ( '"' ) ? curPath . length - 2 : curPath . length - 1 ) ) ;
776+ let resolvedPath : string = curPath . substr ( ( curPath . startsWith ( '"' ) ? 1 : 0 ) , ( curPath . endsWith ( '"' ) ? curPath . length - 2 : curPath . length ) ) ;
777777 // Resolve special path cases.
778778 if ( resolvedPath === "${default}" ) {
779779 // TODO: Add squiggles for when the C_Cpp.default.* paths are invalid.
@@ -842,7 +842,8 @@ export class CppProperties {
842842 }
843843 }
844844 let diagnostic : vscode . Diagnostic = new vscode . Diagnostic (
845- new vscode . Range ( document . positionAt ( curTextStartOffset + curOffset + 1 ) , document . positionAt ( curTextStartOffset + curOffset + ( curPath . endsWith ( '"' ) ? curPath . length - 1 : curPath . length ) ) ) ,
845+ new vscode . Range ( document . positionAt ( curTextStartOffset + curOffset ) ,
846+ document . positionAt ( curTextStartOffset + curOffset + ( curPath . endsWith ( '"' ) ? curPath . length - 1 : curPath . length ) ) ) ,
846847 message , vscode . DiagnosticSeverity . Warning ) ;
847848 diagnostics . push ( diagnostic ) ;
848849 }
0 commit comments