6.8 KiB
Contributing to LineMage
This is a guide on how to contribute to LineMage. We want to make it as easy to contribute as possible, so if you have any questions or comments please reach out via email or discord.
LineMage is a fork of the of vscode repository.
Ways to Contribute
1. Getting started with the Extension
We use a VS Code extension to implement most of LineMage's functionality. Here's how you can start contributing to the extension:
- Clone the repository
git clone https://github.com/linemagedev/linemage
- Open the extension folder
cd /extensions/linemage
- Install dependencies
npm run install
- Build the project
npm run build. Note: We made this build command to run React in vscode. It converts sidebar/index.tsx into a CSS/JS bundle in dist/.
- Run the project
Press F5. This will start a new instance of VS Code with the extension enabled. If this does not work, you can press F1, select "Debug: Start Debugging", press Enter, and select "VS Code Extension Development".
If you would like to use AI features, you need to provide an API key. You can do that by going to Settings (Ctrl+,) and modifying linemage > "Anthropic Api Key". The "Which API" environment variable controls the provider and defaults to "anthropic".
2. Editing the IDE
Beyond the extension, we edit parts of the IDE in cases where we need more functionality. If you want to make a change to the IDE please follow these instructions, or see VS Code's (pretty overwhelming) how to contribute page.
-
Install all dependencies by running
yarn. -
Press Ctrl+Shift+B to start the build process - this can take some time.
-
Run
./scripts/code.shto open up the built IDE. To see new changes without restarting the build, use Ctrl+Shift+P and run "Reload Window".
To bundle the IDE, run yarn gulp vscode-win32-x64. Here are the full options: vscode-{win32-ia32 | win32-x64 | darwin-x64 | darwin-arm64 | linux-ia32 | linux-x64 | linux-arm}(-min)
If you're on Windows, we recommend running the project inside a dev container.
Submitting a pull request
When you've made changes and want to submit them, please submit a pull request.
What to work on
Here are the most important topics we think you can contribute.
Feel free to contribute anything you like.
Full list here
More ⭐'s = more important.
⭐⭐⭐ Add LineMage changes to the history. When the user submits a response, or presses the apply/accept/reject buttons, we should add these events to the history and allow the user to use undo/redo on them. Right now there is unexpected behavior if the user tries to undo or redo their changes related to LineMage.
⭐⭐⭐ Improve diffs. We define a "diff" as a single green/red codeblock that denotes a change. Here are improvements to make:
-
Show deletion (-) diffs. Right now we're only showing insertion (+) diffs. We do this by highlighting all of the new code in green using a simple text decoration. We would like to instead use code from VS Code's native diffEditor to show the diffs ("inline" mode). We could also keep what we have and add red boxes of the deletions inline with the code.
-
Make diffs responsive to edits. When a user accepts a diff, all of the diffs below it should be updated (because they are now on different line numbers). We're not doing this, so there is a lot of unexpected behavior. We should the Diffs' ranges every time there's a change.
-
Implement "Diff Range". When the user makes a change (either in ctrl+k or ctrl+L) we should track the range that they changed (the "Diff Range"). All changes made inside of this range should appear as a diff. The range should disappear when all of the diffs inside of it have either been accepted or rejected.
⭐⭐⭐ Build Cursor-style quick edits (ctrl+k). When the user presses ctrl+k, an input box should appear inline with the code that they were selecting. This is somewhat difficult to do because an extension alone cannot do this, and it requires creating a new component in the IDE. We think you can modify vscode's built-in "codelens" or "zone widget" components, but we are open to alternatives.
⭐⭐⭐ Improve ctrl+L. One improvement is to make the model output diffs, instead of outputting the entire file. When the user clicks "apply" on a diff, the model should go through the entire file and apply the diff in the correct location.
⭐⭐ Integrate with Ollama. We have an Ollama integration coded up in the extension, but it breaks. This is because Ollama has Node.js dependencies like 'path' and 'os' which cannot run in extensions (extensions have to be able to run in the browser). To fix this, we need to migrate LineMage's extension so that it runs natively into the VS Code editor so that we can access Node.js.
⭐ When user presses ctrl+l it should reset from last time.
⭐ Let the user accept / reject all Diffs in an entire file.
⭐ Allow the user to make multiple selections of code or files at once.
⭐ Allow user to X out of their current selection.
Links
- TODO list