LSP tool not recognizing custom LSP server configuration (metals/Scala)

Resolved 💬 2 comments Opened Jun 8, 2026 by chb0github Closed Jun 12, 2026

Bug Description

The LSP tool returns \"No LSP server available for file type: .scala\" despite having a correctly configured custom LSP server in ~/.claude/settings.json. The LSP server (metals) is never invoked, even after session restarts.

Environment

  • Claude Code Version: 2.1.168
  • Platform: macOS (Darwin 24.6.0)
  • LSP Server: metals 1.6.7 (installed via Coursier)
  • Project Type: Gradle-based Scala project

Configuration

~/.claude/settings.json:

{
  "env": {
    "ENABLE_LSP_TOOL": "1"
  },
  "lsp": {
    "servers": {
      "scala": {
        "command": "metals",
        "args": [],
        "rootPatterns": [
          "build.sbt",
          "build.sc",
          ".scalafmt.conf",
          "build.gradle",
          "build.gradle.kts"
        ],
        "extensions": [
          ".scala",
          ".sbt",
          ".sc"
        ]
      }
    },
    "debug": true
  }
}

Steps to Reproduce

  1. Install metals LSP server (cs install metals)
  2. Add LSP configuration to ~/.claude/settings.json as shown above
  3. Restart Claude Code session
  4. Navigate to a Scala project with build.gradle at root
  5. Run: LSP documentSymbol on file.scala

Expected Behavior

  • Claude Code should detect the .scala file extension
  • Start the metals LSP server
  • Return document symbols from the file

Actual Behavior

LSP tool result: "No LSP server available for file type: .scala"

Debugging Performed

  1. ✅ Verified metals command is in PATH and executable
  2. ✅ Confirmed ENABLE_LSP_TOOL=1 is set in environment
  3. ✅ Validated JSON syntax of settings.json
  4. ✅ Restarted Claude Code session multiple times
  5. ✅ Tried both .scala and scala in extensions field
  6. ✅ Created wrapper script to detect if metals is invoked - wrapper was never called
  7. ✅ Added multiple rootPatterns including build.gradle, .scalafmt.conf
  8. ✅ Tried creating plugin structure similar to rust-analyzer
  9. ✅ Enabled debug mode ("debug": true)

Key finding: The metals command is never invoked by Claude Code, suggesting the LSP configuration isn't being loaded or recognized at all.

Additional Context

  • The rust-analyzer LSP works (configured as a plugin at ~/.claude/plugins/cache/claude-plugins-official/rust-analyzer-lsp)
  • CloudFormation LSP servers are running (observed in process list)
  • No LSP-related errors in ~/.claude/daemon.log
  • Wrapper script test confirmed metals binary works when invoked directly

Comparison with Working LSP

The only LSP that works is rust-analyzer, which:

  1. Has a plugin directory structure at ~/.claude/plugins/cache/claude-plugins-official/rust-analyzer-lsp/
  2. Is enabled in settings: "enabledPlugins": {"rust-analyzer-lsp@claude-plugins-official": true}
  3. Has the same structure in settings.json lsp.servers section

This suggests custom LSP configurations might require plugin infrastructure, or there's a registration step missing for non-plugin LSP servers.

Questions

  1. Are custom LSP server configurations in settings.json supposed to work without plugin infrastructure?
  2. Is there a registration or initialization step required beyond adding to lsp.servers?
  3. Are there any logs that would show why the LSP configuration isn't being loaded?

Impact

Users cannot add custom LSP servers (like metals, kotlin-lsp, etc.) using only settings.json configuration, limiting LSP support to pre-packaged plugins.

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