diff --git a/vscode/microsoft-kiota/src/kiotaInterop.ts b/vscode/microsoft-kiota/src/kiotaInterop.ts index fbc027ea61..ff494c5136 100644 --- a/vscode/microsoft-kiota/src/kiotaInterop.ts +++ b/vscode/microsoft-kiota/src/kiotaInterop.ts @@ -33,7 +33,7 @@ export interface KiotaOpenApiNode { segment: string, path: string, children: KiotaOpenApiNode[], - selected: boolean, + selected?: boolean, } export interface KiotaShowConfiguration { diff --git a/vscode/microsoft-kiota/src/openApiTreeProvider.ts b/vscode/microsoft-kiota/src/openApiTreeProvider.ts index a2b76c9c5b..7578e60a13 100644 --- a/vscode/microsoft-kiota/src/openApiTreeProvider.ts +++ b/vscode/microsoft-kiota/src/openApiTreeProvider.ts @@ -121,7 +121,7 @@ export class OpenApiTreeProvider implements vscode.TreeDataProvider result.push(...this.findSelectedPaths(x))); @@ -167,14 +167,14 @@ export class OpenApiTreeProvider implements vscode.TreeDataProvider 0) ); - result.children = node.children.map(x => this.getTreeNodeFromKiotaNode(x, result)); + result.children = node.children.map(x => this.getTreeNodeFromKiotaNode(x)); return result; } getChildren(element?: OpenApiTreeNode): OpenApiTreeNode[] { @@ -198,7 +198,7 @@ export class OpenApiTreeNode extends vscode.TreeItem { constructor( public readonly path: string, public readonly label: string, - public readonly selected: boolean, + selected: boolean, public collapsibleState: vscode.TreeItemCollapsibleState, _children?: OpenApiTreeNode[] ) { @@ -214,9 +214,9 @@ export class OpenApiTreeNode extends vscode.TreeItem { if (tokenizedFilter.length === 0) { return true; } - if (this.children.length === 0) { - const lowerCaseSegment = this.label.toLowerCase(); - return tokenizedFilter.some(x => lowerCaseSegment.includes(x.toLowerCase())); + const lowerCaseSegment = this.label.toLowerCase(); + if (tokenizedFilter.some(x => lowerCaseSegment.includes(x.toLowerCase()))) { + return true; } return this.children.some(x => x.isNodeVisible(tokenizedFilter)); }