Lines 21-61javascript
22 for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
27 return function (mod) {
28 if (mod && mod.__esModule) return mod;
30 if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31 __setModuleDefault(result, mod);
35Object.defineProperty(exports, "__esModule", { value: true });
36exports.isTsLike = isTsLike;
37exports.tsGoToDefinition = tsGoToDefinition;
38exports.tsFindReferences = tsFindReferences;
39exports.tsGetHover = tsGetHover;
40exports.tsServiceAvailable = tsServiceAvailable;
41exports._resetTsServiceCache = _resetTsServiceCache;
42const path = __importStar(require("path"));
43const fs = __importStar(require("fs"));
MediumDynamic Require
Package source references dynamic require/import behavior.
dist/tools/tsLangService.jsView on unpkg · L41 44const module_1 = require("module");
45// ─── Real semantic navigation for TS/JS (GAP A) ───────────────────────────────
47// The VS Code extension serves go_to_definition / find_references / get_hover
48// through the editor's language server. The CLI had NO semantic layer — only the
49// regex-based symbol scanner (symbols.ts), which can list top-level declarations
50// but cannot resolve "where is THIS reference defined" or "who calls X" with type
51// awareness. For the dominant case (TypeScript / JavaScript projects) we can close
52// that gap by driving the TypeScript compiler's own LanguageService in-process.
55// • `typescript` is heavy (~10MB). We do NOT bundle it — it's marked `external`
56// in the CLI/VS Code esbuild configs and resolved LAZILY at runtime.
57// • We prefer the USER PROJECT's own typescript (node_modules) so results match
58// the version/config they build with; fall back to ours; degrade to a clear
59// message if neither resolves (the regex tools still work as a floor).
60// • One LanguageService per workspace root, cached, with an incrementing file
61// version map so edits during a session are picked up on the next call.