codegraph icon indicating copy to clipboard operation
codegraph copied to clipboard

fix(resolution): resolve ES imports targeting .xsjs/.xsjslib files (#556)

Open maxmilian opened this issue 6 months ago • 2 comments

What changed

The headline of #556 — indexing SAP HANA .xsjs / .xsjslib files as JavaScript — already shipped on main via #654 (the extension map + detection + extraction tests, credited to #556). This PR has been rebased and slimmed to the one piece #654 did not cover: import resolution.

Remaining gap

EXTENSION_RESOLUTION.javascript in src/resolution/import-resolver.ts did not list .xsjs / .xsjslib, so an extensionless ES import from an xsjs file —

// service.xsjs
import { buildQuery } from "./helpers";   // -> helpers.xsjslib

resolved to nothing. The cross-file call edge was dropped, so codegraph_callers / codegraph_impact reported the imported symbol as having no callers even though the import is live.

Fix

Add .xsjs, .xsjslib to the javascript entry in EXTENSION_RESOLUTION (one line). Now ./helpers resolves to helpers.xsjslib and the call edge is created.

Tests

  • Kept one resolution test: .xsjs -> .xsjslib ES import produces a cross-file call edge (run() -> buildQuery). Passes.
  • Dropped the two detection/extraction tests this PR originally added — they overlap with the coverage #654 already merged (detectLanguage('service.xsjs'), extractFromSource('service.xsjs', …)).

Scope

Resolution only. The grammar/extension map is untouched here since #654 owns it now.

maxmilian avatar May 31 '26 14:05 maxmilian

Rebased onto current main.

To clarify why this is still worth landing even though #556 was closed by #654: #654 registered .xsjs/.xsjslib as JavaScript on the extraction side (grammars.ts), so those files are now parsed and indexed — but the import-resolution side was untouched. EXTENSION_RESOLUTION.javascript in import-resolver.ts still doesn't list .xsjs/.xsjslib, so an extensionless import { x } from './helpers' that targets helpers.xsjslib resolves to nothing and the cross-file call edge is dropped.

This 1-line addition closes that residual gap; the resolution test should resolve an ES import from a .xsjs file to a .xsjslib file (#556) covers it and coexists with the extraction-level .xsjs test from #654.

maxmilian avatar Jun 17 '26 15:06 maxmilian

@colbymchenry heads-up before this goes stale: #556 is closed as completed, but the import-resolution half is still missing on main. EXTENSION_RESOLUTION.javascript in src/resolution/import-resolver.ts doesn't include .xsjs/.xsjslib, so imports targeting those files still don't resolve — the extraction side shipped in #654, but resolution didn't. This PR is the one-line gap-closer. Want me to keep it open / rebase, or is the unresolved import acceptable? I'll close it if you'd rather not carry it.

maxmilian avatar Jun 24 '26 22:06 maxmilian