Skip to content

Bug: LANGUAGE_EXTENSIONS map has bare makefile key and is missing common extensions #15859

Closed as not planned

Description

@saurav61091

Description

The LANGUAGE_EXTENSIONS map in packages/opencode/src/lsp/language.ts has two problems:

  1. Bare makefile key (bug): Line 58 has makefile: "makefile" — the only entry without a leading dot. Since path.extname() always returns dot-prefixed strings (e.g. .mk), this key never matches anything. The adjacent .makefile entry is also wrong since no files have a .makefile extension.

  2. Missing extensions: Several file extensions supported by built-in formatters (formatter.ts) are absent from the language map, meaning LSP features won't activate for those file types:

    • C/C++ headers: .h, .hpp, .hxx, .hh, .h++ (used by clang-format)
    • Python stubs: .pyi (used by ruff)
    • R uppercase: .R (used by air formatter)
    • Config/data: .toml, .jsonc (used by prettier/biome)
    • Markup: .mdx (used by prettier/biome)
    • GraphQL: .graphql, .gql (used by prettier/biome)

OpenCode version

1.2.15 (current dev branch)

Steps to reproduce

  1. Open a .h or .hpp file — LSP won't detect the language
  2. Open a .toml or .graphql file — same issue
  3. Look at language.ts line 58 — bare makefile key never matches

Operating System

Linux

Terminal

Any

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Mar 3, 2026
  2. github-actions commented on Mar 3, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    The current issue is broader (also covering the bare makefile key bug and other missing extensions), so it may make sense to reference or consolidate with that existing issue.

  3. xiong-ZH-zq commented on Mar 22, 2026

    @xiong-ZH-zq

    +1, It would be helpful if support R LSP

  4. assigned and unassigned on Apr 26, 2026
  5. removed
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  6. github-actions commented on Jul 3, 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.

  7. Bearmancer commented on Sep 13, 2026

    @Bearmancer

    Still reproducible on 1.18.30 (Windows, "lsp": true): the .jsonc entry named in this issue is still missing from LANGUAGE_EXTENSIONS, and the effect is silence, not an error.

    Mechanism

    .jsonc is absent from LANGUAGE_EXTENSIONS, so the didOpen languageId falls back to "plaintext". Biome's built-in server does list .jsonc in its extensions (so opencode routes the file to Biome), but Biome emits no diagnostics for languageId: "plaintext" — the file silently skips diagnostics.

    Source at dev:

    • packages/opencode/src/lsp/language.ts:1 — export const LANGUAGE_EXTENSIONS: Record<string, string> = {
    • packages/opencode/src/lsp/language.ts:53 — ".json": "json", — and no .jsonc key anywhere in the map
    • packages/opencode/src/lsp/client.ts:560 — const languageId = LANGUAGE_EXTENSIONS[extension] ?? "plaintext"

    Steps to reproduce

    1. Set "lsp": true in ~/.config/opencode/opencode.jsonc.
    2. Create a directory that contains a Biome root marker (e.g. package-lock.json).
    3. Write two files with identical bytes — broken.json and broken.jsonc:
    {
      "a": 1,
      "b":
    }
    1. Write each and read the tool result's <diagnostics> block.

    Expected vs actual

    Expected: both .json and .jsonc report the parse error.
    Actual: only .json reports; .jsonc produces no diagnostics for that file.

    Verbatim tool output after writing broken.json:

    LSP errors detected in this file, please fix:
    <diagnostics file="...\jsonc-bug-probe\broken.json">
    ERROR [4:1] Expected an array, an object, or a literal but instead found '}'.
    </diagnostics>
    

    Writing broken.jsonc (same bytes, same directory) produced no <diagnostics> block for it.

    Independent check that the server can parse it: the same .jsonc bytes report error[biome] (parse) at 4:0: Expected an array, an object, or a literal but instead found '}'. when routed through oh-my-openagent's own lsp_diagnostics path — so Biome handles .jsonc; only opencode's languageId is wrong.

    Proposed fix

    Add the missing entries to LANGUAGE_EXTENSIONS, at minimum:

    ".jsonc": "jsonc",

    plus the other omissions already listed in this issue (.toml, .mdx, .pyi, .h/.hpp/.hh/.hxx/.h++, .R, and the bare makefile key).


    Environment: opencode 1.18.30 · Windows · plugin oh-my-openagent 4.19.4 · verified 2026-09-13.

  8. Bearmancer commented on Sep 13, 2026

    @Bearmancer

    Environment (software)

    item value
    OS Microsoft Windows 10 Pro — 10.0.19045 (Build 19045), 64-bit
    Shell PowerShell 7.6.6 (+ Windows Terminal)
    opencode 1.18.30
    plugins oh-my-openagent 4.19.4 · @cortexkit/opencode-antigravity-auth 2.2.1
    runtimes Node v24.19.0 · npm 11.17.0 · Bun 1.4.2
    LSP binaries biome 2.5.13 · basedpyright 1.40.1 · roslyn-language-server 5.12.0-1.26426.8 · bash-language-server 5.6.0 · shellcheck 0.11.0 · vscode-langservers-extracted 4.10.0 · PowerShellEditorServices 4.7.0 · PSScriptAnalyzer 1.25.0
    logs ~/.local/share/opencode/log/opencode.log · ~/.omo/agent/OmO-debug.log · ~/.omo/agent/logs/config-reload.log

    OS facts collected with:

    Get-CimInstance Win32_OperatingSystem | Select-Object Caption,Version,BuildNumber,OSArchitecture

    No hardware, hostname, username, or credentials included.

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