Skip to content

Support for multi-project find all references #5209

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Nov 13, 2018

Conversation

Duhemm
Copy link
Contributor

@Duhemm Duhemm commented Oct 5, 2018

This commit adapts the find all references feature so that it is able
to find references to given symbols across projects. For symbols that
come from the classpath, all the projects in the build will be
inspected. If we're able to find a source for the symbol, only the
projects that depend on the projects where we found the definition need
to be inspected.

@Duhemm Duhemm added the stat:wip label Oct 5, 2018
@Duhemm Duhemm force-pushed the topic/ide-multi-project-references branch 3 times, most recently from 73cf3e0 to d48548e Compare November 2, 2018 08:36
@Duhemm Duhemm requested a review from smarter November 7, 2018 12:44
@Duhemm Duhemm assigned smarter and unassigned Duhemm Nov 7, 2018
@Duhemm Duhemm force-pushed the topic/ide-multi-project-references branch from d48548e to 0f8853a Compare November 8, 2018 08:13
symbol.ownersIterator.toList.reverse.map(_.name)
}
in(targetDriver) { implicit ctx =>
val base: Symbol = ctx.definitions.RootClass
Copy link
Member

Choose a reason for hiding this comment

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

Does this work for symbols in the empty package ? Definition#staticRef has a special case to handle that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This field will be used to restrict which projects to inspect when doing
workspace-wide rename or finding all references.

The code that extracts dependency information from sbt has been ported
from scalacenter/bloop:

https://github.com/scalacenter/bloop/blob/v1.0.0/integrations/sbt-bloop/src/main/scala/bloop/integrations/sbt/SbtBloop.scala
This commit adapts the `find all references` feature so that it is able
to find references to given symbols across projects. For symbols that
come from the classpath, all the projects in the build will be
inspected. If we're able to find a source for the symbol, only the
projects that depend on the projects where we found the definition need
to be inspected.
(This commit contains no functional change)
This is necessary because we may be using this InteractiveDriver before
asking it to compile anything (which would have initialized it). This
happens, for instance, if we use this Driver to resolve a symbol coming
from a different Driver.

Drivers are not meant to be used before being initialized and can crash.
It appears that the `TreeUnpickler` is not able to be run in parallel.
@Duhemm Duhemm force-pushed the topic/ide-multi-project-references branch from 0f8853a to d5280a6 Compare November 12, 2018 12:26
@Duhemm
Copy link
Contributor Author

Duhemm commented Nov 12, 2018

@smarter I've addressed your comments

@Duhemm Duhemm merged commit 6a315ff into scala:master Nov 13, 2018
@Duhemm Duhemm deleted the topic/ide-multi-project-references branch November 13, 2018 06:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants