[PR #3611] fix: clangd hanging fixed #10712

Closed
opened 2026-02-16 18:15:27 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/3611

State: closed
Merged: Yes


closes #3598

what was the problem:

  • concurrent requests tried to spawn clangd simultaneously, so the broken-set flipped true and left the workspace without a live client.
  • when clangd was missing from PATH the downloader only looked for a hard-coded .zip, so newer .tar.xz releases (or cached installs with different naming) never bootstrapped.

what's been changed:

  • guarded LSP boot with a spawning promise cache so identical server/root pairs reuse an in-flight spawn instead of racing.
  • refreshed clangd discovery to reuse binaries in ~/.local/share/opencode/bin, scan prior clangd_* extractions, and fall back to GitHub only when needed.
  • normalized release asset selection to accept either .zip or .tar.xz, reject empty downloads, and unzip/untar accordingly.
  • rewired the installer to recreate a clangd symlink after every install so the runtime always launches via a stable path regardless of the versioned folder layout.

how to check if it works:

  1. remove the clangd from your ~/.local/share/opencode/bin and path
  2. create two files main.c and math_utils.h

main.c:

// #include "math_utils.h"
#include <stdio.h>

int main() {
    int a = 5, b = 3;
    int sum = add(a, b);
    int diff = subtract(a, b);

    printf("Sum: %d\n", sum);
    printf("Diff: %d\n", diff);
    return 0;
}

math_utils.h:

#ifndef MATH_UTILS_H
#define MATH_UTILS_H

int add(int a, int b);
int subtract(int a, int b);

#endif

ask opencode to fix the main.c file
it should download the LSP and create a symlink

neriousy@FILIP:~/programming/opencode$ ls ~/.local/share/opencode/bin/
clangd  clangd_21.1.0  fzf  gopls  rg  vscode-eslint
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/3611 **State:** closed **Merged:** Yes --- closes #3598 what was the problem: - concurrent requests tried to spawn clangd simultaneously, so the broken-set flipped true and left the workspace without a live client. - when clangd was missing from PATH the downloader only looked for a hard-coded .zip, so newer .tar.xz releases (or cached installs with different naming) never bootstrapped. what's been changed: - guarded LSP boot with a spawning promise cache so identical server/root pairs reuse an in-flight spawn instead of racing. - refreshed clangd discovery to reuse binaries in `~/.local/share/opencode/bin`, scan prior clangd_* extractions, and fall back to GitHub only when needed. - normalized release asset selection to accept either .zip or .tar.xz, reject empty downloads, and unzip/untar accordingly. - rewired the installer to recreate a clangd symlink after every install so the runtime always launches via a stable path regardless of the versioned folder layout. how to check if it works: 1. remove the clangd from your `~/.local/share/opencode/bin` and path 2. create two files `main.c` and `math_utils.h` main.c: ``` // #include "math_utils.h" #include <stdio.h> int main() { int a = 5, b = 3; int sum = add(a, b); int diff = subtract(a, b); printf("Sum: %d\n", sum); printf("Diff: %d\n", diff); return 0; } ``` math_utils.h: ``` #ifndef MATH_UTILS_H #define MATH_UTILS_H int add(int a, int b); int subtract(int a, int b); #endif ``` ask opencode to fix the `main.c` file it should download the LSP and create a symlink ``` neriousy@FILIP:~/programming/opencode$ ls ~/.local/share/opencode/bin/ clangd clangd_21.1.0 fzf gopls rg vscode-eslint ```
yindo added the pull-request label 2026-02-16 18:15:27 -05:00
yindo closed this issue 2026-02-16 18:15:27 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#10712