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

Scala version on independent worksheet files #78

Open
EskoJTH opened this issue Sep 6, 2022 · 6 comments
Open

Scala version on independent worksheet files #78

EskoJTH opened this issue Sep 6, 2022 · 6 comments

Comments

@EskoJTH
Copy link

EskoJTH commented Sep 6, 2022

What is the preferred way of changing scala version for independent .worksheet.sc files? I updated everything lsp related and now I seem to be stuck on scala version 3 while I need scala 2.13. Ammonite does not seem to have a way to define this inside a file and my ammonite is on the correct scala version. I wasn't quite sure what is the system responsible of the version so sorry if this is the wrong place to ask.

@EskoJTH EskoJTH changed the title scala version on independent worksheet files. Scala version on independent worksheet files Sep 6, 2022
@kurnevsky
Copy link
Member

It's defined in your build.sbt. Can you change this version in vscode? If you can then there will be a similar way to do it in emacs.

@EskoJTH
Copy link
Author

EskoJTH commented Sep 6, 2022

I do not have build.sbt I'm running these as stand alone scripts. Previously everything worked pretty much perfectly in emacs. I haven't used vscode for a long time. There has been some ammonite support officially in metals for a couple of years though. https://scalameta.org/metals/blog/2020/07/01/lithium/ .

@EskoJTH
Copy link
Author

EskoJTH commented Sep 6, 2022

In vscode it seems to default to correct version of the compiler for some reason. I didn't manage to change the version yet though. metals seems to say something like this to me:
2022.09.06 13:38:02 INFO no build target found for /home/esko/harjo/ammo/muodoton4typeClasses.worksheet.sc. Using presentation compiler with project's scala-library version: 2.12.13
Now I wonder what is "presentation compiler" and where is its version defined.

@LaurenceWarne
Copy link
Contributor

Ammonite does not seem to have a way to define this inside a file and my ammonite is on the correct scala version.

You can specify the Ammonite version as a comment like // scala 2.13.8 before your code, see here: https://scalameta.org/metals/docs/troubleshooting/faq/#how-do-i-use-scala-2xx-for-my-script.

FYI you can also check more easily which scala versions are being used for partcular scripts using lsp-metals-doctor-run.

@EskoJTH
Copy link
Author

EskoJTH commented Sep 28, 2022

Thanks a lot! This seems to have fixed everything. Somehow I did not find that line of documentation.

@LaurenceWarne
Copy link
Contributor

Cool glad I could help 🙂

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

No branches or pull requests

3 participants