Skip to content

LogicalPackagesProvider: use the compilation Context - #26776

Open
SolalPirelli wants to merge 5 commits into
scala:mainfrom
dotty-staging:solal/logical-provider-context
Open

LogicalPackagesProvider: use the compilation Context#26776
SolalPirelli wants to merge 5 commits into
scala:mainfrom
dotty-staging:solal/logical-provider-context

Conversation

@SolalPirelli

Copy link
Copy Markdown
Contributor

Ensures files are parsed with the right encoding, etc.

I need this for an unrelated refactoring I'm doing.

Have you relied on LLM-based tools in this contribution?

No

How was the solution tested?

Covered by existing tests (this is a refactoring)

search,
driver,
() => InteractiveDriver(driverSettings, driver.logicalRootPackage),
() => InteractiveDriver(driverSettings, driver.logicalRootPackageExtractor),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this not recreate the logicalRootPackage on each completion? It can be quite heavy since we parse each file in the sourcepath.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'll create it once per instance of ContextBase (since the platform is created in initialize() and cached in a field).

Do we create more than one of those per source path?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case it would be worth to copy over the context ot the logicalRootPackage itself, otherwise we will create a new instance of ContextBase on the fallback here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added caching

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@SolalPirelli
SolalPirelli force-pushed the solal/logical-provider-context branch from 3c8523e to 741de6a Compare August 11, 2026 13:54
@SolalPirelli
SolalPirelli requested a review from tgodzik August 11, 2026 15:08
@SolalPirelli
SolalPirelli marked this pull request as ready for review August 11, 2026 15:08
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.

2 participants