-
Notifications
You must be signed in to change notification settings - Fork 131
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
Support IDE imports for multiple scripts/projects sharing the same project root #3367
Comments
@jackkoenig Do I understand correctly, that the issue is actually not about supporting file-based project structures (which to my knowledge is in place), but rather proper IDE imports for multiple scripts sharing the same project root? Let me explain why do I think that.
I can see what you mean in this issue, but technically this is already the case. We do, in fact, treat projects on a per-file basis, rather than per-directory (unlike, for example, SBT)
Now, that may be so, but whatever lands in the
This is a problem completely separate from the Check the protocol definition: Note that if multiple BSP connection files are found at Theoretically, if the IDE was to support a separate classpath and configuration for each script in the directory, each of them would have to be imported as a separate connection. And then, if there would be source files/scripts reused in multiple projects living in the same directory (as described in the issue), then it likely would be unclear which configuration should be used. So generally speaking, it's easier said than done. Also note that technically you could work around scripts sharing a workspace by making them have separate workspaces (even when they're in the same root directory). You can override where
You can get rid of those with Summoning @tgodzik and @kasiaMarek for the Metals perspective on the issue. Generally speaking, this is something that was discussed here and there for quite some time, but as of now, no solve-it-all solution has been proposed. |
I don't think there is anything |
I was thinking about:
could we improve that though? Maybe have everything in a separate package for a script? That would at least make those scripts work. Also if we do So the workflow for Metals would be to include all files allow them to work within single module by default. And for sure I would allow scripts to have using directives separate, so maybe not report it there. On the Metals side we would have to start multiple server, which would mean more possible bugs and problems with that. |
@tgodzik what do you mean by a separate package?
Mixed feelings about this. Each of the scripts may have a very different classpath/configuration. It may improve the feeling overall, but it may also break existing scripts based on what directory they are in.
Separate issue.
I'm not sure if we can avoid that, however, if we want a full solution... |
Is your feature request related to a problem? Please describe.
It's common practice to have grab bags of "utility" scripts that are independent of each other. Often these are written in scripting languages like Python, Perl, or even Bash. Sometimes there will be shared code, sort of "library" files shared by multiple script "application" files. I am working on migrating such "grab bag utility" scripts to Scala Cli, it's awesome but this directory structure conflicts with Scala Cli's model of projects on a directory basis.
Note that it seems to work, except I think when I run different "scripts" in the same directory via
scala-cli
they are clobbering the.scala-build
directory. The problem is most apparent when trying to use Metals with these scripts because it will report errors about multiple definitions (e.g. each top-level "script" has anobject Main
) and warnings aboutUsing directives detected in multiple files.
again due to multiple top-level "scripts".Describe the solution you'd like
It would be nice if Scala Cli could treat projects on a per-file basis rather than per directory.
using file
directives in the top-file should be enough to define which files are in a particular project, and then Scala Cli could disambiguate each project based on the "top" file.I am not sure if this is the same issue or separate, but the complaints about "using directives detected in multiple files" feels related--if I have some "library" files shared between separate projects, those libraries should be able to define their own dependencies. Maybe this is a step too much toward "build tool" land though.
Describe alternatives you've considered
I could define each "script" in its own directory, it makes replicating the behavior of grab bag "script" directories marginally more annoying, but I can just have each "script" actually be a tiny bash script that invokes the actual Scala code which is within its own directory. I already have to do this for various reasons so it's not that bad.
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: