Skip to content

[BUG] Custom LSP servers always send languageId: 'plaintext', causing servers like Godot LSP to fail #23663

Closed as not planned

Description

@RickyYCheng

Description

When using a custom LSP server (e.g., godot-lsp-bridge for GDScript), OpenCode always sends languageId: "plaintext" in the textDocument/didOpen notification, regardless of the file extension configured in lsp.extensions.

This causes language servers that rely on languageId (like Godot's LSP server) to not send diagnostics, because they only recognize their specific language ID (e.g., gdscript).

Root Cause

In packages/opencode/src/lsp/client.ts line 148:

const languageId = LANGUAGE_EXTENSIONS[extension] ?? "plaintext"

OpenCode uses a hardcoded LANGUAGE_EXTENSIONS mapping table for built-in LSP servers. For any extension not in this table (including custom LSP extensions like .gd), it falls back to "plaintext".

The lsp.*.extensions configuration is only used to match which LSP server to start, but is not used to determine the languageId sent to the server.

Plugins

oh-my-openagent
godot-lsp-bridge

OpenCode version

1.14.19

Steps to reproduce

  1. Configure a custom LSP server in opencode.jsonc:
{
  "$schema": "https://opencode.ai/config.json",
  "lsp": {
    "gdscript": {
      "command": ["godot-lsp-bridge"],
      "extensions": [".gd"]
    }
  }
}
  1. Ensure Godot Editor is running with LSP enabled (port 6005).
  2. Create a .gd file with a syntax error.
  3. Run opencode debug lsp diagnostics <file>.gd

Expected: Diagnostics are returned.
Actual: Empty diagnostics {}.

Verification

By intercepting the LSP communication, we can confirm OpenCode sends:

{
  "method": "textDocument/didOpen",
  "params": {
    "textDocument": {
      "uri": "file:///path/to/file.gd",
      "languageId": "plaintext",   // ← should be "gdscript"
      ...
    }
  }
}

When languageId is manually changed to "gdscript", Godot LSP correctly returns diagnostics.

Suggested Fix

Allow users to specify languageId in the LSP configuration, e.g.:

{
  "lsp": {
    "gdscript": {
      "command": ["godot-lsp-bridge"],
      "extensions": [".gd"],
      "languageId": "gdscript"   // <-- new field
    }
  }
}

Or derive languageId from the configured extensions mapping.

Operating System

Ubuntu (WSL2)

Terminal

Windows Terminal

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Apr 21, 2026
  2. changed the title [-]Custom LSP servers always send languageId: 'plaintext', causing servers like Godot LSP to fail[/-] [+][BUG] Custom LSP servers always send languageId: 'plaintext', causing servers like Godot LSP to fail[/+] on Apr 21, 2026
  3. removed
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  4. github-actions commented on Jul 7, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions