Skip to content

Commit 64cf9a7

Browse files
authored
Fix discovery when projects is empty (#1529)
2 parents 652c3f2 + c119127 commit 64cf9a7

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

src/lsp/ProjectManager.spec.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,20 @@ describe('ProjectManager', () => {
325325
s`${rootDir}/project1/bsconfig.json`
326326
]);
327327
});
328+
329+
it('ignores empty projects array configuration', async () => {
330+
fsExtra.outputFileSync(`${rootDir}/project1/bsconfig.json`, '');
331+
await manager.syncProjects([{
332+
...workspaceSettings,
333+
projects: []
334+
}]);
335+
336+
expect(
337+
manager.projects.map(x => x.projectKey).sort()
338+
).to.eql([
339+
s`${rootDir}/project1/bsconfig.json`
340+
]);
341+
});
328342
});
329343

330344
describe('getCompletions', () => {

src/lsp/ProjectManager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ export class ProjectManager {
655655
*/
656656
private async discoverProjectsForWorkspace(workspaceConfig: WorkspaceConfig): Promise<DiscoveredProject[]> {
657657
//config may provide a list of project paths. If we have these, no other discovery is permitted
658-
if (Array.isArray(workspaceConfig.projects)) {
658+
if (Array.isArray(workspaceConfig.projects) && workspaceConfig.projects.length > 0) {
659659
this.logger.debug(`Using project paths from workspace config`, workspaceConfig.projects);
660660
const projectConfigs = workspaceConfig.projects.reduce<DiscoveredProject[]>((acc, project) => {
661661
//skip this project if it's disabled or we don't have a path

0 commit comments

Comments
 (0)