leona / helix-gpt

Code assistant language server for Helix with support for Copilot/OpenAI/Codeium/Ollama
MIT License
285 stars 19 forks source link

[BUG] Codeium - No chat provider for Codeium #28

Closed hakan-demirli closed 4 months ago

hakan-demirli commented 4 months ago

helix-editor version helix 23.10 (f6021dd0)

helix-gpt version 0.28

Describe the bug Codeium does not work. I haven't set any environment variables for codeium as explained in the README. Here is my languages.toml:

[language-server.gpt]
command = "helix-gpt"
args = ["--handler","codeium","--logFile","/tmp/helix-gpt.log"]

[[language]]
name = "python"
roots = ["pyproject.toml", "."]
language-servers = [ "pyright","ruff-lsp","gpt"]
auto-format = true

Steps to reproduce

Also, If you install codeium on VSCode it asks for an auth token. I suspect it is not possible to use Codeium without a token. Since, they explain that it is required to prevent abuse/spam. helix-gpt logs

APP 2024-02-17T23:54:15.358Z --> triggerCharacters: | ["{","("," "]

APP 2024-02-17T23:54:15.362Z --> 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":{"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},"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 (f6021dd0)"},"processId":98758,"rootPath":"/home/USER/Desktop/dotfiles","rootUri":"file:///home/USER/Desktop/dotfiles","workspaceFolders":[{"name":"dotfiles","uri":"file:///home/USER/Desktop/dotfiles"}]},"id":0}

APP 2024-02-17T23:54:15.362Z --> 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-02-17T23:54:15.363Z --> received request: | {"jsonrpc":"2.0","method":"initialized","params":{}}

APP 2024-02-17T23:54:15.363Z --> received didOpen | language: python

APP 2024-02-17T23:54:22.150Z --> received request: | {"jsonrpc":"2.0","method":"textDocument/codeAction","params":{"context":{"diagnostics":[],"triggerKind":1},"range":{"end":{"character":0,"line":142},"start":{"character":0,"line":134}},"textDocument":{"uri":"file:///home/USER/Desktop/dotfiles/system/scripts/python/update_wp/gtasks/main.py"}},"id":1}

APP 2024-02-17T23:54:22.151Z --> sent request | {"jsonrpc":"2.0","id":1,"result":[{"title":"Resolve diagnostics","kind":"quickfix","diagnostics":[],"command":{"title":"Resolve diagnostics","command":"resolveDiagnostics","arguments":[{"range":{"end":{"character":0,"line":142},"start":{"character":0,"line":134}},"query":"Resolve the diagnostics for this code.","diagnostics":[]}]}},{"title":"Generate documentation","kind":"quickfix","diagnostics":[],"command":{"title":"Generate documentation","command":"generateDocs","arguments":[{"range":{"end":{"character":0,"line":142},"start":{"character":0,"line":134}},"query":"Add documentation to this code.","diagnostics":[]}]}},{"title":"Improve code","kind":"quickfix","diagnostics":[],"command":{"title":"Improve code","command":"improveCode","arguments":[{"range":{"end":{"character":0,"line":142},"start":{"character":0,"line":134}},"query":"Improve this code.","diagnostics":[]}]}},{"title":"Refactor code from a comment","kind":"quickfix","diagnostics":[],"command":{"title":"Refactor code from a comment","command":"refactorFromComment","arguments":[{"range":{"end":{"character":0,"line":142},"start":{"character":0,"line":134}},"query":"Refactor this code based on the comment.","diagnostics":[]}]}},{"title":"Write a unit test","kind":"quickfix","diagnostics":[],"command":{"title":"Write a unit test","command":"writeTest","arguments":[{"range":{"end":{"character":0,"line":142},"start":{"character":0,"line":134}},"query":"Write a unit test for this code. Do not include any imports.","diagnostics":[]}]}}]}

APP 2024-02-17T23:54:23.409Z --> received request: | {"jsonrpc":"2.0","method":"workspace/executeCommand","params":{"arguments":[{"diagnostics":[],"query":"Improve this code.","range":{"end":{"character":0,"line":142},"start":{"character":0,"line":134}}}],"command":"improveCode"},"id":2}

APP 2024-02-17T23:54:23.409Z --> sending diagnostics | [{"message":"Executing improveCode...","range":{"end":{"character":0,"line":142},"start":{"character":0,"line":134}},"severity":3}]

APP 2024-02-17T23:54:23.409Z --> sent request | {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///home/USER/Desktop/dotfiles/system/scripts/python/update_wp/gtasks/main.py","diagnostics":[{"message":"Executing improveCode...","range":{"end":{"character":0,"line":142},"start":{"character":0,"line":134}},"severity":3,"source":"helix-gpt"}]}}

APP 2024-02-17T23:54:23.410Z --> getting content from range | {"end":{"character":0,"line":142},"start":{"character":0,"line":134}} | uri: file:///home/USER/Desktop/dotfiles/system/scripts/python/update_wp/gtasks/main.py | current buffers: ["file:///home/USER/Desktop/dotfiles/system/scripts/python/update_wp/gtasks/main.py"]

APP 2024-02-17T23:54:23.410Z --> chat request content: | 
def insert_newlines(text, line_length=33, offset=0):
    lines = textwrap.wrap(text, line_length, break_long_words=False)
    if len(lines) > 1:
        indented_lines = [lines[0]] + [(offset * " ") + line for line in lines[1:]]
        return "\n".join(indented_lines)
    else:
        return text

APP 2024-02-17T23:54:23.410Z --> codeium | chat request | ["Improve this code.","\ndef insert_newlines(text, line_length=33, offset=0):\n    lines = textwrap.wrap(text, line_length, break_long_words=False)\n    if len(lines) > 1:\n        indented_lines = [lines[0]] + [(offset * \" \") + line for line in lines[1:]]\n        return \"\\n\".join(indented_lines)\n    else:\n        return text","file:///home/USER/Desktop/dotfiles/system/scripts/python/update_wp/gtasks/main.py","python"]

APP 2024-02-17T23:54:23.410Z --> No chat provider for: codeium

APP 2024-02-17T23:54:23.411Z --> chat failed | No chat provider for: codeium

APP 2024-02-17T23:54:23.411Z --> sending diagnostics | [{"message":"No chat provider for: codeium","severity":1,"range":{"end":{"character":0,"line":142},"start":{"character":0,"line":134}}}]

APP 2024-02-17T23:54:23.411Z --> sent request | {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///home/USER/Desktop/dotfiles/system/scripts/python/update_wp/gtasks/main.py","diagnostics":[{"message":"No chat provider for: codeium","severity":1,"range":{"end":{"character":0,"line":142},"start":{"character":0,"line":134}},"source":"helix-gpt"}]}}
leona commented 4 months ago

I've only implemented the completion events for codeium, actions/chat are not supported yet as I still need to figure out what the request is for them. Theres no docs so I'm just reading source off their GitHub.

Regarding auth, I've provided a way to authenticate with codeium using --authCodeium, but they have a default key used on their repo and website I've passed by default and it seems to work. Ideally you would use your own though.

hakan-demirli commented 4 months ago

Indeed code completion works. I will close the issue since it is not a bug. Thank you for the LSP btw.