Skip to content

Conversation

YuMuuu
Copy link

@YuMuuu YuMuuu commented Aug 24, 2025

close: #522

This PR adds comprehensive Scala language support to serena.

I have implementation of solidlsp for scala(metals).

required dependency: coursier

@YuMuuu YuMuuu force-pushed the support-scala branch 2 times, most recently from 4a003d2 to 47431d5 Compare August 24, 2025 08:06
Comment on lines +105 to +110
cs_command_path,
"bootstrap",
"--java-opt",
"-XX:+UseG1GC",
"--java-opt",
"-XX:+UseStringDeduplication",
"--java-opt",
"-Xss4m",
"--java-opt",
"-Xms100m",
"--java-opt",
"-Dmetals.client=Serena",
artifact,
"-o",
metals_executable,
"-f",
Copy link
Author

@YuMuuu YuMuuu Aug 24, 2025

Choose a reason for hiding this comment

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

@YuMuuu YuMuuu closed this Aug 24, 2025
@YuMuuu YuMuuu reopened this Aug 24, 2025
@YuMuuu YuMuuu marked this pull request as ready for review August 24, 2025 11:32
Copy link
Contributor

@MischaPanch MischaPanch left a comment

Choose a reason for hiding this comment

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

Overall looks good, tests for finding references are missing before it can be merged. Thanks for adding Scala support to Serena!

yield ls


def test_scala_document_symbols(scala_ls):
Copy link
Contributor

Choose a reason for hiding this comment

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

as mentioned above, pls add tests on finding references within the same file and across files

Copy link
Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

see comment below

@YuMuuu YuMuuu force-pushed the support-scala branch 2 times, most recently from f25090f to 3717e3c Compare August 29, 2025 23:50
@MischaPanch
Copy link
Contributor

@YuMuuu

umm. i passed tests on local(arm mac)

You probably need to override and increase _get_wait_time_for_cross_file_referencing

@MischaPanch
Copy link
Contributor

I merged main where a fix regarding this was recently pushed and bump the waiting time. Let's see if that worked

@MischaPanch
Copy link
Contributor

I also passes locally for me on ubuntu

@YuMuuu
Copy link
Author

YuMuuu commented Aug 30, 2025

I think that not only LSP but also build tool dependencies are necessary.

@YuMuuu YuMuuu force-pushed the support-scala branch 4 times, most recently from fe14eed to f00392a Compare August 30, 2025 19:25
@MischaPanch
Copy link
Contributor

MischaPanch commented Aug 30, 2025

I think the state in b787b30 was good, maybe just more waiting needed. It did work locally for me without installing any build tools, just after installing coursier

@YuMuuu
Copy link
Author

YuMuuu commented Aug 30, 2025

I think the state in b787b30 was good, maybe just more waiting needed. It did work locally for me without installing any build tools, just after installing coursier

Thank you for your confirmation. I will revert the commit!

@YuMuuu YuMuuu force-pushed the support-scala branch 2 times, most recently from 4892843 to 1ddd8e3 Compare August 30, 2025 22:31
@YuMuuu
Copy link
Author

YuMuuu commented Aug 31, 2025

...

@MischaPanch
Copy link
Contributor

I think a 5 sec wait was enough, it's running through on Ubuntu and macOS. I'll have a look at what's wrong on windows, I suppose either some path issue (using wrong separator), or a fundamental problem in the LS itself

@YuMuuu YuMuuu force-pushed the support-scala branch 3 times, most recently from 5ad195a to 56ac8cd Compare August 31, 2025 15:50
@YuMuuu YuMuuu force-pushed the support-scala branch 2 times, most recently from bb713ef to e628787 Compare September 22, 2025 14:53
@MischaPanch
Copy link
Contributor

@YuMuuu thanks! I will try running the tests locally by following the guide and if everything works out, we can merge this

@MischaPanch
Copy link
Contributor

@YuMuuu I readded the test files to try the setup you recommend in the docs. I added the plugins.sbt as suggested there.

With the manual setup, sbt -Dbloop.export-jar-classifiers=sources bloopInstall works but sbt compile gives

sbt compile                                               
[info] welcome to sbt 1.10.1 (Eclipse Adoptium Java 21.0.8)
[info] loading settings for project scala-build from metals.sbt,plugins.sbt ...
[info] loading project definition from C:\Users\misch\Projects\oraios\serena\test\resources\repos\scala\project
[info] loading settings for project scala from build.sbt ...
[info] set current project to scala (in build file:/C:/Users/misch/Projects/oraios/serena/test/resources/repos/scala/)
[info] Executing in batch mode. For better performance use sbt's shell
[info] compiling 2 Scala sources to C:\Users\misch\Projects\oraios\serena\test\resources\repos\scala\target\scala-2.13\classes ...
[error] C:\Users\misch\Projects\oraios\serena\test\resources\repos\scala\src\main\scala\Main.scala:13:16: not found: value User
[error]     val user = User("Alice", 30)
[error]                ^                                                                 
[error] C:\Users\misch\Projects\oraios\serena\test\resources\repos\scala\src\main\scala\Main.scala:16:19: not found: value Product
[error]     val product = Product(1, "Laptop", 999.99)
[error]                   ^
[error] C:\Users\misch\Projects\oraios\serena\test\resources\repos\scala\src\main\scala\Main.scala:30:25: not found: type User
[error]   def processUser(user: User): Unit = {
[error]                         ^
[error] three errors found
[error] (Compile / compileIncremental) Compilation failed
[error] Total time: 4 s, completed 01.10.2025, 23:26:3

Is that to be expected? I thought the test files were a valid scala project.

Btw, I have a new laptop with windows and had to install the scala toolchain from scratch. The executables I get are all .bat files and I had to alias all of them to work like alias sbt=sbt.bat in git bash. That is quite annoying - is that how scala users work on Windows? Maybe that should be added to the docs, or am I just misunderstanding something.

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.

Add support for scala programming language
3 participants