Skip to content

Resolve sources jars for the whole classpath, per entry - #166

Open
rochala wants to merge 1 commit into
mainfrom
sources-per-entry
Open

rochala wants to merge 1 commit into
mainfrom
sources-per-entry

Conversation

@rochala

@rochala rochala commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Summary

  • `get-source` only fetched the sources jar of the coordinate the user named, so a symbol defined in a dependency (inherited members, `cats.Functor` via cats-effect) could not be shown.
  • The `sources` classifier is now resolved in the same coursier fetch as the binaries. Coursier treats classifier artifacts as optional, so a dependency without a sources jar simply has none (verified with a local artifact lacking one).
  • `ContextResource.makeFromCoord` yields a `SourceJars` map from tasty-query classpath entry to sources jar; `get-source` looks the jar up via the symbol's own entry.
  • Removes the now-unused `fetchSourcesJar`; README row for `get-source` updated.

Verified

get-source org.typelevel:cats-effect_3:3.5.4 cats.Functor      → cats/Functor.scala lines 31–272  (failed before)
get-source org.typelevel:cats-effect_3:3.5.4 cats.effect.IOApp → cats/effect/IOApp.scala lines 143–594
get-source org.scalameta:mtags-interfaces:1.3.5 scala.meta.pc.OffsetParams → scala/meta/pc/OffsetParams.java

Full `lib.test` passes; `ContextResourceTest` asserts the fixture maps to its own sources jar and `scala.Option` to scala-library's. `_.fix --check` clean.

Not included

JDK sources (`lib/src.zip`) and project-aware commands, where the build tool gives jar paths without coordinates. First run of any external command now also downloads the closure's sources jars (cached afterwards).

🤖 Generated with Claude Code

get-source fetched only the named coordinate's sources jar, so any symbol
defined in a dependency (inherited members, cats.Functor via cats-effect) could
not be shown. Resolve the sources classifier in the same coursier fetch as the
binaries and map each classpath entry to its sources jar; the symbol's own entry
then says where its source lives.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant