Don't create array entry if workspace contains no queries
This commit is contained in:
@@ -99,22 +99,26 @@ export class QueryDiscovery
|
|||||||
): Promise<FileTreeDirectory[]> {
|
): Promise<FileTreeDirectory[]> {
|
||||||
const rootDirectories = [];
|
const rootDirectories = [];
|
||||||
for (const workspaceFolder of workspaceFolders) {
|
for (const workspaceFolder of workspaceFolders) {
|
||||||
rootDirectories.push(
|
const root = await this.discoverQueriesInWorkspace(workspaceFolder);
|
||||||
await this.discoverQueriesInWorkspace(workspaceFolder),
|
if (root !== undefined) {
|
||||||
);
|
rootDirectories.push(root);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return rootDirectories;
|
return rootDirectories;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async discoverQueriesInWorkspace(
|
private async discoverQueriesInWorkspace(
|
||||||
workspaceFolder: WorkspaceFolder,
|
workspaceFolder: WorkspaceFolder,
|
||||||
): Promise<FileTreeDirectory> {
|
): Promise<FileTreeDirectory | undefined> {
|
||||||
const fullPath = workspaceFolder.uri.fsPath;
|
const fullPath = workspaceFolder.uri.fsPath;
|
||||||
const name = workspaceFolder.name;
|
const name = workspaceFolder.name;
|
||||||
|
|
||||||
const rootDirectory = new FileTreeDirectory(fullPath, name);
|
|
||||||
|
|
||||||
const resolvedQueries = await this.cliServer.resolveQueries(fullPath);
|
const resolvedQueries = await this.cliServer.resolveQueries(fullPath);
|
||||||
|
if (resolvedQueries.length === 0) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
const rootDirectory = new FileTreeDirectory(fullPath, name);
|
||||||
for (const queryPath of resolvedQueries) {
|
for (const queryPath of resolvedQueries) {
|
||||||
const relativePath = normalize(relative(fullPath, queryPath));
|
const relativePath = normalize(relative(fullPath, queryPath));
|
||||||
const dirName = dirname(relativePath);
|
const dirName = dirname(relativePath);
|
||||||
|
|||||||
Reference in New Issue
Block a user