Giter Site home page Giter Site logo

mapomagpie / helix-gpt Goto Github PK

View Code? Open in Web Editor NEW

This project forked from leona/helix-gpt

0.0 0.0 0.0 51.86 MB

Code assistant language server for Helix with support for Copilot/OpenAI/Codeium/Ollama

License: MIT License

TypeScript 97.46% Dockerfile 2.54%

helix-gpt's Introduction

helix-gpt

Build Status Github Release

Code assistant language server for Helix with support for Copilot/OpenAI/Codeium.

Completion example

helix-gpt example

Code actions example (space + a)

helix-gpt example

Available code actions: resolveDiagnostics generateDocs improveCode refactorFromComment writeTest

How?

When a trigger character is pressed it will request a completion and use the entire file as context. Default triggers characters: ["{", "(", " "] can be overwritten with --triggerCharacters "{||(|| "

Use ctrl+x to manually trigger completions, and space+a to trigger code actions that only use the selected code as context.

Install

This was made to run with Bun, but you can also use a precompiled binary.

Without Bun

wget https://github.com/leona/helix-gpt/releases/download/0.31/helix-gpt-0.31-x86_64-linux.tar.gz \
-O /tmp/helix-gpt.tar.gz \
&& tar -zxvf /tmp/helix-gpt.tar.gz \
&& mv helix-gpt-0.31-x86_64-linux /usr/bin/helix-gpt \
&& chmod +x /usr/bin/helix-gpt

With Bun (tested with 1.0.25)

wget https://github.com/leona/helix-gpt/releases/download/0.31/helix-gpt-0.31.js -O /usr/bin/helix-gpt

Configuration

You can configure helix-gpt by exposing either the environment variables below, or by passing the command line options directly to helix-gpt in the Helix configuration step.

All configuration options

NOTE: Copilot is the best choice due to the model and implementation.

Environment Variables

OPENAI_API_KEY=123 # Required if using openai handler
COPILOT_API_KEY=123 # Required if using copilot handler
CODEIUM_API_KEY=123 # Not required, will use public API key otherwise.
HANDLER=openai # openai/copilot/codeium

Command Line Arguments

(Add to command = "helix-gpt" in Helix configuration)

--handler openai --openaiKey 123

You can also use:

helix-gpt --authCopilot

To fetch your Copilot token.

Helix Configuration

Example for TypeScript .helix/languages.toml tested with Helix 23.10 (older versions may not support multiple LSPs)

[language-server.gpt]
command = "helix-gpt"

[language-server.ts]
command = "typescript-language-server"
args = ["--stdio"]
language-id = "javascript"

[[language]]
name = "typescript"
language-servers = [
    "ts",
    "gpt"
]

In case you opt out of the precompiled binary, modify as follows:

[language-server.gpt]
command = "bun"
args = ["run", "/app/helix-gpt.js"]

All Done

If there are any issues, refer to the helix-gpt and Helix log files:

tail -f /root/.cache/helix/helix.log
tail -f /app/helix-gpt.log # Or wherever you set --logFile to

Special Thanks

  • rsc1975 for their Bun Dockerfile.

Todo

  • Copilot support
  • Resolve diagnostics code action
  • Self-hosted model support (partial support if they are openai compliant)
  • Inline completion provider (pending support from Helix)
  • Single config for all languages (pending #9318)
  • Support workspace commands to toggle functionality (pending Helix support for merging workspace commands)
  • Increase test coverage
  • Async load completions to show other language server results immediately (pending Helix support)
  • Improve recovery from errors as it can leave the editor unusable sometimes

helix-gpt's People

Contributors

leona avatar sigmasd avatar mapomagpie avatar silvercoder avatar kyfanc avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.