Skip to content

Cannot start rust-analyzer LSP at project-level #1323

@heaths

Description

@heaths

Describe the bug

When configured in .github/lsp.json, /lsp test rust-analyzer does not work with the following content:

{
  "lspServers": {
    "rust-analyzer": {
      "command": "rust-analyzer",
      "args": [
        "--stdio"
      ],
      "fileExtensions": {
        ".rs": "rust"
      },
      "initializationOptions": {
        "cargo": {
          "buildScripts": {
            "enable": true
          },
          "allFeatures": true
        },
        "procMacro": {
          "enable": true
        },
        "checkOnSave": {
          "command": "clippy"
        }
      }
    }
  }
}

I've tried /lsp reload, exiting and resuming the session or even starting a new one. /lsp show was showing it configured, but /lsp test rust-analyzer always erred with:

Server "rust-analyzer" not found. Available: (none)

I tried asking copilot several times. At one point it even moved the file to .copilot/lsp.json, which isn't documented.

It wasn't until it tried adding it to ~/.copilot/lsp-config.json with the following content that rust-analyzer started correctly:

{
  "lspServers": {
    "rust-analyzer": {
      "command": "rust-analyzer",
      "args": ["--stdio"],
      "fileExtensions": {
        ".rs": "rust"
      }
    }
  }
}

rust-analyzer is in my $PATH in ~/.cargo/bin.

Affected version

0.0.405

Steps to reproduce the behavior

  1. Ask Copilot to add rust-analyzer to .github/lsp.json. This mostly worked. Initially it didn't add the --stdio argument but did eventually when it tried to figure out what was wrong. See my .github/lsp.json config above for what the final JSON was.
  2. Run /lsp reload or /exit and restart (resume or start anew).
  3. Run /lsp test rust-analyzer.

Even when which rust-analyzer returns the right path, copilot errs:

Server "rust-analyzer" not found. Available: (none)

Expected behavior

/lsp test rust-analyzer works with .github/lsp.json project-based configuration.

Additional context

  • macOS 26.2
  • bash 5.3.9
  • rust-analyzer 1.95.0-nightly

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:toolsBuilt-in tools: file editing, shell, search, LSP, git, and tool call behavior

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions