Skip to content

Latest commit

 

History

History
178 lines (120 loc) · 6.47 KB

CONTRIBUTING.md

File metadata and controls

178 lines (120 loc) · 6.47 KB

Contributing to Continue (JetBrains extension)

This file is for contribution guidelines specific to the JetBrains extension. See the root CONTRIBUTING.md for general contribution guidelines.

Table of Contents

Architecture Overview

This extension shares much of the code with the VS Code extension by utilizing shared code in the core directory and packaging it in a binary in the binary directory. Communication occurs over stdin/stdout.

Environment Setup

IDE Installation

Continue is built with JDK version 17 (as specified in ./build.gradle.kts), which can be downloaded from Oracle.

We recommend using IntelliJ IDEA, which you can download from the JetBrains website.

Both Ultimate and Community (free) editions are suitable for this project, although Ultimate has better debugging (see notes below).

IDE configuration

  • Enable code formatting on save: Settings | Tools | Actions on Save | Reformat code

Node.js Requirements

This project requires Node.js version 20.11.0 (LTS) or higher. You have two options for installation:

  1. Download and install directly from nodejs.org.
  2. If you're using NVM (Node Version Manager), set the correct Node.js version for this project by running nvm use in the project root.

Install all dependencies

  • Unix: ./scripts/install-dependencies.sh
  • Windows: .\scripts\install-dependencies.ps1

Misc

  • Ensure that you have the Gradle plugin installed

Development Workflow

Running the extension in debug mode

Select the Run Continue task in the top right corner of the IDE and then select the "Debug" option.

In community edition, use Run Continue (CE) instead, which uses shell scripts instead of Ultimate-only node configs. If you want to debug the core in CE, you'll need to quit the Start Core Dev Server (CE) process and run the core in a different environment that supports debugging, such as VS Code (Launch "Core Binary").

run-extension-screenshot

This should open a new instance on IntelliJ with the extension installed.

Accessing files in the .continue directory

When running the Start Core Dev Server task, we set the location of your Continue directory to ./extensions/.continue-debug. This is to allow for changes to your config.json and other files during development, without affecting your actual configuration.

Viewing logs

When using the Run Continue task, we automatically run a script that outputs logs into the "Prompt Logs" terminal tab.

Alternatively, you can view logs for a particular IDE instance by selecting Help -> Open Log in Editor in the window toolbar.

Reloading changes

  • extensions/intellij: Attempt to reload changed classes by selecting Run | Debugging Actions | Reload Changed Classes`
    • This will often fail on new imports, schema changes etc. In that case, you need to stop and restart the extension
  • gui: Changes will be reloaded automatically
  • core: Run npm run build from the binary directory (requires restarting the Start Core Dev Server task)

Setting breakpoints

  • extensions/intellij: Breakpoints can be set in Intellij
  • gui: You'll need to set explicit debugger statements in the source code, or through the browser dev tools
  • core: Breakpoints can be set in Intellij (requires restarting the Start Core Dev Server task

Available Gradle tasks

To see the list of Gradle tasks available, you can run the following:

./gradlew tasks

A handful of the most relevant tasks are outlined below:

build - Assembles and tests this project.
clean - Deletes the build directory.
dependencies - Displays all dependencies declared in root project 'continue-intellij-extension'
runIde - Runs the IDE instance with the developed plugin installed.
verifyPluginConfiguration - Checks if Java and Kotlin compilers configuration meet IntelliJ SDK requirements

Packaging

  • Unix: ./gradlew buildPlugin
  • Windows: ./gradlew.bat buildPlugin

This will generate a .zip file in ./build/distributions with the version defined in ./gradle.properties

Installing the packaged extension

  • Navigate to the Plugins settings page (Settings | Plugins)
  • Click on the gear icon
  • Click Install from disk and select the ZIP file in ./build/distributions

Testing

e2e testing

Overview

The e2e tests are written using intellij-ui-test-robot. The README for this project has a lot of helpful info on how to use the library.

Setup

If you are on macOS, you'll need to give IntelliJ permission to control your computer in order to run the e2e tests. Open System Settings and select Privacy & Security -> Accessibility and toggle the switch for IntelliJ.

Running the tests

Instantiate the test IDE as a background task:

./gradlew clean runIdeForUiTests &

Once the IDE has loaded, you can run the tests. Note that you need to have the test IDE focused in order for the tests to run.

./gradlew test

Identifying selectors

While the runIdeForUiTests task is runnung, you can visit the following URL to view the UI hierarchy of the running IDE:

http://127.0.0.1:8082/