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

bugfix: Auto imports in worksheets in Scala 3 #6042

Merged
merged 1 commit into from
Feb 16, 2024

Conversation

jkciesluk
Copy link
Member

Previously the import would be inserted above using directives

fixes #6027

@kasiaMarek
Copy link
Contributor

I think @tgodzik was suggesting to skip any top-level comments, that are not right above class/object/etc., saying that potentially there can be an license at the top.

Previously we only skipped using directives, not we skip all comments at the file beginning which are not directly above class/object
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

}
}
def scalaCliScStartOffset(text: String): Option[Int] =
scriptStartOffset(text, "/*<script>*/")
Copy link
Contributor

Choose a reason for hiding this comment

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

Aren't both the same now?

Copy link
Member Author

Choose a reason for hiding this comment

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

ScalaCLI uses <script> as a marker, where Ammonite uses <start>

@jkciesluk jkciesluk merged commit dc1b097 into scalameta:main Feb 16, 2024
27 checks passed
@jkciesluk jkciesluk deleted the i6027 branch February 16, 2024 13:16
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.

Scala 3: Imports in worksheets inserted before directives
3 participants