Skip to content

Commit 87d0dca

Browse files
committed
fix: provider errror in multi project workspace
1 parent ba23954 commit 87d0dca

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

src/EIDEProject.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3161,6 +3161,7 @@ class EIDEProject extends AbstractProject {
31613161
provideConfigurations(uris: vscode.Uri[], token?: vscode.CancellationToken | undefined): Thenable<SourceFileConfigurationItem[]> {
31623162

31633163
return new Promise((resolve) => {
3164+
31643165
resolve(uris.map((uri) => {
31653166

31663167
let fileArgs: string[] | undefined;

src/EIDEProjectExplorer.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2892,6 +2892,8 @@ export class ProjectExplorer implements CustomConfigurationProvider {
28922892
}
28932893
}
28942894

2895+
private _sourceWhereFroms: Map<string, AbstractProject> = new Map();
2896+
28952897
canProvideConfiguration(uri: vscode.Uri, token?: vscode.CancellationToken | undefined): Thenable<boolean> {
28962898

28972899
this.cppToolsOut.appendLine(`[source] cpptools request provideConfigurations for '${uri.fsPath}'`);
@@ -2900,6 +2902,7 @@ export class ProjectExplorer implements CustomConfigurationProvider {
29002902
let result = false;
29012903
await this.dataProvider.traverseProjectsAsync(async (prj) => {
29022904
result = await prj.canProvideConfiguration(uri, token);
2905+
if (result) this._sourceWhereFroms.set(uri.fsPath, prj);
29032906
return result;
29042907
});
29052908
resolve(result);
@@ -2910,10 +2913,8 @@ export class ProjectExplorer implements CustomConfigurationProvider {
29102913
return new Promise(async (resolve) => {
29112914
let result: SourceFileConfigurationItem[] = [];
29122915
for (const uri of uris) {
2913-
await this.dataProvider.traverseProjectsAsync(async (prj) => {
2914-
result = result.concat(await prj.provideConfigurations([uri], token));
2915-
return true;
2916-
});
2916+
const prj = this._sourceWhereFroms.get(uri.fsPath);
2917+
if (prj) result = result.concat(await prj.provideConfigurations([uri], token));
29172918
}
29182919
resolve(result);
29192920
this.cppToolsOut.appendLine(`[source] provideConfigurations`);

0 commit comments

Comments
 (0)