(loc: CodeNavLocation)
| 289 | const changedSet = new Set(context.changedFiles); |
| 290 | |
| 291 | function score(loc: CodeNavLocation): number { |
| 292 | let s = 0; |
| 293 | |
| 294 | if (loc.filePath === context.sourceFilePath) s += 1000; |
| 295 | else if (changedSet.has(loc.filePath)) s += 500; |
| 296 | else if (sameDirectory(loc.filePath, context.sourceFilePath)) s += 200; |
| 297 | |
| 298 | if (isTestFile(loc.filePath) && !context.isTestFile) s -= 300; |
| 299 | |
| 300 | if (loc.kind === "definition") s += 100; |
| 301 | if (loc.confidence === "likely") s += 50; |
| 302 | |
| 303 | return s; |
| 304 | } |
| 305 | |
| 306 | const sorted = [...locations].sort((a, b) => score(b) - score(a)); |
| 307 | const truncated = sorted.slice(0, cap); |
no test coverage detected