@@ -70,6 +70,7 @@ export const clangDActiveContextKey = `${manifest.PACKAGE_NAME}.activeClangdCont
7070export class ClangdManager {
7171 public static readonly setClangdContextCommandId = `${ manifest . PACKAGE_NAME } .setClangdContext` ;
7272 public static readonly unsetClangdContextCommandId = `${ manifest . PACKAGE_NAME } .unsetClangdContext` ;
73+ public static readonly getInfoPathCommandId = `${ manifest . PACKAGE_NAME } .getInfoPath` ;
7374
7475 private readonly debouncedUpdateClangdConfig ;
7576 private readonly restartClangd ;
@@ -95,6 +96,7 @@ export class ClangdManager {
9596 this . configurationProvider . onChangeConfiguration ( this . debouncedUpdateClangdConfig , CONFIG_CLANGD_GENERATE_SETUP ) ;
9697 this . commandsProvider . registerCommand ( ClangdManager . setClangdContextCommandId , this . setGlobalContext , this ) ;
9798 this . commandsProvider . registerCommand ( ClangdManager . unsetClangdContextCommandId , this . unsetGlobalContext , this ) ;
99+ this . commandsProvider . registerCommand ( ClangdManager . getInfoPathCommandId , this . getInfoPath , this ) ;
98100 }
99101
100102 private get globalContext ( ) {
@@ -128,6 +130,24 @@ export class ClangdManager {
128130 // Do nothing
129131 }
130132
133+ private getInfoPath ( ) : string {
134+ return this . resolveInfoPath ( ) ;
135+ }
136+
137+ private resolveInfoPath ( ) : string {
138+ const csolution = this . solutionManager . getCsolution ( ) ;
139+ const globalContextProjectPath = this . globalContext ;
140+
141+ if ( ! csolution || ! globalContextProjectPath ) {
142+ return '' ;
143+ }
144+
145+ const context = csolution . getContextDescriptor ( globalContextProjectPath ) ;
146+ const outDir = context ? csolution . cbuildIdxFile ?. cbuildFiles ?. get ( context . projectName ) ?. outDir : undefined ;
147+
148+ return outDir ?? '' ;
149+ }
150+
131151 private async updateWorkspaceClangdConfig ( compileCommands : URI | undefined ) {
132152 const clangd_arguments = [ ] ;
133153 if ( compileCommands ) {
0 commit comments