Skip to content

Confusing interaction when you have a *.worksheet.sc in your workspace #1705

Open
@ckipp01

Description

@ckipp01

Version(s)
v0.1.18

Describe the bug
So this isn't necessarily a bug because I understand why it happens, but I'm wondering if it makes sense to maybe change this behavior when working with a *.worksheet.sc file. The issue is that let's you have a very minimal build with a Main.scala and then also a test.worksheet.sc. Because there are both of these it thinks that there are two main methods and two files that are including imports in your project when that's not really the case. For example the user will see this when they try to scala-cli run .

Found several main classes. Which would you like to run?
[0] myapp.run
[1] test$u002Eworksheet_sc

And they'll also see a message about their using directives:

Diagnostics:
Using directives detected in multiple files. It is recommended to keep them centralized in the /Users/ckipp/Documents/scala-workspace/myapp/src/project.scala file.

In theory this is correct since the script is another main-ish thing, but not really what the user is expecting because it's a worksheet.

To Reproduce

  • Create a Main.scala with some directives
  • Create a *.worksheet.sc in the same directory
  • Either try to run and see the issue or setup an ide and also see the issue

Expected behaviour
Again, I get why this happens but maybe we should special-case worksheets files to not do this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Community help wantedIssues that idicate features that are nice-to-have but core team does not have time to work on itbugSomething isn't workinggood first issueGood for newcomersrequires scopingIssue requires a spike to revalidate it and assign an up-to date scope for its requirements.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions