From f4ba68d5ce26463e6337822f8bf70e55a2d471d3 Mon Sep 17 00:00:00 2001 From: Kirill Dubovitskiy Date: Tue, 8 Aug 2023 13:42:57 -0700 Subject: Updated documentation to reflect the new fastest getting started path in VSCode --- .vscode/launch.json | 1 + CONTRIBUTING.md | 49 ++++++++++++++++++++++++++++++----------------- extension/CONTRIBUTING.md | 19 ++++++++++++++++++ extension/DEV_README.md | 31 ------------------------------ 4 files changed, 51 insertions(+), 49 deletions(-) create mode 100644 extension/CONTRIBUTING.md delete mode 100644 extension/DEV_README.md diff --git a/.vscode/launch.json b/.vscode/launch.json index 75ee1f7a..bbe1fd2e 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -44,6 +44,7 @@ "args": [ // Pass a directory to manually test in "${workspaceFolder}/extension/manual-testing-sandbox", + "${workspaceFolder}/extension/manual-testing-sandbox/example.ts", "--extensionDevelopmentPath=${workspaceFolder}/extension", ], "outFiles": [ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 50d694f4..d0ea7556 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,23 +2,25 @@ ## Table of Contents -- [❤️ Ways to Contribute](#%EF%B8%8F-ways-to-contribute) +- [Contributing to Continue](#contributing-to-continue) + - [Table of Contents](#table-of-contents) +- [❤️ Ways to Contribute](#️-ways-to-contribute) - [🐛 Report Bugs](#-report-bugs) - [✨ Suggest Enhancements](#-suggest-enhancements) - [📖 Updating / Improving Documentation](#-updating--improving-documentation) - [🧑‍💻 Contributing Code](#-contributing-code) - - [Setup Development Environment](#setting-up-the-development-environment) + - [Environment Setup](#environment-setup) - [Writing Steps](#writing-steps) - [Writing Context Providers](#writing-context-providers) -- [📐 Continue Architecture](#-continue-architecture) - - [Continue VS Code Client](#continue-vs-code-client) - - [Continue IDE Websockets Protocol](#continue-ide-websockets-protocol) - - [Continue GUI Websockets Protocol](#continue-gui-websockets-protocol) -- [❇️ Core Concepts](#%EF%B8%8F-core-concepts) - - [Step](#step) - - [Autopilot](#autopilot) - - [Observation](#observation) - - [Policy](#policy) + - [📐 Continue Architecture](#-continue-architecture) + - [Continue VS Code Client](#continue-vs-code-client) + - [Continue IDE Websockets Protocol](#continue-ide-websockets-protocol) + - [Continue GUI Websockets Protocol](#continue-gui-websockets-protocol) + - [❇️ Core Concepts](#️-core-concepts) + - [`Step`](#step) + - [`Autopilot`](#autopilot) + - [`Observation`](#observation) + - [`Policy`](#policy) # ❤️ Ways to Contribute @@ -50,17 +52,28 @@ Continue is continuously improving, but a feature isn't complete until it is ref ## 🧑‍💻 Contributing Code -### Setting up the Development Environment +### Environment Setup -There are different levels of setup necessary depending on which part of Continue you are developing. For all of them, first clone the repo: +VSCode is assumed for development as Continue is primarily a VSCode tool at the moment. Most of the setup and running is automated through VSCode tasks and launch configurations. -```bash -git clone https://github.com/continuedev/continue -``` +1. Clone and open in VSCode the Continue repo `https://github.com/continuedev/continue` -If editing only the server (`/continuedev` directory), see the directions in [continuedev/README.md](./continuedev/README.md) to set up the Python server. Once it is running on localhost:8001, you can connect your existing VS Code extension by going to VS Code settings, searching for "Continue: Server URL", and setting it to "http://localhost:8001". +2. Open VSCode command pallet (`cmd+shift+p`) and select `Tasks: Run Task` and then select `install-all-dependencies` -If editing the VS Code extension (`/extension` directory) or GUI (`/extension/react-app`), you can follow the instructions in [`extension/DEV_README.md`](./extension/DEV_README.md) to set up the VS Code extension and GUI in development mode. +3. Start debugging: + 1. Switch to Run and Debug view + 2. Select `Server + Extension (VSCode)` from drop down + 3. Hit play button + 4. This will start both the server and the extension in debug mode and open a new VSCode window with continue extension + 1. I call the VSCode window with the extension the *Host VSCode* + 2. The window you started debugging from is reffered to as the *Main VSCode* + 5. Notice 2 debug sessions are running, one for the server and one for the extension, you can also set breakpoints in both + +4. Lets try using breakpoints: + 1. *In Main VSCode*: + 1. Search for `class IdeProtocolServer` and set a breakpoint in `handle_json`, this is the method invoked on every message received from the extension related to selection changes, file opens etc + 2. Search for a method `sendHighlightedCode` and set a breakpoint in it, it is invoked on every selection change on the extension side + 2. *In Host VSCode*: Select part of the `example.ts` file, your breakpoint should be hit. If you hit play at this point (or F5) you should see the original breakpoint hit again - congratulations, you debugged an end to end interaction from the extension to the server! ### Writing Steps diff --git a/extension/CONTRIBUTING.md b/extension/CONTRIBUTING.md new file mode 100644 index 00000000..953b5e48 --- /dev/null +++ b/extension/CONTRIBUTING.md @@ -0,0 +1,19 @@ +# Continue VS Code Extension + +This is the Continue VS Code Extension. Its primary jobs are + +1. Implement the IDE side of the Continue IDE protocol, allowing a Continue server to interact natively in an IDE. This happens in `src/continueIdeClient.ts`. +2. Open the Continue React app in a side panel. The React app's source code lives in the `react-app` directory. The panel is opened by the `continue.openContinueGUI` command, as defined in `src/commands.ts`. +3. Run a Continue server in the background, which connects to both the IDE protocol and the React app. The server is launched in `src/activation/environmentSetup.ts` by calling Python code that lives in `server/` (unless extension settings define a server URL other than localhost:65432, in which case the extension will just connect to that). + +# How to run the extension + +See [Environment Setup](../CONTRIBUTING.md#environment-setup) + +# How to run and debug tests + +After following the setup in [Environment Setup](../CONTRIBUTING.md#environment-setup) you can run `npm run test` in the command line or the `Server + Tests (VSCode)` launch configuration in VS Code to debug tests + server. + +## Notes + +- We require vscode engine `^1.67.0` and use `@types/vscode` version `1.67.0` because this is the earliest version that doesn't break any of the APIs we are using. If you go back to `1.66.0`, then it will break `vscode.window.tabGroups`. diff --git a/extension/DEV_README.md b/extension/DEV_README.md deleted file mode 100644 index 3ad9cf68..00000000 --- a/extension/DEV_README.md +++ /dev/null @@ -1,31 +0,0 @@ -# Continue VS Code Extension - -This is the Continue VS Code Extension. Its primary jobs are - -1. Implement the IDE side of the Continue IDE protocol, allowing a Continue server to interact natively in an IDE. This happens in `src/continueIdeClient.ts`. -2. Open the Continue React app in a side panel. The React app's source code lives in the `react-app` directory. The panel is opened by the `continue.openContinueGUI` command, as defined in `src/commands.ts`. -3. Run a Continue server in the background, which connects to both the IDE protocol and the React app. The server is launched in `src/activation/environmentSetup.ts` by calling Python code that lives in `server/` (unless extension settings define a server URL other than localhost:65432, in which case the extension will just connect to that). - -## How to debug the VS Code Extension - -1. Clone the Continue repo - -2. Open a VS Code window with the `continue` directory as your workspace - -3. Package and then start the FastAPI server by following instructions outlined in the `Continue Server` section of the `continuedev/README.md` - -4. Open a VS Code window with the `extension` directory as your workspace - -5. Run `npm run package` - -6. Open `src/activation/activate.ts` file (or any TypeScript file) - -7. Press `F5` on your keyboard to start `Run and Debug` mode - -8. `cmd+shift+p` to look at developer console and select Continue commands - -9. Every time you make changes to the code, you need to run `npm run esbuild` unless you make changes inside of `react-app` and then you need to run `npm run build` from there - -## Notes - -- We require vscode engine `^1.67.0` and use `@types/vscode` version `1.67.0` because this is the earliest version that doesn't break any of the APIs we are using. If you go back to `1.66.0`, then it will break `vscode.window.tabGroups`. -- cgit v1.2.3-70-g09d2