* The NodeIdentity of every node in a file, without decoding whole * nodes. Read before a re-index deletes the file, so each incoming * cross-file edge can follow its target to the node that replaces it (#2276).
(filePath: string)
| 1344 | * cross-file edge can follow its target to the node that replaces it (#2276). |
| 1345 | */ |
| 1346 | getNodeIdentitiesByFile(filePath: string): NodeIdentity[] { |
| 1347 | if (!this.stmts.getNodeIdentitiesByFile) { |
| 1348 | this.stmts.getNodeIdentitiesByFile = this.db.prepare( |
| 1349 | 'SELECT id, kind, name, qualified_name, signature, start_line, start_column FROM nodes WHERE file_path = ?' |
| 1350 | ); |
| 1351 | } |
| 1352 | const rows = this.stmts.getNodeIdentitiesByFile.all(filePath) as Array< |
| 1353 | Pick<NodeRow, 'id' | 'kind' | 'name' | 'qualified_name' | 'signature' | 'start_line' | 'start_column'> |
| 1354 | >; |
| 1355 | return rows.map((row) => ({ |
| 1356 | id: row.id, |
| 1357 | kind: row.kind as NodeKind, |
| 1358 | name: row.name, |
| 1359 | qualifiedName: row.qualified_name, |
| 1360 | signature: row.signature ?? undefined, |
| 1361 | startLine: row.start_line, |
| 1362 | startColumn: row.start_column, |
| 1363 | })); |
| 1364 | } |
| 1365 | |
| 1366 | /** |
| 1367 | * Get all nodes in several files at once — one chunked `IN` query rather than |
no test coverage detected