Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { openReadonlyOrFail } from './db.js';
import { paginateResult } from './paginate.js';
import { findMatchingNodes, kindIcon } from './queries.js';
import { CORE_SYMBOL_KINDS, findMatchingNodes, kindIcon } from './queries.js';
import { outputResult } from './result-formatter.js';
import { FRAMEWORK_ENTRY_PREFIXES } from './structure.js';
import { isTestFile } from './test-filter.js';
Expand Down Expand Up @@ -100,13 +100,15 @@ export function flowData(name, dbPath, opts = {}) {
const maxDepth = opts.depth || 10;
const noTests = opts.noTests || false;

// Phase 1: Direct LIKE match on full name
let matchNode = findMatchingNodes(db, name, opts)[0] ?? null;
// Phase 1: Direct LIKE match on full name (use all 10 core symbol kinds,
// not just FUNCTION_KINDS, so flow can trace from interfaces/types/structs/etc.)
const flowOpts = { ...opts, kinds: opts.kind ? [opts.kind] : CORE_SYMBOL_KINDS };
let matchNode = findMatchingNodes(db, name, flowOpts)[0] ?? null;

// Phase 2: Prefix-stripped matching — try adding framework prefixes
if (!matchNode) {
for (const prefix of FRAMEWORK_ENTRY_PREFIXES) {
matchNode = findMatchingNodes(db, `${prefix}${name}`, opts)[0] ?? null;
matchNode = findMatchingNodes(db, `${prefix}${name}`, flowOpts)[0] ?? null;
if (matchNode) break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ function resolveMethodViaHierarchy(db, methodName) {
* Scoring: exact=100, prefix=60, word-boundary=40, substring=10, plus fan-in tiebreaker.
*/
export function findMatchingNodes(db, name, opts = {}) {
const kinds = opts.kind ? [opts.kind] : FUNCTION_KINDS;
const kinds = opts.kind ? [opts.kind] : opts.kinds?.length ? opts.kinds : FUNCTION_KINDS;

const rows = findNodesWithFanIn(db, `%${name}%`, { kinds, file: opts.file });

Expand Down