(projectPath: string)
| 306 | } |
| 307 | |
| 308 | private getOrCreateProjectNode(projectPath: string): ProjectNode { |
| 309 | const existingProject = this.projectNodes.get(projectPath); |
| 310 | if (existingProject) |
| 311 | return existingProject; |
| 312 | |
| 313 | // If we have multiple workspace folders (and we're inside one), we may need a parent workspace |
| 314 | // folder node. |
| 315 | let workspaceFolder = this.getWorkspaceFolders().length > 1 |
| 316 | ? this.getWorkspaceFolder(projectPath) |
| 317 | : undefined; |
| 318 | |
| 319 | // If the workspace folder and project are the same, we don't need the workspace folder node. |
| 320 | if (workspaceFolder && path.resolve(workspaceFolder.path) === path.resolve(projectPath)) |
| 321 | workspaceFolder = undefined; |
| 322 | |
| 323 | const parent = workspaceFolder ? this.getOrCreateWorkspaceFolderNode(workspaceFolder) : undefined; |
| 324 | const name = workspaceFolder |
| 325 | ? path.relative(workspaceFolder.path, projectPath) |
| 326 | : path.basename(projectPath); |
| 327 | |
| 328 | const supportsCoverage = isFlutterProjectFolder(projectPath) || getPackageTestCapabilitiesForDartProject(this.logger, this.workspaceContext, projectPath).supportsLcovCoverage; |
| 329 | |
| 330 | const node = new ProjectNode(parent, name, projectPath, supportsCoverage); |
| 331 | this.projectNodes.set(projectPath, node); |
| 332 | |
| 333 | if (parent) { |
| 334 | parent.children.push(node); |
| 335 | this.updateNode({ node: parent }); |
| 336 | } |
| 337 | |
| 338 | return node; |
| 339 | } |
| 340 | |
| 341 | private getOrCreateWorkspaceFolderNode(wf: { name: string, path: string, uri: URI }): WorkspaceFolderNode { |
| 342 | let node = this.workspaceFolderNodes.get(wf.path); |
no test coverage detected