Skip to content

Commit

Permalink
local dev instructions in README under the leap directory
Browse files Browse the repository at this point in the history
  • Loading branch information
rlisahuang committed Jan 9, 2024
1 parent 1434eea commit 358fc87
Showing 1 changed file with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions src/vs/editor/contrib/leap/browser/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Leap
Leap (Live Exploration of AI-Generated Code) is a Copilot-like tool that generates code completions within the current buffer.

## How to develop Leap
All of the Leap front-end-related code is under `./src/vs/editor/contrib/leap/browser`.

There are few requirements before you could develop for Leap

1. Node JS 16.14+
2. Python 3 preferably 3.8.* or above
3. npm
4. yarn (this could be installed using npm)

Once you satisfy the requierments please follow the next steps to setup your environment

### Build and run via VS Code

1. Open up a terminal, type `arch` to ensure that you are using a x86_64 architecture (attn: mac users)
2. Type `yarn` or `yarn install` in the vscode directory
3. Then open the vscode dircetory using your own VS Code local installation (you could download it online if you don't have one installed)
4. In the `launch.json` under `.vscode` directory set the following env variables under `Launch VS Code Internal`

- You may also configure these environment variables in your shell configuration (e.g., in `~/.profile`).
- Alternatively, you may configure the variables in `./.env`, and declare in `inputs` in `.vscode/launch.json` the id's and keys of the configured variables. For example, if you have configured `PYTHON3=/usr/local/bin/python3` in `./.env`, then the `inputs` in `./vscode/launch.json` should be
```
"inputs": [
{
"id": "envPYTHON3",
"type": "command",
"command": "extension.commandvariable.file.content",
"args": {
"fileName": "${workspaceFolder}/.env",
"key": "PYTHON3",
"default": ""
}
}
]
```
and the environment variable configuration in `Launch VS Code Internal`, under `.vscode/launch.json`, should be
```
"env": {
"PYTHON3": "${input:envPYTHON3}"
}
```

5. Then press `CTRL + SHIFT + B` or `CMD + SHIFT + B` on mac and run with `Launch VS Code Internal` to build the configuration

If everything goes well you should be able run the build by pressing `F5`. Open a python file with extension .py, and you should see the projection boxes.

### Build and run via the command line
1. Open up a terminal, type `arch` to ensure that you are using a x86_64 architecture (attn: mac users)
2. Type `yarn` or `yarn install` in the vscode directory
3. Type `yarn compile` in the vscode directory to build from source
4. Configure the following environment variables in your shell configuration
```
PYTHON3: path to your python3 binary
RUNPY: absolute path to run.py under src directory
IMGSUM: absolute path to img-summary.py under src directory
LEAP_PROMPT: absolute path to implement_it.txt under src directory
OPENAI_API_KEY: your OpenAI API key
```

- Alternatively, you can also pass the environment variable bindings when executing `run.sh` (see next step)
5. Type `./run.sh` in the vscode directory to run Leap from the command line. You may additionally pass in environment variables at the beginning of the command, e.g., `OPENAI_API_KEY=my_awesome_key ./run.sh` if you want to override the variables defined in your shell profile.


## How to invoke Leap
In an opened Python file, press `CTRL + ENTER` (`CMD + ENTER` on mac) to see a side panel of code suggestions.

0 comments on commit 358fc87

Please sign in to comment.