* Der Modul-Knoten dieser Datei, beim Graphen nachgefragt. * * Zuerst das Modul-Label, weil nur der Modul-Knoten eine Zeilenspanne mitbringt. * Wenn es keinen gibt, der File-Knoten: aus seinem Namen laesst sich der des * Moduls zurueckrechnen, aber eine Spanne kommt nicht mit, und dann weiss der
(
client: RpcIntelligenceClient,
project: string,
path: string,
)
| 104 | * Reader spaeter nicht, wie lang die Datei wirklich ist. |
| 105 | */ |
| 106 | async function lookupModuleNode( |
| 107 | client: RpcIntelligenceClient, |
| 108 | project: string, |
| 109 | path: string, |
| 110 | ): Promise<{ qualifiedName: string; source: QnSource; endLine?: number } | undefined> { |
| 111 | const moduleRows = await client.queryRows(project, moduleForFile(path)); |
| 112 | const moduleRow = moduleRows[0]; |
| 113 | if (moduleRow !== undefined) { |
| 114 | const qualifiedName = moduleRow[COLUMNS.moduleForFile[0]] ?? ''; |
| 115 | if (qualifiedName.length > 0) { |
| 116 | const endLine = toOptionalNumber(moduleRow[COLUMNS.moduleForFile[2]]); |
| 117 | return endLine === undefined |
| 118 | ? { qualifiedName, source: 'graph-module' } |
| 119 | : { qualifiedName, source: 'graph-module', endLine }; |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | const fileRows = await client.queryRows(project, fileNodeForPath(path)); |
| 124 | const fileQualifiedName = fileRows[0]?.[COLUMNS.fileNode[0]] ?? ''; |
| 125 | if (fileQualifiedName.length === 0) { |
| 126 | return undefined; |
| 127 | } |
| 128 | const derived = moduleQnFromFileQn(fileQualifiedName); |
| 129 | return derived === undefined ? undefined : { qualifiedName: derived, source: 'graph-file' }; |
| 130 | } |
| 131 | |
| 132 | /** What the server writes in place of source when it cannot read the file. */ |
| 133 | export const SOURCE_UNAVAILABLE = '(source not available)'; |
no test coverage detected