Skip to content

OmniSharp LSP server fails to fully load a large project in the default timeout -- LSP servers need a configurable initializeTimeout #1392

@DrEsteban

Description

@DrEsteban

Describe the bug

I have a very large C# solution, and I'm trying to use the OmniSharp LSP via the lsp-config.json so the model can do language-aware analysis.

However, I keep seeing error messages like this every time the model tries to invoke the language server:
Error: LSP csharp server for <filepath>:: Server initialize timed out after 60000ms. The language server may need more time for initial project analysis.

The model then attempts to do things like "sleep for 1-2 minutes, try again", but it seems every time the model goes to invoke OmniSharp a new process is launched, which puts me right back into the broken loop because the new process must load the solution all over again... (I now have 6 instances of the OmniSharp process sitting at 2GB of memory usage 😄)

It seems we need 1 of 2 things here:

  1. A configurable initializeTimeout for LSP servers, so users can account for large projects that take awhile to load.
  2. Copilot CLI needs to stop launching new instances of the Language Server for each request. If the initial request times out, wait and attempt to contact the same instance again.

Affected version

0.0.406

Steps to reproduce the behavior

  1. Install OmniSharp via choco install omnisharp
  2. Configure ~/lsp-config.json with:
    {
      "lspServers": {
        "csharp": {
          "command": "omnisharp",
          "args": ["--languageserver"],
          "fileExtensions": {
            ".cs": "csharp",
            ".csx": "csharp",
            ".sln": "csharp",
            ".csproj": "csharp",
            ".props": "csharp",
            ".targets": "csharp"
          }
        }
      }
    }
  3. Run a new session and ask Copilot to use the LSP to reason about a very large C# project.

Expected behavior

Either:

  1. Copilot CLI stops launching new processes and instead gives the original one more time to load.
  2. Copilot CLI needs a new option so users can account for long-starting LSPs when loading very large projects.

Additional context

  • Running on Windows Terminal, PowerShell Core 7.5.4
  • OmniSharp installed via choco
  • === Codebase Statistics ===
    Solutions (.sln):        1
    Projects (.csproj):     67
    C# files (.cs):       2,076
    C# lines of code:   254,733
    
    src:  1,535 files  |  156,449 lines
    test:   408 files  |   96,559 lines
    

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions