File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
Extension/src/LanguageServer Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -2397,6 +2397,10 @@ export class DefaultClient implements Client {
23972397 } else {
23982398 modifiedConfig . compilerArgs = compilerPathAndArgs . allCompilerArgs ;
23992399 }
2400+
2401+ if ( modifiedConfig . compileCommands ) {
2402+ modifiedConfig . compileCommands = cppProperties . resolvePath ( modifiedConfig . compileCommands , os . platform ( ) === "win32" ) ;
2403+ }
24002404 params . configurations . push ( modifiedConfig ) ;
24012405 } ) ;
24022406
Original file line number Diff line number Diff line change @@ -1353,15 +1353,15 @@ export class CppProperties {
13531353 return success ;
13541354 }
13551355
1356- private resolvePath ( path : string | undefined , isWindows : boolean ) : string {
1357- if ( ! path || path === "${default}" ) {
1356+ public resolvePath ( input_path : string | undefined , isWindows : boolean ) : string {
1357+ if ( ! input_path || input_path === "${default}" ) {
13581358 return "" ;
13591359 }
13601360
13611361 let result : string = "" ;
13621362
13631363 // first resolve variables
1364- result = util . resolveVariables ( path , this . ExtendedEnvironment ) ;
1364+ result = util . resolveVariables ( input_path , this . ExtendedEnvironment ) ;
13651365 if ( this . rootUri ) {
13661366 if ( result . includes ( "${workspaceFolder}" ) ) {
13671367 result = result . replace ( "${workspaceFolder}" , this . rootUri . fsPath ) ;
@@ -1377,6 +1377,11 @@ export class CppProperties {
13771377 result = result . replace ( / \* / g, "" ) ;
13781378 }
13791379
1380+ // Make sure all paths result to an absolute path
1381+ if ( ! path . isAbsolute ( result ) && this . rootUri ) {
1382+ result = path . join ( this . rootUri . fsPath , result ) ;
1383+ }
1384+
13801385 return result ;
13811386 }
13821387
You can’t perform that action at this time.
0 commit comments