opencode icon indicating copy to clipboard operation
opencode copied to clipboard

[FEATURE]: Allow configurable timeouts to be set on LSPs

Open tjg184 opened this issue 5 days ago • 0 comments

Feature hasn't been suggested before.

  • [x] I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Some LSPs take longer to initialize. Currently, opencode has a default of 45 seconds, which is generally long enough, but not for all projects.

As an example, projects that have a high number of dependencies that need to be downloaded may take longer than the default timeout. I've seen this as an example with the kotlin-ls LSP.

This is the suggestion to either allow the global timeout to be configured beyond the 45 seconds or allow a specific LSP to be configured to override the default. Alternatively, we could just bump the 45 seconds to a higher value, but I suspect this will be an ongoing problem.

If we decide on the per-server timeout, I think it makes sense to allow an override on a built-in LSP server as well as a custom server.

I started a PR here to see what it might look like, specifically for the first case. https://github.com/anomalyco/opencode/pull/6997

Overriding a specific LSP:

{
  "$schema": "https://opencode.ai/config.json",
  "instructions": ["STYLE_GUIDE.md"],
  "provider": {
    "opencode": {
      "options": {},
    },
  },
  "lsp": {
    "kotlin-ls": {
      "timeout": 120000
    },
  },
}

Overriding the default LSP timeout:

{
  "$schema": "https://opencode.ai/config.json",
  "instructions": ["STYLE_GUIDE.md"],
  "provider": {
    "opencode": {
      "options": {},
    },
  },
  "lsp": {
      "timeout": 120000
  },
}

tjg184 avatar Jan 09 '26 12:01 tjg184