public async loadMoreChildrenImpl()

in src/tree/AzureAccountTreeItemWithProjects.ts [59:116]


    public async loadMoreChildrenImpl(clearCache: boolean, context: IActionContext): Promise<AzExtTreeItem[]> {
        const children: AzExtTreeItem[] = await super.loadMoreChildrenImpl(clearCache, context);

        let hasLocalProject: boolean = false;
        Disposable.from(...this._projectDisposables).dispose();
        this._projectDisposables = [];

        const folders: readonly WorkspaceFolder[] = workspace.workspaceFolders || [];
        for (const folder of folders) {
            const projectPath: string | undefined = await tryGetFunctionProjectRoot(context, folder);
            if (projectPath) {
                try {
                    hasLocalProject = true;

                    const language: ProjectLanguage | undefined = getWorkspaceSetting(projectLanguageSetting, projectPath);
                    const version: FuncVersion | undefined = tryParseFuncVersion(getWorkspaceSetting(funcVersionSetting, projectPath));
                    if (language === undefined || version === undefined) {
                        children.push(new InitLocalProjectTreeItem(this, projectPath, folder));
                    } else {
                        let preCompiledProjectPath: string | undefined;
                        let effectiveProjectPath: string;
                        let isIsolated: boolean | undefined;
                        const compiledProjectInfo: CompiledProjectInfo | undefined = await getCompiledProjectInfo(context, projectPath, language);
                        if (compiledProjectInfo) {
                            preCompiledProjectPath = projectPath;
                            effectiveProjectPath = compiledProjectInfo.compiledProjectPath;
                            isIsolated = compiledProjectInfo.isIsolated;
                        } else {
                            effectiveProjectPath = projectPath;
                        }


                        const treeItem: LocalProjectTreeItem = new LocalProjectTreeItem(this, { effectiveProjectPath, folder, language, version, preCompiledProjectPath, isIsolated });
                        this._projectDisposables.push(treeItem);
                        children.push(treeItem);
                    }
                } catch (error) {
                    children.push(new InvalidLocalProjectTreeItem(this, projectPath, error, folder));
                }
            }

            this._projectDisposables.push(createRefreshFileWatcher(this, path.join(folder.uri.fsPath, hostFileName)));
            this._projectDisposables.push(createRefreshFileWatcher(this, path.join(folder.uri.fsPath, '*', hostFileName)));
        }

        if (!hasLocalProject && children.length > 0 && children[0] instanceof GenericTreeItem) {
            const ti: GenericTreeItem = new GenericTreeItem(this, {
                label: localize('createNewProject', 'Create New Project...'),
                commandId: 'azureFunctions.createNewProject',
                contextValue: 'createNewProject',
                iconPath: treeUtils.getThemedIconPath('CreateNewProject')
            });
            ti.commandArgs = [];
            children.unshift(ti);
        }

        return children;
    }