opencode icon indicating copy to clipboard operation
opencode copied to clipboard

[FEATURE]: Disable LSP for external directories

Open guillemus opened this issue 1 week ago • 1 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

Problem:

When agents (primary or subagents) explore external directories—such as cloned repos for reading documentation—OpenCode spawns LSP servers for those directories. This causes:

  • Long startup times (30+ seconds for large TypeScript monorepos or Java/JDTLS projects)
  • Wasted CPU/memory for LSP that provides no value
  • No benefit—when exploring external code for context, diagnostics aren't used

Use case:

Clone a library's repo to let the LLM search its docs/source. Only need file reading—LSP is unnecessary and harmful due to startup overhead.

Proposed solution:

{
  "lsp": {
    "external_directories": false
  }
}

Current workarounds (insufficient):

  • "lsp": false — Disables LSP entirely, including main project
  • Per-LSP "disabled": true — Too broad, affects all directories

Related issues (not duplicates):

  • #6692 — Runtime LSP toggle (addresses LLM attention drift, not external dir spawning)
  • #7184 — Share LSP with IDE (reuse existing LSP, not prevent spawning)
  • #6997 — LSP timeout config (doesn't prevent unnecessary spawning)

guillemus avatar Jan 07 '26 16:01 guillemus