(client: ChangeSymbolSource, project: string, filePath: string)
| 94 | queryRows(project: string, query: string): Promise<Record<string, string>[]>; |
| 95 | } |
| 96 | export async function loadFileImpactSymbols(client: ChangeSymbolSource, project: string, filePath: string): Promise<SelectionImpactTarget[]> { |
| 97 | const results = await Promise.all(['Function', 'Method'].map(label => client.queryRows(project, |
| 98 | `MATCH (n:${label}) WHERE n.file_path = ${JSON.stringify(filePath)} RETURN n.name, n.qualified_name, n.file_path, n.start_line LIMIT 200`))); |
| 99 | const unique = new Map<string, SelectionImpactTarget>(); |
| 100 | for (const row of results.flat()) { |
| 101 | const qualifiedName = row['n.qualified_name']; |
| 102 | if (!qualifiedName || row['n.file_path'] !== filePath) continue; |
| 103 | unique.set(qualifiedName, { name: row['n.name'], qualifiedName, filePath, |
| 104 | ...(Number(row['n.start_line']) > 0 ? { line: Number(row['n.start_line']) } : {}) }); |
| 105 | } |
| 106 | return [...unique.values()].sort((a, b) => (a.line ?? 0) - (b.line ?? 0)); |
| 107 | } |
| 108 | |
| 109 | export function localDiffCommand(base: string, filePath: string): string { |
| 110 | if (!validChangeRef(base)) return ''; |
no test coverage detected