[FEATURE]: Disable LSP for external directories #4377

Open
opened 2026-02-16 17:43:36 -05:00 by yindo · 1 comment
Owner

Originally created by @guillemus on GitHub (Jan 7, 2026).

Originally assigned to: @thdxr on GitHub.

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

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)
Originally created by @guillemus on GitHub (Jan 7, 2026). Originally assigned to: @thdxr on GitHub. ### 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:** ```json { "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)
Author
Owner

@rekram1-node commented on GitHub (Jan 7, 2026):

Ah interesting...

@rekram1-node commented on GitHub (Jan 7, 2026): Ah interesting...
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#4377