Skip to content

Conversation

@neriousy
Copy link
Contributor

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

@neriousy neriousy changed the title Fix/clangd hang fix fix: clangd hanging fixed Oct 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: sometimes clangd lsp hangs

1 participant