Skip to content

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

@tjg184

Description

@tjg184

Feature hasn't been suggested before.

  • 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. #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
  },
}

Metadata

Metadata

Assignees

Labels

discussionUsed for feature requests, proposals, ideas, etc. Open discussion

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions