Skip to content

Commit

Permalink
Pass tracer to SourceLoader to fix tracing (#5833)
Browse files Browse the repository at this point in the history
The `SourceLoader` emits traces under the `"import-resolution"`
namespace.
During the refactor in d2ac995, we
stopped passing the `tracer` to the `SourceLoader` so those traces
weren't happening.

This appear to be a bug, as `LoadSourceOptions` has a field for
`tracer`.
  • Loading branch information
steverice authored Feb 3, 2025
1 parent 697b15e commit 212a549
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: fix
packages:
- "@typespec/compiler"
---

Fix tracing in `SourceLoader`
1 change: 1 addition & 0 deletions packages/compiler/src/core/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ export async function compile(
async function loadSources(entrypoint: string) {
const sourceLoader = await createSourceLoader(host, {
parseOptions: options.parseOptions,
tracer,
getCachedScript: (file) =>
oldProgram?.sourceFiles.get(file.path) ?? host.parseCache?.get(file),
});
Expand Down

0 comments on commit 212a549

Please sign in to comment.