void/CONTRIBUTING.md

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

196 lines
7.7 KiB
Markdown
Raw Normal View History

2024-09-11 02:37:36 +00:00
2024-09-11 08:48:40 +00:00
# Contributing to Void
2024-09-11 03:55:03 +00:00
Welcome! 👋 This is a guide on how to contribute to Void. We want to make it as easy as possible to contribute, so if you have any questions or comments, reach out via email or discord!
2024-09-11 03:55:03 +00:00
There are two main ways to contribute:
2024-09-11 03:55:03 +00:00
2024-09-12 04:25:30 +00:00
- Suggest New Features (discord)
2024-09-12 04:26:19 +00:00
- Build New Features (roadmap)
2024-09-11 03:55:03 +00:00
2024-09-11 08:48:13 +00:00
2024-09-11 08:38:54 +00:00
See the [Roadmap](#roadmap) section for a list of the most important features to build, or feel free to build your own features.
2024-09-11 08:29:06 +00:00
We use a [VSCode extension](https://code.visualstudio.com/api/get-started/your-first-extension) to implement most of Void's functionality. Scroll down to see 1. How to contribute to the Extension, or 2. How to contribute to the full IDE (for more native changes).
2024-09-11 03:55:03 +00:00
2024-09-11 08:21:55 +00:00
## Roadmap
2024-09-11 03:55:03 +00:00
2024-09-11 08:39:15 +00:00
Here are the most important topics on our Roadmap. More ⭐'s = more important.
2024-09-11 03:55:03 +00:00
## ⭐⭐⭐ Improve diffs.
2024-09-11 08:38:54 +00:00
2024-09-12 04:17:49 +00:00
We define a "diff" as a single green/red pair that denotes a change. Here are improvements to make:
2024-09-11 03:55:03 +00:00
2024-09-12 15:39:16 +00:00
1. Show deletion (-) diffs. Right now we're only showing insertion (+) diffs. Diffs currently work by highlighting all of the new code in green with a simple text decoration. Instead, we would like to use code from VS Code's native diffEditor to show the diffs ("inline" mode). We could alternatively keep what we have and add red zones of the deleted code to indicate a deletion diff (-).
2024-09-11 03:55:03 +00:00
2024-09-13 18:04:26 +00:00
2. Fix bugginess when the user presses "Accept" or "Reject" on a diff. One issue is that when a diff is accepted/rejected all of the diffs below should be updated (because they are now on different line numbers). There are other miscellaneous issues too.
2024-09-12 15:39:16 +00:00
2024-09-13 18:04:26 +00:00
3. Make diff highlighting dynamic. Right now when the user edits text, all of the diffs and their highlights are cleared. Instead, we should update the highlighting of the diff. Each diff lives on a range of lines, and all changes inside that range or intersecting with it should update its highlighting.
2024-09-11 03:55:03 +00:00
2024-09-11 08:38:54 +00:00
## ⭐⭐⭐ Build Cursor-style quick edits (ctrl+k).
2024-09-11 08:38:54 +00:00
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.
2024-09-12 04:17:49 +00:00
## ⭐⭐⭐ Make History work well.
When the user submits a response or presses the apply/accept/reject button, we should add these events to the history, allowing the user to undo/redo them. Right now there is unexpected behavior if the user tries to undo or redo their changes.
2024-09-11 08:38:54 +00:00
## ⭐⭐⭐ Improve Ctrl+L backend.
2024-09-11 06:11:55 +00:00
2024-09-12 04:17:49 +00:00
Right now, the model outputs entire files. Instead, we should change the prompt so that the model outputs partial changes like `// ... rest of file`. When the user clicks the "Apply" button, the model should rewrite the file and apply the partial changes in the correct locations.
2024-09-11 06:11:55 +00:00
## ⭐⭐ Integrate with Ollama.
2024-09-11 03:55:03 +00:00
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 Void's extension so that it runs natively into the VS Code editor so that we can access Node.js.
2024-09-11 03:55:03 +00:00
2024-09-11 08:38:54 +00:00
## ⭐ One-stars.
2024-09-11 03:55:03 +00:00
2024-09-11 08:41:07 +00:00
⭐ When user presses ctrl+L it should clear the sidebar's state.
2024-09-11 03:55:03 +00:00
2024-09-11 08:38:54 +00:00
⭐ Let the user accept / reject all Diffs in an entire file via the sidebar.
2024-09-11 03:55:03 +00:00
2024-09-11 08:21:55 +00:00
⭐ Allow the user to make multiple selections of code or files at once.
2024-09-11 03:55:03 +00:00
2024-09-11 08:21:55 +00:00
⭐ Allow user to X out of their current selection.
2024-09-11 03:55:03 +00:00
2024-09-11 13:27:22 +00:00
## ⭐⭐⭐⭐ Four-stars (creative).
2024-09-12 04:19:46 +00:00
Feel free to build AI features beyond the standard Cursor ones. For example, creating better code search, or supporting AI agents that can edit across files and make multiple LLM calls.
2024-09-12 04:17:49 +00:00
2024-09-13 18:07:15 +00:00
Eventually, we want to build a convenient API for creating AI tools. The API will provide methods for creating the UI of your tool (showing an autocomplete suggestion, or creating a new diff), detecting event changes (like `onKeystroke` or `onFileOpen`), and modifying the user's file-system (storing indexes associated with each file), making it much easier to make your own AI plugin.
2024-09-12 05:56:01 +00:00
2024-09-11 03:55:03 +00:00
2024-09-11 08:21:55 +00:00
## 1. Contributing to the Extension
Here's how you can start contributing to the Extension:
2024-09-11 03:55:03 +00:00
2024-09-11 08:21:55 +00:00
1. Clone the repository
2024-09-11 03:55:03 +00:00
`git clone https://github.com/voideditor/void`
2024-09-11 03:55:03 +00:00
2024-09-11 08:21:55 +00:00
2. Open the extension folder
2024-09-11 03:55:03 +00:00
`cd /extensions/void`
2024-09-11 03:55:03 +00:00
2024-09-11 08:21:55 +00:00
3. Install dependencies
2024-09-11 03:55:03 +00:00
2024-09-11 08:21:55 +00:00
`npm run install`
2024-09-11 03:55:03 +00:00
2024-09-11 08:21:55 +00:00
4. Build the project
2024-09-11 03:55:03 +00:00
2024-09-11 08:21:55 +00:00
`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/`.
2024-09-11 03:55:03 +00:00
2024-09-11 08:21:55 +00:00
5. Run the project
2024-09-11 03:55:03 +00:00
2024-09-11 08:21:55 +00:00
Press <kbd>F5</kbd>. This will start a new instance of VS Code with the extension enabled. If this does not work, you can press <kbd>F1</kbd>, select "Debug: Start Debugging", press <kbd>Enter</kbd>, and select "VS Code Extension Development".
2024-09-11 03:55:03 +00:00
If you would like to use AI features, you need to provide an API key. You can do that by going to Settings (<kbd>Ctrl+,</kbd>) and modifying `void > "Anthropic Api Key"`. The "Which API" environment variable controls the provider and defaults to "anthropic".
2024-09-11 03:55:03 +00:00
2024-09-11 08:21:55 +00:00
## 2. Contributing to the full IDE
2024-09-11 03:55:03 +00:00
2024-09-11 08:21:55 +00:00
Beyond the extension, we sometimes edit the IDE when we need to access more functionality. If you want to make a change to the IDE, please follow the steps below, or see VS Code's full [how to contribute](https://github.com/microsoft/vscode/wiki/How-to-Contribute) page.
2024-09-11 03:55:03 +00:00
2024-09-11 08:21:55 +00:00
1. Install all dependencies by running `yarn`.
2024-09-11 03:55:03 +00:00
2024-09-11 08:21:55 +00:00
2. Press <kbd>Ctrl+Shift+B</kbd> to start the build process - this can take some time.
2024-09-11 03:55:03 +00:00
2024-09-11 08:21:55 +00:00
3. Run `./scripts/code.sh` to open up the built IDE. To see new changes without restarting the build, use <kbd>Ctrl+Shift+P</kbd> and run "Reload Window".
2024-09-11 03:55:03 +00:00
2024-09-11 08:21:55 +00:00
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)
2024-09-11 03:55:03 +00:00
2024-09-11 08:21:55 +00:00
If you're on Windows, we recommend running the project inside a dev container. VSCode should prompt you to do this automatically.
2024-09-11 03:55:03 +00:00
2024-09-11 06:20:44 +00:00
2024-09-11 08:21:55 +00:00
# Submitting a Pull Request
2024-09-11 06:20:44 +00:00
2024-09-11 08:21:55 +00:00
When you've made changes and want to submit them, please submit a pull request.
2024-09-11 06:20:44 +00:00
2024-09-11 08:21:55 +00:00
Please submit all Pull Requests to the `dev` branch.
2024-09-11 06:20:44 +00:00
2024-09-11 03:55:03 +00:00
<!--
TODO we should probably just delete all this... :
2024-09-11 03:55:03 +00:00
### Design principles
- Least amount of eye movement necessary; if user presses submit, show them the message where they submitted
### Ctrl+L (chat)
### Ctrl+K (inline edits)
- Create a new input box that takes in the user's description.
- Make it appear above each.
- The input box should appear directly above the code selection - this requires using a Zone widget.
### Core
- Migrate the Void extension to live natively in VS Code. There's initial work here at `void.contribution.ts`.
2024-09-11 03:55:03 +00:00
- Allow access to the VS Code extension marketplace.
- Re-write the whole file when the user clicks "Apply" and show a gray progress indicator in the BG.
### Diffs
"Diffs" are the inline green/red highlights you see to approve or reject a change.
- Diffs are not responsive to edits right now. To make them responsive, we need to update all Diffs' ranges every time there's a change.
- Right now Diffs are only shown in green as a simple text decoration. We'd like to have them work better by using code from VS Code's native diffEditor ("inline" mode).
- **Events:** On many types of events, we should reject all the current Diffs (user submits a new chat message, clicks Apply, etc).
### Ollama
- Ollama doesn't work now because its JS library depends on Node.js and uses imports like 'path', 'os', while extensions must be able to run in the browser. When we migrate the extension into the VS Code codebase, we'll be able to access Node.js and will uncomment the Ollama integration.
### Greptile
- Ideally we'd auto-detect -->