diff --git a/.gitignore b/.gitignore index 9e32c699e..9b98fc6ae 100644 --- a/.gitignore +++ b/.gitignore @@ -148,13 +148,6 @@ codeql **/**/build **/.idea/**/* -!**/.idea/.name -!**/.idea/compiler.xml -!**/.idea/gradle.xml -!**/.idea/kotlinc.xml -!**/.idea/misc.xml -!**/.idea/vcs.xml -!**/.idea/jarRepositories.xml core/.idea continue_server.build @@ -171,4 +164,4 @@ Icon? notes.md -manual-testing-sandbox/Continue/.idea/vcs.xml \ No newline at end of file +manual-testing-sandbox/Continue/.idea/** \ No newline at end of file diff --git a/.idea/.name b/.idea/.name deleted file mode 100644 index 389f6bc71..000000000 --- a/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -continue-intellij-extension \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml deleted file mode 100644 index b589d56e9..000000000 --- a/.idea/compiler.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml deleted file mode 100644 index 1d937028b..000000000 --- a/.idea/gradle.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml deleted file mode 100644 index fdc392fe8..000000000 --- a/.idea/jarRepositories.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml deleted file mode 100644 index fdf8d994a..000000000 --- a/.idea/kotlinc.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index efa79f7df..000000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1ddfb..000000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c070f0bc1..d813a18a2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -19,7 +19,7 @@ - [VS Code](#vs-code) - [Debugging](#debugging) - [JetBrains](#jetbrains) - - [Debugging](#debugging-1) + - [Our Git Workflow](#our-git-workflow) - [Formatting](#formatting) - [Writing Slash Commands](#writing-slash-commands) - [Writing Context Providers](#writing-context-providers) @@ -68,7 +68,7 @@ You can run the documentation server locally using either of the following metho #### Method 1: NPM Script -1. Open your terminal and navigate to the `docs` subdirectory of the project. The `docusaurus.config.js` file you'll see there is a sign you're in the right place. +1. Open your terminal and navigate to the `docs` subdirectory of the project. The `docusaurus.config.js` file you'll see there is a sign you're in the right place. 2. Run the following command to install the necessary dependencies for the documentation server: @@ -141,33 +141,7 @@ Similarly, any changes to `core` or `extensions/vscode` will be automatically in #### JetBrains -Pre-requisite: You should use the Intellij IDE, which can be downloaded [here](https://www.jetbrains.com/idea/download). Either Ultimate or Community (free) will work. Continue is built with JDK version 17, as specified in `extensions/intellij/build.gradle.kts`. You should also ensure that you have the Gradle plugin installed. - -1. Clone the repository -2. Run `scripts/install-dependencies.sh` or `scripts/install-dependencies.ps1` on Windows. This will install and build all of the necessary dependencies. -3. To test the plugin, select the "Run Plugin" Gradle configuration and click the "Run" or "Debug" button as shown in this screenshot: - ![img](./media/IntelliJRunPluginScreenshot.png) -4. To package the extension, run `./gradlew build` (or `./gradlew.bat build` on Windows) from the `extensions/intellij` directory. This will generate a .zip file in `extensions/intellij/build/distributions` with the version defined in `extensions/intellij/gradle.properties`. -5. If you make changes, you may need to re-build before running the "Build Plugin" configuration - - a. If you change code from the `core` or `binary` directories, make sure to run `npm run build` from the `binary` directory to create a new binary. - - b. If you change code from the `gui` directory, make sure to run `npm run build` from the `gui` directory to create a new bundle. - - c. Any changes to the Kotlin coded in the `extensions/intellij` directory will be automatically included when you run "Build Plugin" - -##### Debugging - -Continue's JetBrains 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. The JetBrains extension (written in Kotlin) is then able to communicate over stdin/stdout in the [CoreMessenger.kt](./extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessenger.kt) file. - -For the sake of rapid development, it is also possible to configure this communication to happen over local TCP sockets: - -1. In [CoreMessenger.kt](./extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessenger.kt), change the `useTcp` variable to `true`. -2. Open a VS Code window (we recommend this for a preconfigured Typescript debugging experience) with the `continue` repository. Select the "Core Binary" debug configuration and press play. -3. Run the "Run Plugin" Gradle configuration. -4. You can now set breakpoints in any of the TypeScript files in VS Code. If you make changes to the code, restart the "Core Binary" debug configuration and reload the _Host IntelliJ_ window. - -If you make changes to Kotlin code, they can often be hot-reloaded with "Run -> Debugging Actions -> Reload Changed Classes". +See the [`CONTRIBUTING.md`](./extensions/intellij/CONTRIBUTING.md) for the JetBrains extension. ### Our Git Workflow diff --git a/binary/package-lock.json b/binary/package-lock.json index 010492e82..932419aa6 100644 --- a/binary/package-lock.json +++ b/binary/package-lock.json @@ -93,6 +93,7 @@ "sqlite": "^5.1.1", "sqlite3": "^5.1.7", "system-ca": "^1.0.3", + "tar": "^7.4.3", "tree-sitter-wasms": "^0.1.11", "uuid": "^9.0.1", "vectordb": "^0.4.20", diff --git a/docs/docs/customize/model-providers/top-level/azure.md b/docs/docs/customize/model-providers/top-level/azure.md index 338a3772b..814a056ea 100644 --- a/docs/docs/customize/model-providers/top-level/azure.md +++ b/docs/docs/customize/model-providers/top-level/azure.md @@ -22,20 +22,13 @@ We recommend configuring **GPT-4o** as your chat model. ## Autocomplete model -We recommend configuring **Codestral** as your autocomplete model. There are not currently any other models in Azure that are capable of autocomplete. +Azure OpenAI currently does not offer any autocomplete models. -```json title="config.json" -"tabAutocompleteModel": [{ - "title": "Codestral", - "provider": "azure", - "model": "codestral-latest", - "apiBase": "", - "engine": "", - "apiVersion": "", - "apiType": "azure", - "apiKey": "" -}] -``` +[Click here](../../model-types/autocomplete.md) to see a list of autocomplete models. + +:::info +**Codestral** will be available on Azure in the near future. +::: ## Embeddings model diff --git a/extensions/intellij/.idea/.name b/extensions/intellij/.idea/.name deleted file mode 100644 index c0d78d1d5..000000000 --- a/extensions/intellij/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -Continue IntelliJ Extension \ No newline at end of file diff --git a/extensions/intellij/.idea/compiler.xml b/extensions/intellij/.idea/compiler.xml deleted file mode 100644 index b589d56e9..000000000 --- a/extensions/intellij/.idea/compiler.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/extensions/intellij/.idea/gradle.xml b/extensions/intellij/.idea/gradle.xml deleted file mode 100644 index ce1c62c7c..000000000 --- a/extensions/intellij/.idea/gradle.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/extensions/intellij/.idea/jarRepositories.xml b/extensions/intellij/.idea/jarRepositories.xml deleted file mode 100644 index fdc392fe8..000000000 --- a/extensions/intellij/.idea/jarRepositories.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/extensions/intellij/.idea/kotlinc.xml b/extensions/intellij/.idea/kotlinc.xml deleted file mode 100644 index fdf8d994a..000000000 --- a/extensions/intellij/.idea/kotlinc.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/extensions/intellij/.idea/misc.xml b/extensions/intellij/.idea/misc.xml deleted file mode 100644 index 9676474e1..000000000 --- a/extensions/intellij/.idea/misc.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/extensions/intellij/.idea/vcs.xml b/extensions/intellij/.idea/vcs.xml deleted file mode 100644 index b2bdec2d7..000000000 --- a/extensions/intellij/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/extensions/intellij/.run/Run Continue (TCP).run.xml b/extensions/intellij/.run/Run Continue (TCP).run.xml new file mode 100644 index 000000000..513c31d3a --- /dev/null +++ b/extensions/intellij/.run/Run Continue (TCP).run.xml @@ -0,0 +1,30 @@ + + + + + + + + true + true + false + false + + + \ No newline at end of file diff --git a/extensions/intellij/.run/Run Plugin.run.xml b/extensions/intellij/.run/Run Continue.run.xml similarity index 72% rename from extensions/intellij/.run/Run Plugin.run.xml rename to extensions/intellij/.run/Run Continue.run.xml index 93a586e03..54627b084 100644 --- a/extensions/intellij/.run/Run Plugin.run.xml +++ b/extensions/intellij/.run/Run Continue.run.xml @@ -1,11 +1,16 @@ - + + @@ -19,6 +24,7 @@ true true false + false \ No newline at end of file diff --git a/extensions/intellij/.run/Run IDE for UI Tests.run.xml b/extensions/intellij/.run/Run IDE for UI Tests.run.xml index ee99b7edd..5f7eb46c8 100644 --- a/extensions/intellij/.run/Run IDE for UI Tests.run.xml +++ b/extensions/intellij/.run/Run IDE for UI Tests.run.xml @@ -1,25 +1,25 @@ - - - - - - - - true - true - false - false - - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/extensions/intellij/.run/Run Qodana.run.xml b/extensions/intellij/.run/Run Qodana.run.xml index c92f33c7c..18c276683 100644 --- a/extensions/intellij/.run/Run Qodana.run.xml +++ b/extensions/intellij/.run/Run Qodana.run.xml @@ -1,30 +1,30 @@ - - - - - - - - true - true - false - false - - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/extensions/intellij/CONTRIBUTING.md b/extensions/intellij/CONTRIBUTING.md index 9e6057b80..c8b040424 100644 --- a/extensions/intellij/CONTRIBUTING.md +++ b/extensions/intellij/CONTRIBUTING.md @@ -1,3 +1,112 @@ -### Commands +# Contributing to Continue (JetBrains extension) -Verify plugin compatibility: `./gradlew verifyPlugin` +This file is for contribution guidelines specific to the JetBrains extension. See the root [`CONTRIBUTING.md`](../../CONTRIBUTING.md) for general contribution guidelines. + +## Table of Contents + +- [Architecture Overview](#architecture-overview) +- [Environment Setup](#environment-setup) + - [IDE Installation](#ide-installation) + - [IDE configuration](#ide-configuration) + - [Node.js Requirements](#nodejs-requirements) + - [Install all dependencies](#install-all-dependencies) + - [Misc](#misc) +- [Development Workflow](#development-workflow) + - [Running the extension](#running-the-extension) + - [Available Gradle tasks](#available-gradle-tasks) +- [Debugging](#debugging) + - [Reloading changes](#reloading-changes) + - [Setting breakpoints](#setting-breakpoints) +- [Packaging](#packaging) + +## 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 + +We recommend using IntelliJ IDEA, which you can download from +the [JetBrains website](https://www.jetbrains.com/idea/download). + +Both Ultimate and Community (free) editions are suitable for this project. Continue is built with JDK version 17, as +specified in [`./build.gradle.kts`](./build.gradle.kts). + +### 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](https://nodejs.org/en/download). +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 + +- Select the "Run Continue" Gradle configuration in the top-right corner of the IDE +- Click the "Run" or "Debug" button + - The first time running this will install the IDE version specified by the `platformVersion` property in [`./run/Run Continue.run.xml`](./.run/Run%20Continue.run.xml). This will take a moment as the installation size can be close to 1GB. + +![run-extension-screenshot](../../media/run-intellij-extension.png) + +### Available Gradle tasks + +To see the list of Gradle tasks available, you can run the following: + +```shell +./gradlew tasks +``` + +A handful of the most relevant tasks are outlined below: + +```shell +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 +``` + +## Debugging + +### 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`: Run `npm run build` from the `gui` directory +- `core`: Run `npm run build` from the `binary` directory + +### Setting breakpoints + +- `extensions/intellij`: Run the extension in debug mode +- `gui`: You'll need to set explicit `debugger` statements in the source code, or through the browser dev tools +- `core`: To set breakpoints in `core`, we need to start `binary` in a debug configuration + - Select the "Run Continue (TCP)" task in the top right corner + - Open the project in a VS Code window (we recommend this for a preconfigured Typescript debugging experience) + - Select the "Core Binary" task from the Run and Debug panel + - You can now set breakpoints in `core`. Note that if you make changes, you'll need to restart the "Core Binary" + task and reload changes classes in Intellij. + +## Packaging + +- Unix: `./gradlew build` +- Windows: `./gradlew.bat build` + +This will generate a .zip file in `./build/distributions` with the version defined in [`./gradle.properties`](./gradle.properties) diff --git a/extensions/intellij/gradle.properties b/extensions/intellij/gradle.properties index a892cf145..e94dcbc7a 100644 --- a/extensions/intellij/gradle.properties +++ b/extensions/intellij/gradle.properties @@ -1,26 +1,40 @@ # IntelliJ Platform Artifacts Repositories -> https://plugins.jetbrains.com/docs/intellij/intellij-artifacts.html pluginGroup=com.github.continuedev.continueintellijextension + pluginName=continue-intellij-extension + pluginRepositoryUrl=https://github.com/continuedev/continue + # SemVer format -> https://semver.org pluginVersion=0.0.76 + # Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html pluginSinceBuild=223 + #pluginUntilBuild = 232.* + # IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension platformType=IC + platformVersion=2022.3.3 + #platformVersion = LATEST-EAP-SNAPSHOT + # Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html # Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22 platformPlugins=org.jetbrains.plugins.terminal + # Gradle Releases -> https://github.com/gradle/gradle/releases gradleVersion=8.3 + # Opt-out flag for bundling Kotlin standard library -> https://jb.gg/intellij-platform-kotlin-stdlib kotlin.stdlib.default.dependency=false + # Enable Gradle Configuration Cache -> https://docs.gradle.org/current/userguide/configuration_cache.html org.gradle.configuration-cache=true + # Enable Gradle Build Cache -> https://docs.gradle.org/current/userguide/build_cache.html org.gradle.caching=true + # Enable Gradle Kotlin DSL Lazy Property Assignment -> https://docs.gradle.org/current/userguide/kotlin_dsl.html#kotdsl:assignment -systemProp.org.gradle.unsafe.kotlin.assignment=true \ No newline at end of file +systemProp.org.gradle.unsafe.kotlin.assignment=true diff --git a/extensions/intellij/package-lock.json b/extensions/intellij/package-lock.json new file mode 100644 index 000000000..ff588d4a5 --- /dev/null +++ b/extensions/intellij/package-lock.json @@ -0,0 +1,6 @@ +{ + "name": "intellij", + "lockfileVersion": 3, + "requires": true, + "packages": {} +} diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessenger.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessenger.kt index ff32b1af8..b47818158 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessenger.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessenger.kt @@ -19,16 +19,16 @@ class CoreMessenger( private val project: Project, esbuildPath: String, continueCorePath: String, - ideProtocolClient: IdeProtocolClient, - private val coroutineScope: CoroutineScope + private val ideProtocolClient: IdeProtocolClient, + coroutineScope: CoroutineScope ) { private var writer: Writer? = null private var reader: BufferedReader? = null private var process: Process? = null private val gson = Gson() private val responseListeners = mutableMapOf Unit>() - private val ideProtocolClient = ideProtocolClient - private val useTcp: Boolean = false + private val useTcp: Boolean = System.getenv("USE_TCP")?.toBoolean() ?: false + private fun write(message: String) { try { writer?.write(message + "\r\n") @@ -38,13 +38,6 @@ class CoreMessenger( } } - private fun close() { - writer?.close() - reader?.close() - val exitCode = process?.waitFor() - println("Subprocess exited with code: $exitCode") - } - fun request(messageType: String, data: Any?, messageId: String?, onResponse: (Any?) -> Unit) { val id = messageId ?: uuid() val message = gson.toJson( diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinueBrowser.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinueBrowser.kt index d0a7afa3d..eae59e9cc 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinueBrowser.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinueBrowser.kt @@ -9,8 +9,6 @@ import com.github.continuedev.continueintellijextension.services.ContinuePluginS import com.google.gson.Gson import com.google.gson.JsonObject import com.google.gson.JsonParser -import com.intellij.ide.plugins.PluginManager -import com.intellij.ide.plugins.PluginManagerCore import com.intellij.openapi.components.ServiceManager import com.intellij.openapi.project.Project import com.intellij.openapi.util.Disposer @@ -20,16 +18,13 @@ import org.cef.CefApp import org.cef.browser.CefBrowser import org.cef.handler.CefLoadHandlerAdapter import com.intellij.openapi.application.ApplicationInfo -import com.intellij.openapi.extensions.PluginId -class ContinueBrowser(val project: Project, url: String, useOsr: Boolean = false) { +class ContinueBrowser(val project: Project, url: String) { private val coroutineScope = CoroutineScope( SupervisorJob() + Dispatchers.Default ) + private val heightChangeListeners = mutableListOf<(Int) -> Unit>() - fun onHeightChange(listener: (Int) -> Unit) { - heightChangeListeners.add(listener) - } private val PASS_THROUGH_TO_CORE = listOf( "update/modelChange", @@ -290,13 +285,11 @@ class ContinueBrowser(val project: Project, url: String, useOsr: Boolean = false * References: * 1. https://youtrack.jetbrains.com/issue/IDEA-347828/JCEF-white-flash-when-tool-window-show#focus=Comments-27-9334070.0-0 * This issue mentions that white screen flash problems were resolved in platformVersion 2023.3.4. - * 2. https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html#earlier-versions + * 2. https://www.jetbrains.com/idea/download/other.html * This documentation shows mappings from platformVersion to branchNumber. * * We use the branchNumber (e.g., 233) instead of the full version number (e.g., 2023.3.4) because * it's a simple integer without dot notation, making it easier to compare. - * - * @return Boolean True if off-screen rendering should be used, false otherwise. */ private fun shouldRenderOffScreen(): Boolean { val minBuildNumber = 233 diff --git a/media/IntelliJRunPluginScreenshot.png b/media/IntelliJRunPluginScreenshot.png deleted file mode 100644 index 5348eb1ba..000000000 Binary files a/media/IntelliJRunPluginScreenshot.png and /dev/null differ diff --git a/media/run-intellij-extension.png b/media/run-intellij-extension.png new file mode 100644 index 000000000..4c2a5a479 Binary files /dev/null and b/media/run-intellij-extension.png differ