Uh oh!
There was an error while loading. Please reload this page.
feat(lsp): add Metals LSP support for Scala - #12268
Conversation
The following comment was made by an LLM, it may be inaccurate: No duplicate PRs found |
30cbb96 to
09b64e2CompareYichenLi00
commented
Feb 5, 2026
The failing test ( |
YichenLi00
commented
Feb 5, 2026
- Add .sbt and .sc extension mappings - Auto-download Coursier if not present (macOS, Linux, Windows) - Auto-install Metals via Coursier - Requires Java 11+ - Respects OPENCODE_DISABLE_LSP_DOWNLOAD flag
724047c to
8dd5b6dCompareYichenLi00
commented
Feb 7, 2026
@thdxr Rebased, CI passing now. Ready for review. |
majk-p
commented
Mar 17, 2026
@thdxr can you please have a look? 🙏 |
cyber-barrista
commented
Apr 1, 2026
Any progress on the review? |
BugNotFoundX
commented
Apr 10, 2026
Any progress on the review? As a user of Scala, I really need this feature. |
rekram1-node
commented
Apr 10, 2026
lookin |
rekram1-node
commented
Apr 10, 2026
/review |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| export const Metals: Info = { | ||
| id: "metals", | ||
| extensions: [".scala", ".sbt", ".sc"], | ||
| root: NearestRoot(["build.sbt", "build.sc", ".scala-build", "project/build.properties"]), |
There was a problem hiding this comment.
Are you sure this root detection works for sbt projects that only have project/build.properties? NearestRoot returns the matched file’s parent directory, so wouldn’t that make Metals start in /project instead of the actual project root?
There was a problem hiding this comment.
If that is the behavior, then I don't think it'll work, but a scala project with only a "project/build.properties" without a build file is quite rare nowadays. Checking for just the "project" directory is likely too lax, so I think it'd be safe to simply remove the last element from the list.
There was a problem hiding this comment.
I think this list should also include build.millmill builds
rekram1-node
commented
Apr 10, 2026
ignore current test failure, flaky test. |
Summary
.scala,.sbt,.sc)Closes#10685
Implementation Details
.scala,.sbt,.scbuild.sbt,build.sc,.scala-build,project/build.propertiescs install metalsmetals(no arguments needed)statusBarProvider: "log-message",isHttpEnabled: trueWhy these decisions?
Coursier over direct binary download - Metals is distributed via Coursier (the Scala artifact manager). This is the official installation method and handles JVM version compatibility automatically.
Auto-download Coursier if missing - Follows existing patterns (gopls via
go install, csharp-ls viadotnet tool install). Coursier binaries are available for all major platforms.Java 11+ requirement - Metals requires Java 11 or later. The implementation checks for Java availability before attempting installation.
Project detection files - Covers SBT (
build.sbt), Mill (build.sc), Scala CLI (.scala-build), and SBT version file (project/build.properties).Files Changed
packages/opencode/src/lsp/language.ts- Add.sbtand.scextensionspackages/opencode/src/lsp/server.ts- Add Metals LSP serverpackages/web/src/content/docs/lsp.mdx- Update documentation