Skip to content
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

fix: bunch of fixes for ScalaCli scripts import #4455

Merged
merged 2 commits into from Sep 29, 2022

Conversation

dos65
Copy link
Member

@dos65 dos65 commented Sep 29, 2022

Fixes #4447 - use correct semanticdb root for bsp connection.

Also don't import a full directory if it conflicts with the sourceItems from the main build tool

Copy link
Member

@tanishiking tanishiking left a comment

Choose a reason for hiding this comment

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

I left several comments/clarification questions, but overall it's LGTM!

def start(roots: Seq[AbsolutePath]): Future[Unit] = {
ifConnectedOrElse(st =>
st.path == path || path.toNIO.startsWith(st.path.toNIO)
)(false)

Copy link
Member

Choose a reason for hiding this comment

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

[nit]

Suggested change
/**
* @param path a directory or a scalacli script's file path to import
*/

val dir = path.parent
val nioDir = dir.toNIO
val conflictsWithMainBsp =
buildTargets.sourceItems.filter(_.exists).exists { item =>
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should wait for the indexing here, before indexing, buildTargets.sourceItems is empty and scalaCliDirOrFile returns the parent directory.

Copy link
Member

Choose a reason for hiding this comment

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

We might want to wait for indexing here

if (path.isAmmoniteScript && buildTargets.inverseSources(path).isEmpty)
maybeImportScript(path)
too ? It should preents Metals to show popup for the sc files that belongs to some buildTargets.

Copy link
Contributor

Choose a reason for hiding this comment

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

Good idea, we should wait for indexing just in case.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thx, good suggestion. Changed!

Fixes scalameta#4447 - use correct semanticdb root for bsp connection.

Also don't import a full directory if it conflicts with the sourceItems
from the main build tool
…eServer.scala

Co-authored-by: Rikito Taniguchi <rikiriki1238@gmail.com>
Copy link
Member

@tanishiking tanishiking left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you very much @dos65 great job 💯

Copy link
Contributor

@tgodzik tgodzik left a comment

Choose a reason for hiding this comment

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

LGTM!

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.

Import Scala script as ScalaCLI script breaks the compilation (in Metals) of the files in the same directory
3 participants