helix-gpt: [BUG] failed to initialize language server: request 0 timed out

device info Apple M2 Pro

helix-editor version helix 23.10 (1d1806c8)

helix-gpt version 0.31

Describe the bug The initialization request from Helix times out when opening a file for which helix-gpt is configured to run. helix-gpt waits in src/models/lsp.ts in line 207 for Chunks from. Bun.stdin.stream() but nothing ever arrives. I checked this by logging the chunkText.

If I start helix-gpt manually with

echo "Hello Helix-GPT" | bun run /Users/xaver.himmelsbach/Development/helix-gpt/src/app.ts --logFile /Users/xaver.himmelsbach/gpt.log

the input is read from stdin:

APP 2024-03-19T16:45:21.209Z --> triggerCharacters: | ["{","("," "]

APP 2024-03-19T16:45:21.213Z --> Hello Helix-GPT

APP 2024-03-19T16:45:21.214Z --> failed to parse line:| failed to parse | Hello Helix-GPT

helix-gpt logs Most of the time, helix-gpt justs prints the triggerCharacters and receives nothing more. Sometimes, when repeatedly executing :lsp-restart in Helix, an initialization request comes through, but that still doesn’t seem to be handled correctly.

These logs show the request showing up after repeatedly calling :lsp-restart:

APP 2024-03-19T16:48:07.090Z --> triggerCharacters: | ["{","("," "]

APP 2024-03-19T16:49:41.674Z --> triggerCharacters: | ["{","("," "]

APP 2024-03-19T16:50:33.410Z --> triggerCharacters: | ["{","("," "]

APP 2024-03-19T16:51:46.195Z --> triggerCharacters: | ["{","("," "]

APP 2024-03-19T16:51:49.266Z --> Content-Length: 2016

