( matches: SnapshotState['nodes'], locator: FindLocator, query: string, )
| 629 | } |
| 630 | |
| 631 | function buildAmbiguousMatchError( |
| 632 | matches: SnapshotState['nodes'], |
| 633 | locator: FindLocator, |
| 634 | query: string, |
| 635 | ): DaemonResponse { |
| 636 | const candidates = matches.slice(0, 8).map((candidate) => { |
| 637 | const label = |
| 638 | extractNodeText(candidate) || candidate.label || candidate.identifier || candidate.type || ''; |
| 639 | return `@${candidate.ref}${label ? `(${label})` : ''}`; |
| 640 | }); |
| 641 | return errorResponse( |
| 642 | 'AMBIGUOUS_MATCH', |
| 643 | `find matched ${matches.length} elements for ${locator} "${query}". Use a more specific locator or selector.`, |
| 644 | { |
| 645 | locator, |
| 646 | query, |
| 647 | matches: matches.length, |
| 648 | candidates, |
| 649 | }, |
| 650 | ); |
| 651 | } |
| 652 | |
| 653 | function shouldScopeFind(locator: FindLocator): boolean { |
| 654 | return locator !== 'role'; |
no test coverage detected
searching dependent graphs…