Skip to content

Commit 8266b33

Browse files
committed
fix: include constant kind in whereSymbol and findMatchingNodes queries (#487)
whereSymbolImpl used ALL_SYMBOL_KINDS (core 10, no constant) so codegraph where could not find constants. findMatchingNodes defaulted to FUNCTION_KINDS which also excluded constant. Switch whereSymbolImpl to EVERY_SYMBOL_KIND and add constant to FUNCTION_KINDS default. Impact: 1 functions changed, 6 affected
1 parent 39f9967 commit 8266b33

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/domain/analysis/symbol-lookup.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ import {
1414
openReadonlyOrFail,
1515
} from '../../db/index.js';
1616
import { isTestFile } from '../../infrastructure/test-filter.js';
17-
import { ALL_SYMBOL_KINDS } from '../../shared/kinds.js';
17+
import { EVERY_SYMBOL_KIND } from '../../shared/kinds.js';
1818
import { getFileHash, normalizeSymbol } from '../../shared/normalize.js';
1919
import { paginateResult } from '../../shared/paginate.js';
2020

21-
const FUNCTION_KINDS = ['function', 'method', 'class'];
21+
const FUNCTION_KINDS = ['function', 'method', 'class', 'constant'];
2222

2323
/**
2424
* Find nodes matching a name query, ranked by relevance.
@@ -103,12 +103,12 @@ export function queryNameData(name, customDbPath, opts = {}) {
103103
}
104104

105105
function whereSymbolImpl(db, target, noTests) {
106-
const placeholders = ALL_SYMBOL_KINDS.map(() => '?').join(', ');
106+
const placeholders = EVERY_SYMBOL_KIND.map(() => '?').join(', ');
107107
let nodes = db
108108
.prepare(
109109
`SELECT * FROM nodes WHERE name LIKE ? AND kind IN (${placeholders}) ORDER BY file, line`,
110110
)
111-
.all(`%${target}%`, ...ALL_SYMBOL_KINDS);
111+
.all(`%${target}%`, ...EVERY_SYMBOL_KIND);
112112
if (noTests) nodes = nodes.filter((n) => !isTestFile(n.file));
113113

114114
const hc = new Map();

0 commit comments

Comments
 (0)