{"jsonrpc":"2.0","method":"initialize","params":{"capabilities":{"general":{"positionEncodings":["utf-8","utf-32","utf-16"]},"textDocument":{"codeAction":{"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}},"dataSupport":true,"disabledSupport":true,"isPreferredSupport":true,"resolveSupport":{"properties":["edit","command"]}},"completion":{"completionItem":{"deprecatedSupport":true,"insertReplaceSupport":true,"resolveSupport":{"properties":["documentation","detail","additionalTextEdits"]},"snippetSupport":true,"tagSupport":{"valueSet":[1]}},"completionItemKind":{}},"hover":{"contentFormat":["markdown"]},"inlayHint":{"dynamicRegistration":false},"publishDiagnostics":{"tagSupport":{"valueSet":[1,2]},"versionSupport":true},"rename":{"dynamicRegistration":false,"honorsChangeAnnotations":false,"prepareSupport":true},"signatureHelp":{"signatureInformation":{"activeParameterSupport":true,"documentationFormat":["markdown"],"parameterInformation":{"labelOffsetSupport":true}}}},"window":{"workDoneProgress":true},"workspace":{"applyEdit":true,"configuration":true,"didChangeConfiguration":{"dynamicRegistration":false},"didChangeWatchedFiles":{"dynamicRegistration":true,"relativePatternSupport":false},"executeCommand":{"dynamicRegistration":false},"fileOperations":{"didRename":true,"willRename":true},"inlayHint":{"refreshSupport":false},"symbol":{"dynamicRegistration":false},"workspaceEdit":{"documentChanges":true,"failureHandling":"abort","normalizesLineEndings":false,"resourceOperations":["create","rename","delete"]},"workspaceFolders":true}},"clientInfo":{"name":"helix","version":"23.10 (1d1806c8)"},"processId":23053,"rootPath":"/Users/xaver.himmelsbach/Development/cruise-cruised","rootUri":"file:///Users/xaver.himmelsbach/Development/cruise-cruised","workspaceFolders":[{"name":"cruise-cruised","uri":"file:///Users/xaver.himmelsbach/Development/cruise-cruised"}]},"id":0}

APP 2024-03-19T16:51:49.267Z --> received request: | {"jsonrpc":"2.0","method":"initialize","params":{"capabilities":{"general":{"positionEncodings":["utf-8","utf-32","utf-16"]},"textDocument":{"codeAction":{"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}},"dataSupport":true,"disabledSupport":true,"isPreferredSupport":true,"resolveSupport":{"properties":["edit","command"]}},"completion":{"completionItem":{"deprecatedSupport":true,"insertReplaceSupport":true,"resolveSupport":{"properties":["documentation","detail","additionalTextEdits"]},"snippetSupport":true,"tagSupport":{"valueSet":[1]}},"completionItemKind":{}},"hover":{"contentFormat":["markdown"]},"inlayHint":{"dynamicRegistration":false},"publishDiagnostics":{"tagSupport":{"valueSet":[1,2]},"versionSupport":true},"rename":{"dynamicRegistration":false,"honorsChangeAnnotations":false,"prepareSupport":true},"signatureHelp":{"signatureInformation":{"activeParameterSupport":true,"documentationFormat":["markdown"],"parameterInformation":{"labelOffsetSupport":true}}}},"window":{"workDoneProgress":true},"workspace":{"applyEdit":true,"configuration":true,"didChangeConfiguration":{"dynamicRegistration":false},"didChangeWatchedFiles":{"dynamicRegistration":true,"relativePatternSupport":false},"executeCommand":{"dynamicRegistration":false},"fileOperations":{"didRename":true,"willRename":true},"inlayHint":{"refreshSupport":false},"symbol":{"dynamicRegistration":false},"workspaceEdit":{"documentChanges":true,"failureHandling":"abort","normalizesLineEndings":false,"resourceOperations":["create","rename","delete"]},"workspaceFolders":true}},"clientInfo":{"name":"helix","version":"23.10 (1d1806c8)"},"processId":23053,"rootPath":"/Users/xaver.himmelsbach/Development/cruise-cruised","rootUri":"file:///Users/xaver.himmelsbach/Development/cruise-cruised","workspaceFolders":[{"name":"cruise-cruised","uri":"file:///Users/xaver.himmelsbach/Development/cruise-cruised"}]},"id":0}

APP 2024-03-19T16:51:49.267Z --> sent request | {"jsonrpc":"2.0","method":"initialize","id":0,"result":{"capabilities":{"codeActionProvider":true,"executeCommandProvider":{"commands":["resolveDiagnostics","generateDocs","improveCode","refactorFromComment","writeTest"]},"completionProvider":{"resolveProvider":false,"triggerCharacters":["{","("," "]},"textDocumentSync":{"change":1,"openClose":true}}}}

APP 2024-03-19T16:51:49.311Z --> triggerCharacters: | ["{","("," "]

helix logs Helix seems to send the initialization request and times out after 10 seconds (default LSP timeout). Increasing the timeout in languages.toml just led to longer waiting times.

2024-03-19T17:50:33.362 helix_lsp::transport [INFO] gpt -> {"jsonrpc":"2.0","method":"initialize","params":{"capabilities":{"general":{"positionEncodings":["utf-8","utf-32","utf-16"]},"textDocument":{"codeAction":{"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}},"dataSupport":true,"disabledSupport":true,"isPreferredSupport":true,"resolveSupport":{"properties":["edit","command"]}},"completion":{"completionItem":{"deprecatedSupport":true,"insertReplaceSupport":true,"resolveSupport":{"properties":["documentation","detail","additionalTextEdits"]},"snippetSupport":true,"tagSupport":{"valueSet":[1]}},"completionItemKind":{}},"hover":{"contentFormat":["markdown"]},"inlayHint":{"dynamicRegistration":false},"publishDiagnostics":{"tagSupport":{"valueSet":[1,2]},"versionSupport":true},"rename":{"dynamicRegistration":false,"honorsChangeAnnotations":false,"prepareSupport":true},"signatureHelp":{"signatureInformation":{"activeParameterSupport":true,"documentationFormat":["markdown"],"parameterInformation":{"labelOffsetSupport":true}}}},"window":{"workDoneProgress":true},"workspace":{"applyEdit":true,"configuration":true,"didChangeConfiguration":{"dynamicRegistration":false},"didChangeWatchedFiles":{"dynamicRegistration":true,"relativePatternSupport":false},"executeCommand":{"dynamicRegistration":false},"fileOperations":{"didRename":true,"willRename":true},"inlayHint":{"refreshSupport":false},"symbol":{"dynamicRegistration":false},"workspaceEdit":{"documentChanges":true,"failureHandling":"abort","normalizesLineEndings":false,"resourceOperations":["create","rename","delete"]},"workspaceFolders":true}},"clientInfo":{"name":"helix","version":"23.10 (1d1806c8)"},"processId":23053,"rootPath":"/Users/xaver.himmelsbach/Development/cruise-cruised","rootUri":"file:///Users/xaver.himmelsbach/Development/cruise-cruised","workspaceFolders":[{"name":"cruise-cruised","uri":"file:///Users/xaver.himmelsbach/Development/cruise-cruised"}]},"id":0}
2024-03-19T17:50:53.365 helix_lsp [ERROR] failed to initialize language server: request 0 timed out

About this issue

  • Original URL
  • State: open
  • Created 3 months ago
  • Reactions: 1
  • Comments: 24 (8 by maintainers)

Commits related to this issue

Most upvoted comments

I updated the usage instruction to make it simpler

**Usage:**

The fork have tags that follows upstream but with `-deno` suffix, for example `0.31-deno`

To run with deno


deno run --allow-env --allow-net https://raw.githubusercontent.com/sigmaSd/helix-gpt/0.31-deno/src/app.ts  --handler codeium` # make sure to use the latest deno tag


To compile to a standalone executable


deno compile --output helix-gpt --no-check --allow-env --allow-net https://raw.githubusercontent.com/sigmaSd/helix-gpt/0.31-deno/src/app.ts # make sure to use the latest deno tag

[language-server.gpt]
command = "deno"
args = ["run", "--allow-net","--allow-env", "https://raw.githubusercontent.com/sigmaSd/helix-gpt/0.31-deno/src/app.ts"]
# HANDLER can be set to openai/copilot/codeium
environment = { HANDLER= "codeium" }

Hi, this is such an awesome project. Makes helix so much better. The nix package is also giving me this issue. Would be great if @leona could give an idea of whether we should use the fork or if there is another option. The fork with deno is working for me in the interim.

I think this issue should stay open for visibility while there’s no warning on the README Thank you @sigmaSd

EDIT: what are version 0.30 and 0.31? there’s no release logs and no changes in files as far as I can see

EDIT2: @justinlovinger

I resolved this issue by going back to version 0.28. I had no luck running 0.28 either, not sure what I’m doing wrong at this point.

Its a bug in bun, either use an old version, or use my deno fork https://github.com/sigmaSd/helix-gpt

Obviously the best thing is to find whats the issue exactly to report it to the bun devs

I am getting the same issue on NixOS using Codeium.