Merge branch 'nate/serverless-jetbrains' into preview
This commit is contained in:
commit
658b38e292
25 changed files with 844 additions and 762 deletions
|
|
@ -1,6 +1,5 @@
|
|||
// import "vscode-webview";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
|
||||
interface vscode {
|
||||
postMessage(message: any): vscode;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,11 +80,11 @@ class FreeTrial extends BaseLLM {
|
|||
content: loadedChunk.content || "",
|
||||
};
|
||||
|
||||
if (this.model === "gpt-4") {
|
||||
await delay(0.03);
|
||||
} else {
|
||||
await delay(0.01);
|
||||
}
|
||||
// if (this.model === "gpt-4") {
|
||||
// await delay(0.03);
|
||||
// } else {
|
||||
// await delay(0.01);
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,13 @@ export async function* streamResponse(
|
|||
throw new Error(`No response body returned.`);
|
||||
}
|
||||
|
||||
const reader = response.body.getReader();
|
||||
const stream =
|
||||
response.headers.get("content-encoding") === "gzip"
|
||||
? // @ts-ignore
|
||||
response.body.pipeThrough(new DecompressionStream("gzip"))
|
||||
: response.body;
|
||||
|
||||
const reader = stream.getReader();
|
||||
const decoder = new TextDecoder("utf-8");
|
||||
while (true) {
|
||||
const { done, value } = await reader.read();
|
||||
|
|
@ -18,6 +24,7 @@ export async function* streamResponse(
|
|||
}
|
||||
|
||||
if (value) {
|
||||
// @ts-ignore
|
||||
yield decoder.decode(value);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,24 +1,8 @@
|
|||
# Changelog
|
||||
All notable changes to this project will be documented in this file.
|
||||
<!-- Keep a Changelog guide -> https://keepachangelog.com -->
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
|
||||
and is generated by [Changie](https://github.com/miniscruff/changie).
|
||||
# continue-intellij-extension Changelog
|
||||
|
||||
|
||||
## v0.0.21 - 2023-12-05
|
||||
|
||||
### Added
|
||||
|
||||
- updated to match latest VS Code updates
|
||||
|
||||
## v0.0.19 - 2023-11-19
|
||||
|
||||
### Changed
|
||||
|
||||
- migrated to .json config file format
|
||||
|
||||
## v0.0.1 - 2023-09-01
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
|
||||
|
|
|
|||
|
|
@ -24,11 +24,32 @@ repositories {
|
|||
// Dependencies are managed with Gradle version catalog - read more: https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog
|
||||
dependencies {
|
||||
// implementation(libs.annotations)
|
||||
implementation("com.squareup.okhttp3:okhttp:4.9.1")
|
||||
implementation("com.squareup.okhttp3:okhttp:4.9.1") {
|
||||
exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib")
|
||||
}
|
||||
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.4.32")
|
||||
implementation ("io.socket:socket.io-client:2.1.0")
|
||||
implementation("io.ktor:ktor-server-core:2.3.7"){
|
||||
exclude(group = "org.slf4j", module = "slf4j-api")
|
||||
}
|
||||
implementation("io.ktor:ktor-server-netty:2.3.7") {
|
||||
exclude(group = "org.slf4j", module = "slf4j-api")
|
||||
}
|
||||
implementation("io.ktor:ktor-server-cors:2.3.7"){
|
||||
exclude(group = "org.slf4j", module = "slf4j-api")
|
||||
}
|
||||
|
||||
// ktor client
|
||||
// implementation("io.ktor:ktor-client-core:2.3.7")
|
||||
// implementation("io.ktor:ktor-client-cio:2.3.7")
|
||||
}
|
||||
|
||||
//configurations {
|
||||
// all {
|
||||
// exclude (group = "io.ktor", module = "ktor-client-core")
|
||||
// exclude (group = "io.ktor", module = "ktor-client-cio")
|
||||
// }
|
||||
//}
|
||||
|
||||
// Set the JVM language level used to build the project. Use Java 11 for 2020.3+, and Java 17 for 2022.2+.
|
||||
kotlin {
|
||||
jvmToolchain(17)
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@ pluginGroup = com.github.continuedev.continueintellijextension
|
|||
pluginName = continue-intellij-extension
|
||||
pluginRepositoryUrl = https://github.com/continuedev/continue
|
||||
# SemVer format -> https://semver.org
|
||||
pluginVersion = 0.0.21
|
||||
pluginVersion = 0.0.22
|
||||
|
||||
# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
|
||||
pluginSinceBuild = 223
|
||||
pluginSinceBuild = 203
|
||||
#pluginUntilBuild = 232.*
|
||||
|
||||
# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.github.continuedev.continueintellijextension.actions
|
||||
|
||||
import com.github.continuedev.continueintellijextension.services.ContinuePluginService
|
||||
import com.google.gson.Gson
|
||||
import com.intellij.openapi.actionSystem.AnAction
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||
import com.intellij.openapi.actionSystem.impl.SimpleDataContext
|
||||
|
|
@ -129,7 +130,7 @@ class QuickTextEntryAction : AnAction() {
|
|||
}
|
||||
|
||||
continuePluginService.continuePluginWindow?.content?.components?.get(0)?.requestFocus()
|
||||
continuePluginService.dispatchCustomEvent("message", mutableMapOf("type" to "focusContinueInput"))
|
||||
continuePluginService.dispatchCustomEvent(Gson().toJson(mutableMapOf("type" to "focusContinueInput")))
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -178,7 +179,7 @@ class FocusContinueInputWithEditAction : AnAction() {
|
|||
|
||||
val continuePluginService = pluginServiceFromActionEvent(e) ?: return
|
||||
continuePluginService.continuePluginWindow?.content?.components?.get(0)?.requestFocus()
|
||||
continuePluginService.dispatchCustomEvent("message", mutableMapOf("type" to "focusContinueInputWithEdit"))
|
||||
continuePluginService.dispatchCustomEvent(Gson().toJson(mutableMapOf("type" to "focusContinueInputWithEdit")))
|
||||
|
||||
continuePluginService.ideProtocolClient?.sendHighlightedCode()
|
||||
}
|
||||
|
|
@ -201,7 +202,7 @@ class FocusContinueInputAction : AnAction() {
|
|||
val continuePluginService = pluginServiceFromActionEvent(e) ?: return
|
||||
|
||||
continuePluginService.continuePluginWindow?.content?.components?.get(0)?.requestFocus()
|
||||
continuePluginService.dispatchCustomEvent("message", mutableMapOf("type" to "focusContinueInput"))
|
||||
continuePluginService.dispatchCustomEvent(Gson().toJson(mutableMapOf("type" to "focusContinueInput")))
|
||||
|
||||
continuePluginService.ideProtocolClient?.sendHighlightedCode()
|
||||
}
|
||||
|
|
@ -224,7 +225,7 @@ class NewContinueSessionAction : AnAction() {
|
|||
val continuePluginService = pluginServiceFromActionEvent(e) ?: return
|
||||
|
||||
continuePluginService.continuePluginWindow?.content?.components?.get(0)?.requestFocus()
|
||||
continuePluginService.dispatchCustomEvent("message", mutableMapOf("type" to "focusContinueInputWithNewSession"))
|
||||
continuePluginService.dispatchCustomEvent(Gson().toJson(mutableMapOf("type" to "focusContinueInputWithNewSession")))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -238,6 +239,6 @@ class ViewHistoryAction : AnAction() {
|
|||
|
||||
val continuePluginService = pluginServiceFromActionEvent(e) ?: return
|
||||
|
||||
continuePluginService.dispatchCustomEvent("message", mutableMapOf("type" to "viewHistory"))
|
||||
continuePluginService.dispatchCustomEvent(Gson().toJson(mutableMapOf("type" to "viewHistory")))
|
||||
}
|
||||
}
|
||||
|
|
@ -1,24 +1,17 @@
|
|||
package com.github.continuedev.continueintellijextension.activities
|
||||
|
||||
import com.github.continuedev.continueintellijextension.constants.CONTINUE_PYTHON_SERVER_URL
|
||||
import com.github.continuedev.continueintellijextension.constants.CONTINUE_SERVER_WEBSOCKET_PORT
|
||||
import com.github.continuedev.continueintellijextension.constants.getContinueGlobalPath
|
||||
import com.github.continuedev.continueintellijextension.`continue`.startProxyServer
|
||||
import com.github.continuedev.continueintellijextension.`continue`.DefaultTextSelectionStrategy
|
||||
import com.github.continuedev.continueintellijextension.`continue`.IdeProtocolClient
|
||||
import com.github.continuedev.continueintellijextension.`continue`.getMachineUniqueID
|
||||
import com.github.continuedev.continueintellijextension.listeners.ContinuePluginSelectionListener
|
||||
import com.github.continuedev.continueintellijextension.services.ContinueExtensionSettings
|
||||
import com.github.continuedev.continueintellijextension.services.ContinuePluginService
|
||||
import com.google.gson.Gson
|
||||
import com.intellij.ide.plugins.PluginManagerCore
|
||||
import com.intellij.openapi.Disposable
|
||||
import com.intellij.openapi.actionSystem.ActionManager
|
||||
import com.intellij.openapi.actionSystem.CustomShortcutSet
|
||||
import com.intellij.openapi.actionSystem.KeyboardShortcut
|
||||
import com.intellij.openapi.actionSystem.Shortcut
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.components.ServiceManager
|
||||
import com.intellij.openapi.editor.EditorFactory
|
||||
import com.intellij.openapi.extensions.PluginId
|
||||
import com.intellij.openapi.fileEditor.FileEditorManager
|
||||
import com.intellij.openapi.keymap.KeymapManager
|
||||
import com.intellij.openapi.project.DumbAware
|
||||
|
|
@ -28,10 +21,7 @@ import com.intellij.openapi.ui.DialogWrapper
|
|||
import com.intellij.openapi.util.io.StreamUtil
|
||||
import com.intellij.openapi.vfs.LocalFileSystem
|
||||
import com.intellij.openapi.wm.ToolWindowManager
|
||||
import com.intellij.ui.jcef.executeJavaScriptAsync
|
||||
import kotlinx.coroutines.*
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.Request
|
||||
import java.awt.Dimension
|
||||
import java.awt.Font
|
||||
import java.awt.GridLayout
|
||||
|
|
@ -39,381 +29,9 @@ import java.io.*
|
|||
import java.nio.charset.StandardCharsets
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.Paths
|
||||
import java.nio.file.attribute.PosixFilePermission
|
||||
import javax.swing.*
|
||||
|
||||
|
||||
fun getContinueGlobalPath(): String {
|
||||
val continuePath = Paths.get(System.getProperty("user.home"), ".continue")
|
||||
if (Files.notExists(continuePath)) {
|
||||
Files.createDirectories(continuePath)
|
||||
}
|
||||
return continuePath.toString()
|
||||
}
|
||||
|
||||
fun serverPath(): String {
|
||||
val sPath = Paths.get(getContinueGlobalPath(), "server").toString()
|
||||
val directory = File(sPath)
|
||||
if (!directory.exists()) {
|
||||
directory.mkdir()
|
||||
}
|
||||
return sPath
|
||||
}
|
||||
|
||||
fun serverVersionPath(): String {
|
||||
return Paths.get(serverPath(), "server_version.txt").toString()
|
||||
}
|
||||
|
||||
fun serverBinaryPath(): String {
|
||||
val exeFile = if (System.getProperty("os.name").toLowerCase()
|
||||
.contains("win")
|
||||
) "continue_server.exe" else "continue_server"
|
||||
return Paths.get(serverPath(), "exe", exeFile).toString()
|
||||
}
|
||||
|
||||
fun downloadFromS3(
|
||||
bucket: String,
|
||||
filename: String,
|
||||
destination: String,
|
||||
region: String,
|
||||
useBackupUrl: Boolean = false
|
||||
|
||||
) {
|
||||
val client = OkHttpClient()
|
||||
val url = if (useBackupUrl)
|
||||
"https://s3.continue.dev/$filename"
|
||||
else
|
||||
"https://$bucket.s3.$region.amazonaws.com/$filename"
|
||||
|
||||
val request = Request.Builder()
|
||||
.url(url)
|
||||
.build()
|
||||
|
||||
// Create the necessary folders
|
||||
val directory = File(destination).parentFile
|
||||
if (!directory.exists()) {
|
||||
directory.mkdirs()
|
||||
}
|
||||
|
||||
client.newCall(request).execute().use { response ->
|
||||
if (!response.isSuccessful) {
|
||||
Files.deleteIfExists(Paths.get(destination))
|
||||
throw IOException("No body returned when downloading from S3 bucket")
|
||||
}
|
||||
|
||||
val fos = FileOutputStream(File(destination))
|
||||
val body = response.body!!.byteStream()
|
||||
|
||||
fos.use {
|
||||
body.copyTo(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set permissions on the binary
|
||||
fun setPermissions(destination: String) {
|
||||
val osName = System.getProperty("os.name").toLowerCase()
|
||||
if (osName.contains("mac") || osName.contains("darwin")) {
|
||||
ProcessBuilder(
|
||||
"xattr",
|
||||
"-dr",
|
||||
"com.apple.quarantine",
|
||||
destination
|
||||
).start()
|
||||
setFilePermissions(destination, "rwxr-xr-x")
|
||||
} else if (osName.contains("nix") || osName.contains("nux") || osName.contains(
|
||||
"mac"
|
||||
)
|
||||
) {
|
||||
setFilePermissions(destination, "rwxr-xr-x")
|
||||
}
|
||||
}
|
||||
|
||||
fun setFilePermissions(path: String, posixPermissions: String) {
|
||||
val perms = HashSet<PosixFilePermission>()
|
||||
if (posixPermissions.contains("r")) perms.add(PosixFilePermission.OWNER_READ)
|
||||
if (posixPermissions.contains("w")) perms.add(PosixFilePermission.OWNER_WRITE)
|
||||
if (posixPermissions.contains("x")) perms.add(PosixFilePermission.OWNER_EXECUTE)
|
||||
Files.setPosixFilePermissions(Paths.get(path), perms)
|
||||
}
|
||||
|
||||
fun getProcessId(port: Int): String? {
|
||||
val os = System.getProperty("os.name").toLowerCase()
|
||||
|
||||
val command = when {
|
||||
os.contains("win") -> listOf(
|
||||
"cmd.exe",
|
||||
"/c",
|
||||
"netstat -ano | findstr :$port"
|
||||
)
|
||||
os.contains("nix") || os.contains("mac") || os.contains("nux") -> listOf(
|
||||
"/bin/sh",
|
||||
"-c",
|
||||
"lsof -t -i tcp:$port"
|
||||
)
|
||||
else -> throw UnsupportedOperationException("Unsupported operating system: $os")
|
||||
}
|
||||
|
||||
val process = ProcessBuilder(command).start()
|
||||
val reader = BufferedReader(InputStreamReader(process.inputStream))
|
||||
|
||||
return reader.readLine()?.trim()
|
||||
}
|
||||
|
||||
|
||||
fun killProcess(pid: String) {
|
||||
val os = System.getProperty("os.name").toLowerCase()
|
||||
val command = when {
|
||||
os.contains("win") -> listOf("taskkill", "/F", "/PID", pid)
|
||||
else -> listOf(
|
||||
"kill",
|
||||
"-9",
|
||||
pid
|
||||
)
|
||||
}
|
||||
|
||||
try {
|
||||
val process = ProcessBuilder(command).start()
|
||||
process.waitFor()
|
||||
} catch (e: IOException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
fun checkServerRunning(): Boolean {
|
||||
val processId = getProcessId(CONTINUE_SERVER_WEBSOCKET_PORT)
|
||||
return processId != null
|
||||
}
|
||||
|
||||
fun getExtensionVersion(): String {
|
||||
val pluginId =
|
||||
PluginId.getId("com.github.continuedev.continueintellijextension")
|
||||
val pluginDescriptor = PluginManagerCore.getPlugin(pluginId)
|
||||
return pluginDescriptor?.version ?: ""
|
||||
}
|
||||
|
||||
fun checkOrKillRunningServer(project: Project): Boolean {
|
||||
val continuePluginService = ServiceManager.getService(
|
||||
project,
|
||||
ContinuePluginService::class.java
|
||||
)
|
||||
val serverRunning: Boolean = checkServerRunning()
|
||||
var shouldKillAndReplace = true
|
||||
|
||||
val serverVersionPath = serverVersionPath()
|
||||
if (File(serverVersionPath).exists()) {
|
||||
val serverVersion = File(serverVersionPath).readText()
|
||||
if (serverVersion == getExtensionVersion() && serverRunning) {
|
||||
println("Continue server of correct version already running")
|
||||
shouldKillAndReplace = false
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldKillAndReplace) {
|
||||
continuePluginService.dispatchCustomEvent("serverStatus", mutableMapOf(
|
||||
"type" to "serverStatus",
|
||||
"message" to "Stopping Outdated Server"
|
||||
))
|
||||
println("Killing server from old version of Continue")
|
||||
val pid = getProcessId(CONTINUE_SERVER_WEBSOCKET_PORT)
|
||||
pid?.let { killProcess(it) }
|
||||
|
||||
if (File(serverVersionPath).exists()) {
|
||||
File(serverVersionPath).delete()
|
||||
}
|
||||
|
||||
val serverBinary = serverBinaryPath()
|
||||
if (File(serverBinary).exists()) {
|
||||
File(serverBinary).delete()
|
||||
}
|
||||
|
||||
}
|
||||
return serverRunning && !shouldKillAndReplace
|
||||
}
|
||||
|
||||
fun runBinary(path: String) {
|
||||
try {
|
||||
if (System.getProperty("os.name").toLowerCase().contains("win")) {
|
||||
// Windows approach
|
||||
val script = """
|
||||
Set WshShell = CreateObject("WScript.Shell")
|
||||
WshShell.Run "$path", 0
|
||||
Set WshShell = Nothing
|
||||
""".trimIndent()
|
||||
val scriptPath = Paths.get("startProcess.vbs")
|
||||
Files.writeString(scriptPath, script)
|
||||
val processBuilder = ProcessBuilder("cmd", "/c", "start", "cscript", scriptPath.toString())
|
||||
processBuilder.start()
|
||||
} else {
|
||||
// Unix-like approach
|
||||
val processBuilder = ProcessBuilder("sh", "-c", "nohup $path > /dev/null 2>&1 &")
|
||||
processBuilder.start()
|
||||
}
|
||||
} catch (e: IOException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
suspend fun startBinaryWithRetry(path: String) {
|
||||
var attempts = 0
|
||||
while (attempts < 5) {
|
||||
try {
|
||||
// Your suspend function call here
|
||||
runBinary(path)
|
||||
break // If the function call is successful, break the loop
|
||||
} catch (e: Exception) {
|
||||
attempts++
|
||||
delay(500)
|
||||
if (attempts == 5) throw e // If this was the last attempt, rethrow the exception
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun getContinueServerUrl(): String {
|
||||
val settings =
|
||||
ServiceManager.getService(ContinueExtensionSettings::class.java)
|
||||
return settings.continueState.serverUrl
|
||||
}
|
||||
|
||||
suspend fun startContinuePythonServer(project: Project) {
|
||||
println("server starting")
|
||||
val continuePluginService = ServiceManager.getService(
|
||||
project,
|
||||
ContinuePluginService::class.java
|
||||
)
|
||||
|
||||
val settings =
|
||||
ServiceManager.getService(ContinueExtensionSettings::class.java)
|
||||
val serverUrl = getContinueServerUrl()
|
||||
|
||||
if ((serverUrl != CONTINUE_PYTHON_SERVER_URL && serverUrl != "http://127.0.0.1:65432") || settings.continueState.manuallyRunningServer) {
|
||||
continuePluginService.dispatchCustomEvent("serverStatus", mutableMapOf(
|
||||
"type" to "serverStatus",
|
||||
"message" to "Connecting to Continue Server"
|
||||
))
|
||||
|
||||
println("Continue server being run manually, skipping start")
|
||||
return
|
||||
}
|
||||
|
||||
if (checkOrKillRunningServer(project)) {
|
||||
continuePluginService.dispatchCustomEvent("serverStatus", mutableMapOf(
|
||||
"type" to "serverStatus",
|
||||
"message" to "Connecting to Continue Server"
|
||||
))
|
||||
println("Continue server already running")
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
// Determine from OS details which file to download
|
||||
val filename = when {
|
||||
System.getProperty("os.name")
|
||||
.toLowerCase().contains("win") -> "windows/continue_server.exe"
|
||||
System.getProperty("os.name").startsWith("Mac", ignoreCase = true) ->
|
||||
if (System.getProperty("os.arch") == "arm64") "apple-silicon/continue_server" else "mac/continue_server"
|
||||
else -> "linux/continue_server"
|
||||
}
|
||||
|
||||
val destination = serverBinaryPath()
|
||||
|
||||
// Check whether the binary needs to be downloaded
|
||||
var shouldDownload = true
|
||||
if (File(destination).exists()) {
|
||||
if (File(serverVersionPath()).exists()) {
|
||||
val serverVersion = File(serverVersionPath()).readText()
|
||||
if (serverVersion == getExtensionVersion()) {
|
||||
println("Continue server already downloaded")
|
||||
shouldDownload = false
|
||||
} else {
|
||||
println("Old version of the server downloaded, removing")
|
||||
File(destination).delete()
|
||||
}
|
||||
} else {
|
||||
println("Old version of the server downloaded, removing")
|
||||
File(destination).delete()
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldDownload) {
|
||||
continuePluginService.dispatchCustomEvent("serverStatus", mutableMapOf(
|
||||
"type" to "serverStatus",
|
||||
"message" to "Downloading Continue server binary"
|
||||
))
|
||||
|
||||
println("Downloading Continue Server Binary")
|
||||
// Download the binary from S3
|
||||
try {
|
||||
downloadFromS3(
|
||||
"continue-server-binaries",
|
||||
filename,
|
||||
destination,
|
||||
"us-west-1",
|
||||
false
|
||||
)
|
||||
} catch (e: Exception) {
|
||||
continuePluginService.dispatchCustomEvent("serverStatus", mutableMapOf(
|
||||
"type" to "serverStatus",
|
||||
"message" to "First download failed, attempting backup"
|
||||
))
|
||||
try {
|
||||
downloadFromS3(
|
||||
"continue-server-binaries",
|
||||
filename,
|
||||
destination,
|
||||
"us-west-1",
|
||||
true
|
||||
)
|
||||
} catch (e: Exception) {
|
||||
continuePluginService.dispatchCustomEvent("serverStatus", mutableMapOf(
|
||||
"type" to "serverStatus",
|
||||
"message" to "Failed to download Continue server binary: ${e.message}"
|
||||
))
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Set permissions on the binary
|
||||
setPermissions(destination)
|
||||
}
|
||||
|
||||
// Validate that the binary exists
|
||||
if (!File(destination).exists()) {
|
||||
continuePluginService.dispatchCustomEvent("serverStatus", mutableMapOf(
|
||||
"type" to "serverStatus",
|
||||
"message" to "Failed to download Continue server binary"
|
||||
))
|
||||
|
||||
throw Error("Failed to download Continue server binary")
|
||||
}
|
||||
|
||||
// Spawn server process
|
||||
continuePluginService.dispatchCustomEvent("serverStatus", mutableMapOf(
|
||||
"type" to "serverStatus",
|
||||
"message" to "Launching Continue Server"
|
||||
))
|
||||
println("Starting Continue server binary")
|
||||
startBinaryWithRetry(destination)
|
||||
|
||||
// Write the server version to server_version.txt
|
||||
File(serverVersionPath()).writeText(getExtensionVersion())
|
||||
|
||||
// Wait for the server process to start
|
||||
println("Waiting for Continue server to start...")
|
||||
var i = 1
|
||||
while (getProcessId(CONTINUE_SERVER_WEBSOCKET_PORT) == null) {
|
||||
delay(1000)
|
||||
continuePluginService.dispatchCustomEvent("serverStatus", mutableMapOf(
|
||||
"type" to "serverStatus",
|
||||
"message" to "Launching Continue Server" + ".".repeat(i % 4)
|
||||
))
|
||||
i++
|
||||
}
|
||||
println("Continue server started")
|
||||
}
|
||||
|
||||
class WelcomeDialogWrapper(val project: Project) : DialogWrapper(true) {
|
||||
private var panel: JPanel? = null
|
||||
private var paragraph: JTextArea? = null
|
||||
|
|
@ -530,21 +148,19 @@ class ContinuePluginStartupActivity : StartupActivity, Disposable, DumbAware {
|
|||
}
|
||||
|
||||
// Show the welcome dialog
|
||||
withContext(Dispatchers.Main) {
|
||||
val dialog = WelcomeDialogWrapper(project)
|
||||
dialog.show()
|
||||
}
|
||||
settings.continueState.shownWelcomeDialog = true
|
||||
// withContext(Dispatchers.Main) {
|
||||
// val dialog = WelcomeDialogWrapper(project)
|
||||
// dialog.show()
|
||||
// }
|
||||
// settings.continueState.shownWelcomeDialog = true
|
||||
}
|
||||
|
||||
GlobalScope.async(Dispatchers.IO) {
|
||||
startContinuePythonServer(project)
|
||||
|
||||
val ideProtocolClient = IdeProtocolClient(
|
||||
continuePluginService,
|
||||
defaultStrategy,
|
||||
coroutineScope,
|
||||
project.basePath ?: "/",
|
||||
project.basePath,
|
||||
project
|
||||
)
|
||||
|
||||
|
|
@ -569,9 +185,13 @@ class ContinuePluginStartupActivity : StartupActivity, Disposable, DumbAware {
|
|||
this@ContinuePluginStartupActivity
|
||||
)
|
||||
|
||||
try {
|
||||
startProxyServer()
|
||||
} catch (e: Exception) {
|
||||
println(e)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,140 @@
|
|||
package com.github.continuedev.continueintellijextension.constants
|
||||
|
||||
const val CONTINUE_PYTHON_SERVER_URL = "http://localhost:65432"
|
||||
const val CONTINUE_SERVER_WEBSOCKET_PORT = 65432
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.Paths
|
||||
|
||||
const val DEFAULT_CONFIG = """
|
||||
{
|
||||
models: [
|
||||
{
|
||||
title: "GPT-4",
|
||||
provider: "openai-free-trial",
|
||||
model: "gpt-4",
|
||||
},
|
||||
{
|
||||
title: "GPT-3.5-Turbo",
|
||||
provider: "openai-free-trial",
|
||||
model: "gpt-3.5-turbo",
|
||||
},
|
||||
],
|
||||
modelRoles: {
|
||||
default: "GPT-4",
|
||||
summarize: "GPT-3.5-Turbo",
|
||||
},
|
||||
slashCommands: [
|
||||
{
|
||||
name: "edit",
|
||||
description: "Edit highlighted code",
|
||||
step: "EditHighlightedCodeStep",
|
||||
},
|
||||
{
|
||||
name: "comment",
|
||||
description: "Write comments for the highlighted code",
|
||||
step: "CommentCodeStep",
|
||||
},
|
||||
{
|
||||
name: "share",
|
||||
description: "Download and share this session",
|
||||
step: "ShareSessionStep",
|
||||
},
|
||||
{
|
||||
name: "cmd",
|
||||
description: "Generate a shell command",
|
||||
step: "GenerateShellCommandStep",
|
||||
},
|
||||
],
|
||||
customCommands: [
|
||||
{
|
||||
name: "test",
|
||||
prompt:
|
||||
"Write a comprehensive set of unit tests for the selected code. It should setup, run tests that check for correctness including important edge cases, and teardown. Ensure that the tests are complete and sophisticated. Give the tests just as chat output, don't edit any file.",
|
||||
description: "Write unit tests for highlighted code",
|
||||
},
|
||||
],
|
||||
contextProviders: [
|
||||
{ name: "diff", params: {} },
|
||||
{
|
||||
name: "open",
|
||||
params: {},
|
||||
},
|
||||
{ name: "terminal", params: {} },
|
||||
],
|
||||
}
|
||||
"""
|
||||
|
||||
const val DEFAULT_CONFIG_JS = """
|
||||
function modifyConfig(config) {
|
||||
return config;
|
||||
}
|
||||
export {
|
||||
modifyConfig
|
||||
};
|
||||
"""
|
||||
|
||||
fun getContinueGlobalPath(): String {
|
||||
val continuePath = Paths.get(System.getProperty("user.home"), ".continue")
|
||||
if (Files.notExists(continuePath)) {
|
||||
Files.createDirectories(continuePath)
|
||||
}
|
||||
return continuePath.toString()
|
||||
}
|
||||
|
||||
fun getConfigJsonPath(): String {
|
||||
val path = Paths.get(getContinueGlobalPath(), "config.json")
|
||||
if (Files.notExists(path)) {
|
||||
Files.createFile(path)
|
||||
Files.writeString(path, DEFAULT_CONFIG);
|
||||
}
|
||||
return path.toString()
|
||||
}
|
||||
|
||||
fun getConfigJsPath(): String {
|
||||
val path = Paths.get(getContinueGlobalPath(), "config.js")
|
||||
if (Files.notExists(path)) {
|
||||
Files.createFile(path)
|
||||
Files.writeString(path, DEFAULT_CONFIG_JS);
|
||||
}
|
||||
return path.toString()
|
||||
}
|
||||
|
||||
fun getSessionsDir(): String {
|
||||
val path = Paths.get(getContinueGlobalPath(), "sessions")
|
||||
if (Files.notExists(path)) {
|
||||
Files.createDirectories(path)
|
||||
}
|
||||
return path.toString()
|
||||
}
|
||||
|
||||
fun getSessionsListPath(): String {
|
||||
val path = Paths.get(getSessionsDir(), "sessions.json")
|
||||
if (Files.notExists(path)) {
|
||||
Files.createFile(path)
|
||||
Files.writeString(path, "[]");
|
||||
}
|
||||
return path.toString()
|
||||
}
|
||||
|
||||
fun getSessionFilePath(sessionId: String): String {
|
||||
val path = Paths.get(getSessionsDir(), "$sessionId.json")
|
||||
if (Files.notExists(path)) {
|
||||
Files.createFile(path)
|
||||
Files.writeString(path, "{}");
|
||||
}
|
||||
return path.toString()
|
||||
}
|
||||
|
||||
fun devDataPath(): String {
|
||||
val path = Paths.get(getContinueGlobalPath(), "dev_data")
|
||||
if (Files.notExists(path)) {
|
||||
Files.createDirectories(path)
|
||||
}
|
||||
return path.toString()
|
||||
}
|
||||
|
||||
fun getDevDataFilepath(filename: String): String {
|
||||
val path = Paths.get(devDataPath(), filename)
|
||||
if (Files.notExists(path)) {
|
||||
Files.createFile(path)
|
||||
}
|
||||
return path.toString()
|
||||
}
|
||||
|
|
@ -0,0 +1,105 @@
|
|||
package com.github.continuedev.continueintellijextension.`continue`
|
||||
import com.github.continuedev.continueintellijextension.constants.getSessionFilePath
|
||||
import com.github.continuedev.continueintellijextension.constants.getSessionsListPath
|
||||
import com.google.gson.Gson
|
||||
import com.google.gson.reflect.TypeToken
|
||||
import java.io.File
|
||||
import java.io.FileReader
|
||||
import java.io.FileWriter
|
||||
import java.lang.reflect.Type
|
||||
|
||||
typealias PersistedSessionInfo = MutableMap<String, Any>
|
||||
typealias SessionInfo = MutableMap<String, Any>
|
||||
class HistoryManager {
|
||||
private val gson = Gson()
|
||||
|
||||
fun list(): List<PersistedSessionInfo> {
|
||||
val filePath = getSessionsListPath()
|
||||
val file = File(filePath)
|
||||
|
||||
if (!file.exists()) {
|
||||
return emptyList()
|
||||
}
|
||||
|
||||
val reader = FileReader(file)
|
||||
val type: Type = object : TypeToken<List<PersistedSessionInfo>>() {}.type
|
||||
val sessions = gson.fromJson<List<PersistedSessionInfo>>(reader, type)
|
||||
|
||||
return sessions.filter { it["sessionId"] != null }
|
||||
}
|
||||
|
||||
fun delete(sessionId: String) {
|
||||
val sessionFile = getSessionFilePath(sessionId)
|
||||
val file = File(sessionFile)
|
||||
|
||||
if (!file.exists()) {
|
||||
throw Exception("Session file $sessionFile does not exist")
|
||||
}
|
||||
|
||||
file.delete()
|
||||
val sessionsListFile = getSessionsListPath()
|
||||
val sessionsListRaw = FileReader(File(sessionsListFile))
|
||||
|
||||
val type: Type = object : TypeToken<List<SessionInfo>>() {}.type
|
||||
var sessionsList = gson.fromJson<List<SessionInfo>>(sessionsListRaw, type)
|
||||
|
||||
sessionsList = sessionsList.filter { it["sessionId"] != sessionId }
|
||||
|
||||
val writer = FileWriter(sessionsListFile)
|
||||
gson.toJson(sessionsList, writer)
|
||||
writer.close()
|
||||
}
|
||||
|
||||
fun load(sessionId: String): PersistedSessionInfo {
|
||||
val sessionFile = getSessionFilePath(sessionId)
|
||||
val file = File(sessionFile)
|
||||
|
||||
if (!file.exists()) {
|
||||
throw Exception("Session file $sessionFile does not exist")
|
||||
}
|
||||
|
||||
val reader = FileReader(file)
|
||||
val text = reader.readText()
|
||||
val type: Type = object : TypeToken<MutableMap<String, Any>>() {}.type
|
||||
val session = gson.fromJson<MutableMap<String, Any>>(text, type)
|
||||
session["sessionId"] = sessionId
|
||||
return session
|
||||
}
|
||||
|
||||
fun save(session: PersistedSessionInfo) {
|
||||
val writer = FileWriter(getSessionFilePath(session["sessionId"] as String? ?: uuid()))
|
||||
gson.toJson(session, writer)
|
||||
writer.close()
|
||||
|
||||
val sessionsListFilePath = getSessionsListPath()
|
||||
val rawSessionsList = FileReader(File(sessionsListFilePath))
|
||||
|
||||
val type: Type = object : TypeToken<List<SessionInfo>>() {}.type
|
||||
val sessionsList = gson.fromJson<List<MutableMap<String, Any>>>(rawSessionsList, type).toMutableList()
|
||||
|
||||
var found = false
|
||||
for (sessionInfo in sessionsList) {
|
||||
if (sessionInfo["sessionId"] == session["sessionId"]) {
|
||||
sessionInfo["title"] = session["title"] as Any
|
||||
sessionInfo["workspaceDirectory"] = session["workspaceDirectory"] as Any
|
||||
sessionInfo["dateCreated"] = System.currentTimeMillis().toString()
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
val sessionInfo = mutableMapOf(
|
||||
"sessionId" to session["sessionId"],
|
||||
"title" to session["title"],
|
||||
"dateCreated" to System.currentTimeMillis().toString(),
|
||||
"workspaceDirectory" to session["workspaceDirectory"]
|
||||
) as MutableMap<String, Any>
|
||||
sessionsList.add(sessionInfo)
|
||||
}
|
||||
|
||||
val writerList = FileWriter(sessionsListFilePath)
|
||||
gson.toJson(sessionsList, writerList)
|
||||
writerList.close()
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +1,14 @@
|
|||
package com.github.continuedev.continueintellijextension.`continue`
|
||||
|
||||
import com.github.continuedev.continueintellijextension.*
|
||||
import com.github.continuedev.continueintellijextension.activities.getContinueServerUrl
|
||||
import com.github.continuedev.continueintellijextension.constants.getConfigJsPath
|
||||
import com.github.continuedev.continueintellijextension.constants.getConfigJsonPath
|
||||
import com.github.continuedev.continueintellijextension.constants.getContinueGlobalPath
|
||||
import com.github.continuedev.continueintellijextension.constants.getDevDataFilepath
|
||||
import com.github.continuedev.continueintellijextension.services.ContinuePluginService
|
||||
import com.google.gson.Gson
|
||||
import com.google.gson.GsonBuilder
|
||||
import com.google.gson.JsonObject
|
||||
import com.google.gson.reflect.TypeToken
|
||||
import com.intellij.openapi.application.ApplicationInfo
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
|
|
@ -16,7 +21,6 @@ import com.intellij.openapi.project.Project
|
|||
import com.intellij.openapi.ui.MessageType
|
||||
import com.intellij.openapi.ui.popup.Balloon
|
||||
import com.intellij.openapi.ui.popup.JBPopupFactory
|
||||
import com.intellij.openapi.util.Computable
|
||||
import com.intellij.openapi.vfs.LocalFileSystem
|
||||
import com.intellij.openapi.vfs.VfsUtil
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
|
|
@ -24,19 +28,16 @@ import com.intellij.openapi.vfs.VirtualFileManager
|
|||
import com.intellij.openapi.wm.WindowManager
|
||||
import com.intellij.testFramework.LightVirtualFile
|
||||
import com.intellij.ui.awt.RelativePoint
|
||||
import io.socket.client.Ack
|
||||
import io.socket.client.IO
|
||||
import io.socket.client.Socket
|
||||
import io.socket.emitter.Emitter;
|
||||
import kotlinx.coroutines.*
|
||||
import okhttp3.*
|
||||
import net.minidev.json.JSONObject
|
||||
import java.io.File
|
||||
import java.io.FileInputStream
|
||||
import java.io.IOException
|
||||
import java.io.FileReader
|
||||
import java.io.FileWriter
|
||||
import java.net.NetworkInterface
|
||||
import java.net.URI
|
||||
import java.net.URLEncoder
|
||||
import java.nio.charset.Charset
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.Paths
|
||||
import java.util.*
|
||||
|
||||
|
||||
|
|
@ -45,23 +46,15 @@ fun uuid(): String {
|
|||
}
|
||||
|
||||
|
||||
data class WebSocketMessage<T>(val message_type: String, val message_id: String, val data: T)
|
||||
data class WorkspaceDirectory(val workspaceDirectory: String)
|
||||
data class UniqueId(val uniqueId: String)
|
||||
data class ReadFile(val contents: String)
|
||||
data class VisibleFiles(val visibleFiles: List<String>)
|
||||
data class IdeMessage<T>(val type: String, val messageId: String, val message: T)
|
||||
data class Position(val line: Int, val character: Int)
|
||||
data class Range(val start: Position, val end: Position)
|
||||
data class RangeInFile(val filepath: String, val range: Range)
|
||||
data class GetTerminalContents(val contents: String)
|
||||
data class ListDirectoryContents(val contents: List<String>)
|
||||
data class RangeInFileWithContents(val filepath: String, val range: Range, val contents: String)
|
||||
data class HighlightedCodeUpdate(val highlightedCode: List<RangeInFileWithContents>, val edit: Boolean)
|
||||
data class HighlightedCode(val highlightedCode: List<RangeInFile>)
|
||||
data class AcceptRejectDiff(val accepted: Boolean, val stepIndex: Int)
|
||||
data class DeleteAtIndex(val index: Int)
|
||||
data class MainUserInput(val input: String)
|
||||
data class IdeInfo(val name: String, val version: String?, val remoteName: String?)
|
||||
|
||||
fun getMachineUniqueID(): String {
|
||||
val sb = StringBuilder()
|
||||
|
|
@ -92,62 +85,53 @@ class IdeProtocolClient (
|
|||
private val continuePluginService: ContinuePluginService,
|
||||
private val textSelectionStrategy: TextSelectionStrategy,
|
||||
private val coroutineScope: CoroutineScope,
|
||||
private val workspacePath: String,
|
||||
private val workspacePath: String?,
|
||||
private val project: Project
|
||||
): DumbAware {
|
||||
private var webSocket: WebSocket? = null
|
||||
|
||||
private var socket: Socket? = null
|
||||
|
||||
val diffManager = DiffManager(project)
|
||||
|
||||
init {
|
||||
initWebSocket()
|
||||
initIdeProtocol()
|
||||
}
|
||||
|
||||
private fun serializeMessage(data: Map<String, Any>): String {
|
||||
val gson = Gson()
|
||||
return gson.toJson(data)
|
||||
}
|
||||
|
||||
private fun send(messageType: String, messageId: String, data: Any) {
|
||||
val wsMessage = WebSocketMessage(
|
||||
private fun send(messageType: String, data: Any?, messageId: String? = null) {
|
||||
val id = messageId ?: uuid()
|
||||
val message = IdeMessage(
|
||||
messageType,
|
||||
messageId,
|
||||
id,
|
||||
data
|
||||
)
|
||||
socket?.send("message", Gson().toJson(wsMessage))
|
||||
val json = Gson().toJson(message)
|
||||
continuePluginService.dispatchCustomEvent(json)
|
||||
}
|
||||
|
||||
private fun handleWebsocketMessage(text: String, respond: (String, String, Any) -> Unit) {
|
||||
fun handleWebsocketMessage(text: String) {
|
||||
coroutineScope.launch(Dispatchers.IO) {
|
||||
val parsedMessage: Map<String, Any> = Gson().fromJson(
|
||||
text,
|
||||
object : TypeToken<Map<String, Any>>() {}.type
|
||||
)
|
||||
val messageType = parsedMessage["message_type"] as? String
|
||||
val messageId = parsedMessage["message_id"] as? String
|
||||
if (messageId == null) {
|
||||
|
||||
println("Received message without messageId: $text")
|
||||
val messageType = parsedMessage["type"] as? String
|
||||
if (messageType == null) {
|
||||
println("Recieved message without type: $text")
|
||||
return@launch
|
||||
}
|
||||
val data = parsedMessage["data"] as Map<*, *>
|
||||
|
||||
// fun respond(t: String, a: String, b: Any) {
|
||||
//
|
||||
// }
|
||||
fun respond(responseData: Any?) {
|
||||
if (data["messageId"] == null) {
|
||||
println("Recieved message without messageId: $text")
|
||||
return
|
||||
}
|
||||
send(messageType, responseData, data["messageId"] as String);
|
||||
}
|
||||
|
||||
val historyManager = HistoryManager()
|
||||
|
||||
try {
|
||||
when (messageType) {
|
||||
"workspaceDirectory" -> {
|
||||
respond("workspaceDirectory", messageId, WorkspaceDirectory(workspaceDirectory()))
|
||||
}
|
||||
|
||||
"uniqueId" -> respond(
|
||||
"uniqueId",
|
||||
messageId,
|
||||
UniqueId(uniqueId())
|
||||
mapOf("uniqueId" to uniqueId())
|
||||
)
|
||||
|
||||
"ide" -> {
|
||||
|
|
@ -157,15 +141,15 @@ class IdeProtocolClient (
|
|||
val sshClient = System.getenv("SSH_CLIENT")
|
||||
val sshTty = System.getenv("SSH_TTY")
|
||||
|
||||
var remoteName: String? = null
|
||||
var remoteName: String = "local"
|
||||
if (sshClient != null || sshTty != null) {
|
||||
remoteName = "ssh"
|
||||
}
|
||||
respond(
|
||||
"ide",
|
||||
messageId,
|
||||
IdeInfo(ideName, ideVersion, remoteName)
|
||||
)
|
||||
respond(mapOf(
|
||||
"name" to ideName,
|
||||
"version" to ideVersion,
|
||||
"remoteName" to remoteName
|
||||
))
|
||||
}
|
||||
|
||||
"showDiff" -> {
|
||||
|
|
@ -177,41 +161,39 @@ class IdeProtocolClient (
|
|||
}
|
||||
|
||||
"readFile" -> {
|
||||
val msg =
|
||||
ReadFile(readFile(data["filepath"] as String))
|
||||
respond(
|
||||
"readFile",
|
||||
messageId,
|
||||
msg
|
||||
)
|
||||
val msg = readFile((data["message"] as Map<String, String>)["filepath"] as String)
|
||||
respond(msg)
|
||||
}
|
||||
|
||||
"listDirectoryContents" -> {
|
||||
respond(
|
||||
"listDirectoryContents",
|
||||
messageId,
|
||||
ListDirectoryContents(listDirectoryContents())
|
||||
mapOf("contents" to listDirectoryContents())
|
||||
)
|
||||
}
|
||||
|
||||
"listWorkspaceContents" -> {
|
||||
respond(listDirectoryContents())
|
||||
}
|
||||
|
||||
"getWorkspaceDirs" -> {
|
||||
respond(workspaceDirectories())
|
||||
}
|
||||
|
||||
"getTerminalContents" -> {
|
||||
respond(
|
||||
"getTerminalContents",
|
||||
messageId,
|
||||
GetTerminalContents("Terminal cannot be accessed in JetBrains IDE")
|
||||
mapOf("contents" to "Terminal cannot be accessed in JetBrains IDE")
|
||||
)
|
||||
}
|
||||
|
||||
"visibleFiles" -> {
|
||||
val msg = VisibleFiles(visibleFiles())
|
||||
respond(
|
||||
"visibleFiles",
|
||||
messageId,
|
||||
msg
|
||||
mapOf("visibleFiles" to visibleFiles())
|
||||
)
|
||||
}
|
||||
|
||||
"saveFile" -> saveFile(data["filepath"] as String)
|
||||
"saveFile" -> {
|
||||
saveFile((data["message"] as Map<String, String>)["filepath"] ?: throw Exception("No filepath provided"))
|
||||
}
|
||||
"showVirtualFile" -> showVirtualFile(
|
||||
data["name"] as String,
|
||||
data["contents"] as String
|
||||
|
|
@ -242,13 +224,121 @@ class IdeProtocolClient (
|
|||
val rif = RangeInFile(rifWithContents.filepath, rifWithContents.range)
|
||||
rifs += rif
|
||||
}
|
||||
respond(
|
||||
"highlightedCode",
|
||||
messageId,
|
||||
HighlightedCode(rifs)
|
||||
)
|
||||
respond(mapOf("highlightedCode" to rifs))
|
||||
}
|
||||
|
||||
|
||||
// NEW //
|
||||
"getDiff" -> {
|
||||
respond("");
|
||||
}
|
||||
"getSerializedConfig" -> {
|
||||
val configPath = getConfigJsonPath()
|
||||
val config = File(configPath).readText()
|
||||
val mapType = object : TypeToken<Map<String, Any>>() {}.type
|
||||
val parsed: Map<String, Any> = Gson().fromJson(config, mapType)
|
||||
respond(parsed)
|
||||
}
|
||||
"getConfigJsUrl" -> {
|
||||
// Calculate a data URL for the config.js file
|
||||
val configJsPath = getConfigJsPath()
|
||||
val configJsContents = File(configJsPath).readText()
|
||||
val configJsDataUrl = "data:text/javascript;base64,${Base64.getEncoder().encodeToString(configJsContents.toByteArray())}"
|
||||
respond(configJsDataUrl)
|
||||
}
|
||||
"writeFile" -> {
|
||||
val msg = data["message"] as Map<String, String>;
|
||||
val file = File(msg["path"])
|
||||
file.writeText(msg["contents"] as String)
|
||||
respond(null);
|
||||
}
|
||||
"getContinueDir" -> {
|
||||
respond(getContinueGlobalPath())
|
||||
}
|
||||
"openFile" -> {
|
||||
setFileOpen((data["message"] as Map<String, Any>)["path"] as String)
|
||||
respond(null)
|
||||
}
|
||||
"runCommand" -> {
|
||||
respond(null)
|
||||
// Running commands not yet supported in JetBrains
|
||||
}
|
||||
"errorPopup" -> {
|
||||
showMessage(data["message"] as String)
|
||||
}
|
||||
|
||||
// History
|
||||
"history" -> {
|
||||
respond(historyManager.list());
|
||||
}
|
||||
"saveSession" -> {
|
||||
historyManager.save(data["message"] as PersistedSessionInfo);
|
||||
respond(null);
|
||||
}
|
||||
"deleteSession" -> {
|
||||
historyManager.delete(data["message"] as String);
|
||||
respond(null);
|
||||
}
|
||||
"loadSession" -> {
|
||||
val session = historyManager.load(data["message"] as String)
|
||||
respond(session)
|
||||
}
|
||||
|
||||
// Other
|
||||
"getOpenFiles" -> {
|
||||
val openFiles = visibleFiles()
|
||||
respond(openFiles)
|
||||
}
|
||||
"logDevData" -> {
|
||||
val filename = data["tableName"] as String
|
||||
val jsonLine = data["data"]
|
||||
val filepath = getDevDataFilepath(filename)
|
||||
val contents = Gson().toJson(jsonLine) + "\n"
|
||||
File(filepath).appendText(contents)
|
||||
}
|
||||
"addModel" -> {
|
||||
val model = data["model"] as Map<String, Any>
|
||||
val updatedConfig = editConfigJson {
|
||||
val models = it["models"] as MutableList<Map<String, Any>>
|
||||
models.add(model)
|
||||
it
|
||||
}
|
||||
|
||||
configUpdate(updatedConfig)
|
||||
setFileOpen(getConfigJsonPath())
|
||||
}
|
||||
"deleteModel" -> {
|
||||
val configJson = editConfigJson { config ->
|
||||
var models: MutableList<Map<String, Any>> = config["models"] as MutableList<Map<String, Any>>
|
||||
|
||||
val model = data["title"] as String
|
||||
models = models.filter { it["title"] != model }.toMutableList()
|
||||
config["models"] = models
|
||||
config
|
||||
}
|
||||
configUpdate(configJson)
|
||||
}
|
||||
"addOpenAIKey" -> {
|
||||
val updatedConfig = editConfigJson { config ->
|
||||
val key = data["key"] as String
|
||||
var models = config["models"] as MutableList<MutableMap<String, Any>>
|
||||
models = models.map {
|
||||
if (it["provider"] == "openai-free-trial") {
|
||||
it["apiKey"] = key
|
||||
it["provider"] = "openai"
|
||||
it
|
||||
} else {
|
||||
it
|
||||
}
|
||||
}.toMutableList()
|
||||
config["models"] = models
|
||||
config
|
||||
}
|
||||
configUpdate(updatedConfig)
|
||||
}
|
||||
|
||||
|
||||
|
||||
else -> {
|
||||
println("Unknown messageType: $messageType")
|
||||
}
|
||||
|
|
@ -259,7 +349,35 @@ class IdeProtocolClient (
|
|||
}
|
||||
}
|
||||
|
||||
private fun initWebSocket() {
|
||||
private fun configUpdate(config: Map<String, Any>) {
|
||||
val data = mapOf(
|
||||
"type" to "configUpdate",
|
||||
"config" to config
|
||||
)
|
||||
val json = Gson().toJson(data)
|
||||
continuePluginService.dispatchCustomEvent(json)
|
||||
}
|
||||
|
||||
private fun editConfigJson(callback: (config: MutableMap<String, Any>) -> Map<String, Any>): Map<String, Any> {
|
||||
val gson = GsonBuilder().setPrettyPrinting().create()
|
||||
val configJsonPath = getConfigJsonPath()
|
||||
val reader = FileReader(configJsonPath)
|
||||
val config: MutableMap<String, Any> = gson.fromJson(
|
||||
reader,
|
||||
object : TypeToken<Map<String, Any>>() {}.type
|
||||
)
|
||||
reader.close()
|
||||
|
||||
val editedConfig = callback(config)
|
||||
|
||||
val writer = FileWriter(configJsonPath)
|
||||
gson.toJson(editedConfig, writer)
|
||||
writer.close()
|
||||
|
||||
return editedConfig
|
||||
}
|
||||
|
||||
private fun initIdeProtocol() {
|
||||
val applicationInfo = ApplicationInfo.getInstance()
|
||||
val ideName: String = applicationInfo.fullApplicationName
|
||||
val ideVersion = applicationInfo.fullVersion
|
||||
|
|
@ -277,76 +395,21 @@ class IdeProtocolClient (
|
|||
)
|
||||
|
||||
val windowInfo = mapOf(
|
||||
"window_id" to continuePluginService.windowId,
|
||||
"workspace_directory" to workspaceDirectory(),
|
||||
"unique_id" to uniqueId(),
|
||||
"ide_info" to IDEInfo(
|
||||
name = ideName,
|
||||
version = ideVersion,
|
||||
remote_name = remoteName ?: ""
|
||||
),
|
||||
"server_url" to getContinueServerUrl()
|
||||
"window_id" to continuePluginService.windowId,
|
||||
"unique_id" to uniqueId(),
|
||||
"ide_info" to IDEInfo(
|
||||
name = ideName,
|
||||
version = ideVersion,
|
||||
remote_name = remoteName ?: ""
|
||||
),
|
||||
)
|
||||
|
||||
val requestUrl = "${getContinueServerUrl()}/?window_info=${
|
||||
URLEncoder.encode(
|
||||
Gson().toJson(windowInfo), "UTF-8"
|
||||
)}"
|
||||
|
||||
val uri: URI = URI.create(requestUrl)
|
||||
val options: IO.Options = IO.Options.builder()
|
||||
.setPath("/ide/socket.io")
|
||||
.setTransports(arrayOf("websocket", "polling", "flashsocket"))
|
||||
.build()
|
||||
|
||||
val socket: Socket = IO.socket(uri, options)
|
||||
|
||||
socket.on(Socket.EVENT_CONNECT) {
|
||||
println("Connected to Continue IDE websocket")
|
||||
}
|
||||
|
||||
socket.on(Socket.EVENT_DISCONNECT) {
|
||||
println("Disconnected from Continue IDE websocket")
|
||||
}
|
||||
|
||||
socket.on(Socket.EVENT_CONNECT_ERROR, { args ->
|
||||
println("Error connecting to Continue IDE websocket")
|
||||
println(args[0].toString())
|
||||
})
|
||||
|
||||
|
||||
socket.on("message") { args ->
|
||||
val data = args[0].toString()
|
||||
if (args.size == 1) {
|
||||
println("Received message without ack: $data")
|
||||
return@on
|
||||
}
|
||||
val ack = args[args.size - 1] as Ack
|
||||
fun respond(messageType: String, messageId: String, data: Any) {
|
||||
val wsMessage = WebSocketMessage(
|
||||
messageType,
|
||||
messageId,
|
||||
data
|
||||
)
|
||||
ack.call(Gson().toJson(wsMessage))
|
||||
}
|
||||
handleWebsocketMessage(data, ::respond)
|
||||
// ack.call()
|
||||
}
|
||||
|
||||
socket.connect()
|
||||
this.socket = socket
|
||||
}
|
||||
|
||||
|
||||
private fun sendMessage(messageType: String, message: Map<String, Any>) {
|
||||
val sendData = mapOf("message_type" to messageType, "data" to message)
|
||||
val jsonMessage = serializeMessage(sendData)
|
||||
webSocket?.send(jsonMessage)
|
||||
}
|
||||
|
||||
private fun workspaceDirectory(): String {
|
||||
return this.workspacePath
|
||||
private fun workspaceDirectories(): Array<String> {
|
||||
if (this.workspacePath != null) {
|
||||
return arrayOf(this.workspacePath)
|
||||
}
|
||||
return arrayOf<String>();
|
||||
}
|
||||
|
||||
fun uniqueId(): String {
|
||||
|
|
@ -397,6 +460,10 @@ class IdeProtocolClient (
|
|||
}
|
||||
}
|
||||
|
||||
fun readRangeInFile(rangeInFile: RangeInFile): String {
|
||||
return "TODO"
|
||||
}
|
||||
|
||||
|
||||
private fun getHighlightedCode(): RangeInFileWithContents? {
|
||||
val result = ApplicationManager.getApplication().runReadAction<RangeInFileWithContents?> {
|
||||
|
|
@ -439,28 +506,28 @@ class IdeProtocolClient (
|
|||
// edit
|
||||
// ))
|
||||
|
||||
continuePluginService.dispatchCustomEvent("highlightedCode",
|
||||
mapOf(
|
||||
continuePluginService.dispatchCustomEvent(
|
||||
Gson().toJson(mapOf(
|
||||
"type" to "highlightedCode",
|
||||
"rangeInFileWithContents" to rif,
|
||||
"edit" to edit
|
||||
))
|
||||
)))
|
||||
}
|
||||
|
||||
fun sendMainUserInput(input: String) {
|
||||
continuePluginService.dispatchCustomEvent("userInput",
|
||||
mapOf(
|
||||
val data = mapOf(
|
||||
"type" to "userInput",
|
||||
"input" to input,
|
||||
))
|
||||
)
|
||||
continuePluginService.dispatchCustomEvent(Gson().toJson(data))
|
||||
}
|
||||
|
||||
fun sendAcceptRejectDiff(accepted: Boolean, stepIndex: Int) {
|
||||
send("acceptRejectDiff", uuid(), AcceptRejectDiff(accepted, stepIndex))
|
||||
send("acceptRejectDiff", AcceptRejectDiff(accepted, stepIndex), uuid())
|
||||
}
|
||||
|
||||
fun deleteAtIndex(index: Int) {
|
||||
send("deleteAtIndex", uuid(), DeleteAtIndex(index))
|
||||
send("deleteAtIndex", DeleteAtIndex(index), uuid())
|
||||
}
|
||||
|
||||
private val DEFAULT_IGNORE_DIRS = listOf(
|
||||
|
|
@ -491,20 +558,25 @@ class IdeProtocolClient (
|
|||
|
||||
|
||||
private fun listDirectoryContents(): List<String> {
|
||||
val workspacePath = File(workspaceDirectory())
|
||||
val workspaceDir = VirtualFileManager.getInstance().findFileByUrl("file://$workspacePath")
|
||||
|
||||
val dirs = workspaceDirectories()
|
||||
val contents = ArrayList<String>()
|
||||
|
||||
if (workspaceDir != null) {
|
||||
VfsUtil.iterateChildrenRecursively(workspaceDir, null) { virtualFile: VirtualFile ->
|
||||
if (!virtualFile.isDirectory) {
|
||||
val filePath = virtualFile.path
|
||||
if (!shouldIgnoreDirectory(filePath)) {
|
||||
contents.add(filePath)
|
||||
for (dir in dirs) {
|
||||
val workspacePath = File(dir)
|
||||
val workspaceDir = VirtualFileManager.getInstance().findFileByUrl("file://$workspacePath")
|
||||
|
||||
|
||||
|
||||
if (workspaceDir != null) {
|
||||
VfsUtil.iterateChildrenRecursively(workspaceDir, null) { virtualFile: VirtualFile ->
|
||||
if (!virtualFile.isDirectory) {
|
||||
val filePath = virtualFile.path
|
||||
if (!shouldIgnoreDirectory(filePath)) {
|
||||
contents.add(filePath)
|
||||
}
|
||||
}
|
||||
true
|
||||
}
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,116 @@
|
|||
package com.github.continuedev.continueintellijextension.`continue`
|
||||
|
||||
|
||||
import io.ktor.server.application.*
|
||||
import io.ktor.http.*
|
||||
import io.ktor.server.request.*
|
||||
import io.ktor.server.response.*
|
||||
import io.ktor.server.engine.embeddedServer
|
||||
import io.ktor.server.netty.Netty
|
||||
import io.ktor.server.plugins.cors.routing.*
|
||||
import io.ktor.util.Identity.decode
|
||||
import io.ktor.utils.io.jvm.javaio.*
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.Request
|
||||
import org.apache.commons.io.IOUtils.byteArray
|
||||
import java.io.ByteArrayOutputStream
|
||||
import java.net.URL
|
||||
|
||||
fun startProxyServer() {
|
||||
embeddedServer(Netty, port = 65433, module = Application::proxyServer).start(wait = true)
|
||||
}
|
||||
|
||||
fun Application.proxyServer() {
|
||||
install(CORS) {
|
||||
anyHost()
|
||||
|
||||
allowCredentials = true
|
||||
allowNonSimpleContentTypes = true
|
||||
|
||||
allowMethod(HttpMethod.Options)
|
||||
allowMethod(HttpMethod.Get)
|
||||
allowMethod(HttpMethod.Post)
|
||||
allowMethod(HttpMethod.Put)
|
||||
allowMethod(HttpMethod.Delete)
|
||||
allowMethod(HttpMethod.Patch)
|
||||
|
||||
allowHeaders {
|
||||
true
|
||||
}
|
||||
|
||||
allowOrigins { origin ->
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
intercept(ApplicationCallPipeline.Call) {
|
||||
val originalRequest = call.request
|
||||
|
||||
// Don't intercept CORS pre-flight requests
|
||||
if (originalRequest.httpMethod == HttpMethod.Options) {
|
||||
return@intercept;
|
||||
}
|
||||
|
||||
val continueUrl = originalRequest.headers["x-continue-url"] ?: return@intercept call.respond(HttpStatusCode.OK)
|
||||
val parsedUrl = URL(continueUrl)
|
||||
val body = originalRequest.receiveChannel().toInputStream().use { inputStream ->
|
||||
if (inputStream == null) {
|
||||
return@use null;
|
||||
}
|
||||
val buffer = byteArray(4096) // size of the buffer can be adjusted as needed
|
||||
val outputStream = ByteArrayOutputStream()
|
||||
while (true) {
|
||||
val bytesRead = inputStream.read(buffer)
|
||||
if (bytesRead == -1) {
|
||||
break
|
||||
}
|
||||
outputStream.write(buffer, 0, bytesRead)
|
||||
}
|
||||
outputStream.toByteArray()
|
||||
}
|
||||
|
||||
// Create OkHttpClient instance
|
||||
val client = OkHttpClient()
|
||||
|
||||
val requestBody = body?.let { okhttp3.RequestBody.create(null, it) }
|
||||
val okhttpHeaders = okhttp3.Headers.Builder()
|
||||
for (header in originalRequest.headers.entries()) {
|
||||
if (header.key != HttpHeaders.Host && header.key != HttpHeaders.Origin) {
|
||||
okhttpHeaders.add(header.key, header.value.joinToString(","))
|
||||
}
|
||||
}
|
||||
okhttpHeaders.add(HttpHeaders.Host, parsedUrl.host)
|
||||
|
||||
val requestBuilder = Request.Builder()
|
||||
.url(continueUrl)
|
||||
.method(originalRequest.httpMethod.value, requestBody)
|
||||
.headers(okhttpHeaders.build())
|
||||
|
||||
val response = client.newCall(requestBuilder.build()).execute()
|
||||
|
||||
// Set the response headers
|
||||
response.headers.forEach { h ->
|
||||
if (h.first.lowercase() == HttpHeaders.TransferEncoding.lowercase() || h.first.lowercase() == HttpHeaders.AccessControlAllowOrigin.lowercase()) {
|
||||
return@forEach
|
||||
}
|
||||
call.response.header(h.first, h.second)
|
||||
}
|
||||
|
||||
call.respondOutputStream(ContentType.parse(response.header("Content-Type") ?: "text/plain"), HttpStatusCode(response.code, response.message)) {
|
||||
response.body?.byteStream()?.use { inputStream ->
|
||||
if (inputStream == null) {
|
||||
return@use;
|
||||
}
|
||||
val buffer = byteArray(4096) // size of the buffer can be adjusted as needed
|
||||
while (true) {
|
||||
val bytesRead = inputStream.read(buffer)
|
||||
if (bytesRead == -1) {
|
||||
break
|
||||
}
|
||||
write(buffer, 0, bytesRead)
|
||||
flush()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
package com.github.continuedev.continueintellijextension.`continue`
|
||||
|
||||
interface WebSocketEventListener {
|
||||
fun onMessageReceived(message: String)
|
||||
fun onErrorOccurred(error: Throwable)
|
||||
}
|
||||
|
|
@ -6,10 +6,8 @@ import com.intellij.openapi.components.State
|
|||
import com.intellij.openapi.components.Storage
|
||||
import com.intellij.openapi.options.Configurable
|
||||
import com.intellij.openapi.project.DumbAware
|
||||
import kotlinx.serialization.Serializable
|
||||
import java.awt.GridBagConstraints
|
||||
import java.awt.GridBagLayout
|
||||
import javax.annotation.Nullable
|
||||
import javax.swing.JCheckBox
|
||||
import javax.swing.JComponent
|
||||
import javax.swing.JLabel
|
||||
|
|
@ -18,9 +16,6 @@ import javax.swing.JTextField
|
|||
|
||||
class ContinueSettingsComponent: DumbAware {
|
||||
val panel: JPanel = JPanel(GridBagLayout())
|
||||
private val myTextField: JTextField = JTextField()
|
||||
private val myCheckBox: JCheckBox =
|
||||
JCheckBox("Manually Running Continue Server")
|
||||
|
||||
init {
|
||||
val constraints = GridBagConstraints()
|
||||
|
|
@ -31,16 +26,6 @@ class ContinueSettingsComponent: DumbAware {
|
|||
constraints.gridx = 0
|
||||
constraints.gridy = GridBagConstraints.RELATIVE
|
||||
|
||||
val serverURLLabel = JLabel("Server URL")
|
||||
panel.add(serverURLLabel, constraints)
|
||||
|
||||
panel.add(myTextField, constraints)
|
||||
|
||||
val runningServerLabel = JLabel("Manually Running Server")
|
||||
panel.add(runningServerLabel, constraints)
|
||||
|
||||
panel.add(myCheckBox, constraints)
|
||||
|
||||
// Add a "filler" component that takes up all remaining vertical space
|
||||
constraints.weighty = 1.0
|
||||
val filler = JPanel()
|
||||
|
|
@ -48,17 +33,6 @@ class ContinueSettingsComponent: DumbAware {
|
|||
|
||||
}
|
||||
|
||||
var serverUrl: String?
|
||||
get() = myTextField.text
|
||||
set(newText) {
|
||||
myTextField.text = newText
|
||||
}
|
||||
|
||||
var manuallyRunningServer: Boolean
|
||||
get() = myCheckBox.isSelected
|
||||
set(value) {
|
||||
myCheckBox.isSelected = value
|
||||
}
|
||||
}
|
||||
|
||||
@State(
|
||||
|
|
@ -68,8 +42,6 @@ class ContinueSettingsComponent: DumbAware {
|
|||
open class ContinueExtensionSettings : PersistentStateComponent<ContinueExtensionSettings.ContinueState> {
|
||||
|
||||
class ContinueState {
|
||||
var serverUrl: String = "http://localhost:65432"
|
||||
var manuallyRunningServer: Boolean = false
|
||||
var shownWelcomeDialog: Boolean = false
|
||||
}
|
||||
|
||||
|
|
@ -99,24 +71,17 @@ class ContinueExtensionConfigurable : Configurable {
|
|||
|
||||
override fun isModified(): Boolean {
|
||||
val settings = ServiceManager.getService(ContinueExtensionSettings::class.java)
|
||||
return mySettingsComponent!!.serverUrl != settings.continueState.serverUrl || mySettingsComponent!!.manuallyRunningServer != settings.continueState.manuallyRunningServer
|
||||
return false;
|
||||
}
|
||||
|
||||
override fun apply() {
|
||||
val settings =
|
||||
ServiceManager.getService(ContinueExtensionSettings::class.java)
|
||||
settings.continueState.serverUrl =
|
||||
mySettingsComponent?.serverUrl ?: "http://localhost:65432"
|
||||
settings.continueState.manuallyRunningServer =
|
||||
mySettingsComponent!!.manuallyRunningServer
|
||||
}
|
||||
|
||||
override fun reset() {
|
||||
val settings =
|
||||
ServiceManager.getService(ContinueExtensionSettings::class.java)
|
||||
mySettingsComponent!!.serverUrl = settings.continueState.serverUrl
|
||||
mySettingsComponent!!.manuallyRunningServer =
|
||||
settings.continueState.manuallyRunningServer
|
||||
}
|
||||
|
||||
override fun disposeUIResources() {
|
||||
|
|
|
|||
|
|
@ -34,12 +34,9 @@ class ContinuePluginService(project: Project) : Disposable, DumbAware {
|
|||
}
|
||||
|
||||
fun dispatchCustomEvent(
|
||||
type: String,
|
||||
data: Map<String, Any>
|
||||
data: String
|
||||
) {
|
||||
val gson = Gson()
|
||||
val jsonData = gson.toJson(data)
|
||||
val jsCode = buildJavaScript(type, jsonData)
|
||||
val jsCode = buildJavaScript(data)
|
||||
|
||||
try {
|
||||
continuePluginWindow?.webView?.executeJavaScriptAsync(jsCode)
|
||||
|
|
@ -48,7 +45,7 @@ class ContinuePluginService(project: Project) : Disposable, DumbAware {
|
|||
}
|
||||
}
|
||||
|
||||
private fun buildJavaScript(type: String, jsonData: String): String {
|
||||
private fun buildJavaScript(jsonData: String): String {
|
||||
return """window.postMessage($jsonData, "*");"""
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package com.github.continuedev.continueintellijextension.toolWindow
|
||||
|
||||
import com.github.continuedev.continueintellijextension.activities.getContinueServerUrl
|
||||
import com.github.continuedev.continueintellijextension.constants.getConfigJsonPath
|
||||
import com.github.continuedev.continueintellijextension.`continue`.Position
|
||||
import com.github.continuedev.continueintellijextension.`continue`.Range
|
||||
import com.github.continuedev.continueintellijextension.`continue`.RangeInFile
|
||||
|
|
@ -10,9 +10,7 @@ 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.openapi.actionSystem.ActionGroup
|
||||
import com.intellij.openapi.actionSystem.ActionManager
|
||||
import com.intellij.openapi.actionSystem.ActionToolbar
|
||||
import com.intellij.openapi.actionSystem.AnAction
|
||||
import com.intellij.openapi.components.ServiceManager
|
||||
import com.intellij.openapi.editor.colors.EditorColorsManager
|
||||
|
|
@ -28,7 +26,6 @@ import kotlinx.coroutines.launch
|
|||
import org.cef.CefApp
|
||||
import org.cef.browser.CefBrowser
|
||||
import org.cef.handler.CefLoadHandlerAdapter
|
||||
import java.awt.BorderLayout
|
||||
import javax.swing.*
|
||||
import kotlin.math.max
|
||||
import kotlin.math.min
|
||||
|
|
@ -86,6 +83,9 @@ class ContinuePluginToolWindowFactory : ToolWindowFactory, DumbAware {
|
|||
val json: JsonObject = parser.parse(msg).asJsonObject
|
||||
val type = json.get("type").asString
|
||||
val data = json.get("data").asJsonObject
|
||||
|
||||
val ide = continuePluginService.ideProtocolClient;
|
||||
|
||||
when (type) {
|
||||
"onLoad" -> {
|
||||
GlobalScope.launch {
|
||||
|
|
@ -122,7 +122,6 @@ class ContinuePluginToolWindowFactory : ToolWindowFactory, DumbAware {
|
|||
val jsonData = mutableMapOf(
|
||||
"type" to "onLoad",
|
||||
"windowId" to continuePluginService.windowId,
|
||||
"serverUrl" to getContinueServerUrl(),
|
||||
"workspacePaths" to continuePluginService.worksapcePaths,
|
||||
"vscMachineId" to getMachineUniqueID(),
|
||||
"vscMediaUrl" to "http://continue",
|
||||
|
|
@ -133,7 +132,30 @@ class ContinuePluginToolWindowFactory : ToolWindowFactory, DumbAware {
|
|||
|
||||
}
|
||||
"showLines" -> {
|
||||
continuePluginService.ideProtocolClient?.highlightCode(RangeInFile(
|
||||
ide?.highlightCode(RangeInFile(
|
||||
data.get("filepath").asString,
|
||||
Range(Position(
|
||||
data.get("start").asInt,
|
||||
0
|
||||
), Position(
|
||||
data.get("end").asInt,
|
||||
0
|
||||
)),
|
||||
|
||||
),"#00ff0022")
|
||||
}
|
||||
"showVirtualFile" -> {
|
||||
ide?.showVirtualFile(data.get("name").asString, data.get("content").asString)
|
||||
}
|
||||
"showFile" -> {
|
||||
ide?.setFileOpen(data.get("filepath").asString)
|
||||
}
|
||||
"reloadWindow" -> {}
|
||||
"openConfigJson" -> {
|
||||
ide?.setFileOpen(getConfigJsonPath())
|
||||
}
|
||||
"readRangeInFile" -> {
|
||||
ide?.readRangeInFile(RangeInFile(
|
||||
data.get("filepath").asString,
|
||||
Range(Position(
|
||||
data.get("start").asInt,
|
||||
|
|
@ -142,16 +164,16 @@ class ContinuePluginToolWindowFactory : ToolWindowFactory, DumbAware {
|
|||
data.get("end").asInt + 1,
|
||||
0
|
||||
)),
|
||||
))
|
||||
}
|
||||
"focusEditor" -> {}
|
||||
|
||||
),"#00ff0022")
|
||||
// IDE //
|
||||
else -> {
|
||||
if (msg != null) {
|
||||
ide?.handleWebsocketMessage(msg)
|
||||
}
|
||||
}
|
||||
"showVirtualFile" -> {
|
||||
continuePluginService.ideProtocolClient?.showVirtualFile(data.get("name").asString, data.get("content").asString)
|
||||
}
|
||||
"showFile" -> {
|
||||
continuePluginService.ideProtocolClient?.setFileOpen(data.get("filepath").asString)
|
||||
}
|
||||
"reloadWindow" -> {}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<name>Continue</name>
|
||||
<vendor>continue-dev</vendor>
|
||||
<depends>com.intellij.modules.platform</depends>
|
||||
<idea-version since-build="223.0"/>
|
||||
<idea-version since-build="203.0"/>
|
||||
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
<toolWindow id="Continue" anchor="right" icon="/tool-window-icon.png"
|
||||
|
|
|
|||
196
extensions/vscode/package-lock.json
generated
196
extensions/vscode/package-lock.json
generated
|
|
@ -57,7 +57,7 @@
|
|||
"glob": "^8.0.3",
|
||||
"json-schema-to-typescript": "^12.0.0",
|
||||
"ovsx": "^0.8.3",
|
||||
"typescript": "^4.9.3",
|
||||
"typescript": "^5.3.3",
|
||||
"vite": "^4.3.9",
|
||||
"vsce": "^2.15.0"
|
||||
},
|
||||
|
|
@ -1382,20 +1382,6 @@
|
|||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/@jest/core/node_modules/ci-info": {
|
||||
"version": "3.9.0",
|
||||
"resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz",
|
||||
"integrity": "sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/sibiraj-s"
|
||||
}
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/@jest/core/node_modules/strip-ansi": {
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
|
||||
|
|
@ -3076,6 +3062,19 @@
|
|||
"node": "^12.13.0 || ^14.15.0 || >=16.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/are-we-there-yet/node_modules/readable-stream": {
|
||||
"version": "3.6.0",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
|
||||
"integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
|
||||
"dependencies": {
|
||||
"inherits": "^2.0.3",
|
||||
"string_decoder": "^1.1.1",
|
||||
"util-deprecate": "^1.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/arg": {
|
||||
"version": "5.0.2",
|
||||
"resolved": "https://registry.npmjs.org/arg/-/arg-5.0.2.tgz",
|
||||
|
|
@ -3347,6 +3346,19 @@
|
|||
"readable-stream": "^3.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/bl/node_modules/readable-stream": {
|
||||
"version": "3.6.0",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
|
||||
"integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
|
||||
"dependencies": {
|
||||
"inherits": "^2.0.3",
|
||||
"string_decoder": "^1.1.1",
|
||||
"util-deprecate": "^1.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/body-parser": {
|
||||
"version": "1.20.1",
|
||||
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz",
|
||||
|
|
@ -3756,10 +3768,18 @@
|
|||
}
|
||||
},
|
||||
"node_modules/ci-info": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz",
|
||||
"integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==",
|
||||
"dev": true
|
||||
"version": "3.9.0",
|
||||
"resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz",
|
||||
"integrity": "sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/sibiraj-s"
|
||||
}
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/cjs-module-lexer": {
|
||||
"version": "1.2.3",
|
||||
|
|
@ -6315,6 +6335,12 @@
|
|||
"is-ci": "bin.js"
|
||||
}
|
||||
},
|
||||
"node_modules/is-ci/node_modules/ci-info": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz",
|
||||
"integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/is-core-module": {
|
||||
"version": "2.12.1",
|
||||
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.1.tgz",
|
||||
|
|
@ -6679,20 +6705,6 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"node_modules/jest-config/node_modules/ci-info": {
|
||||
"version": "3.9.0",
|
||||
"resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz",
|
||||
"integrity": "sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/sibiraj-s"
|
||||
}
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/jest-config/node_modules/glob": {
|
||||
"version": "7.2.3",
|
||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
|
||||
|
|
@ -7041,20 +7053,6 @@
|
|||
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/jest-util/node_modules/ci-info": {
|
||||
"version": "3.9.0",
|
||||
"resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz",
|
||||
"integrity": "sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/sibiraj-s"
|
||||
}
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/jest-validate": {
|
||||
"version": "29.7.0",
|
||||
"resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-29.7.0.tgz",
|
||||
|
|
@ -7341,27 +7339,6 @@
|
|||
"setimmediate": "^1.0.5"
|
||||
}
|
||||
},
|
||||
"node_modules/jszip/node_modules/readable-stream": {
|
||||
"version": "2.3.8",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz",
|
||||
"integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"core-util-is": "~1.0.0",
|
||||
"inherits": "~2.0.3",
|
||||
"isarray": "~1.0.0",
|
||||
"process-nextick-args": "~2.0.0",
|
||||
"safe-buffer": "~5.1.1",
|
||||
"string_decoder": "~1.1.1",
|
||||
"util-deprecate": "~1.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/jszip/node_modules/safe-buffer": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/keytar": {
|
||||
"version": "7.9.0",
|
||||
"resolved": "https://registry.npmjs.org/keytar/-/keytar-7.9.0.tgz",
|
||||
|
|
@ -7382,9 +7359,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/kleur": {
|
||||
"version": "4.1.5",
|
||||
"resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.5.tgz",
|
||||
"integrity": "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==",
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz",
|
||||
"integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
|
|
@ -7544,6 +7521,19 @@
|
|||
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-3.2.1.tgz",
|
||||
"integrity": "sha512-mmcei9JghVNDYydghQmeDX8KoAm0FAiYyIcUt/N4nhyAipB17pllZQDOJD2fotxABnt4Mdz+dKTO7eftLg4d0A=="
|
||||
},
|
||||
"node_modules/lzma-native/node_modules/readable-stream": {
|
||||
"version": "3.6.0",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
|
||||
"integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
|
||||
"dependencies": {
|
||||
"inherits": "^2.0.3",
|
||||
"string_decoder": "^1.1.1",
|
||||
"util-deprecate": "^1.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/make-dir": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz",
|
||||
|
|
@ -9424,14 +9414,6 @@
|
|||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/prompts/node_modules/kleur": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz",
|
||||
"integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/prop-types": {
|
||||
"version": "15.8.1",
|
||||
"resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz",
|
||||
|
|
@ -9738,18 +9720,26 @@
|
|||
}
|
||||
},
|
||||
"node_modules/readable-stream": {
|
||||
"version": "3.6.0",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
|
||||
"integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
|
||||
"version": "2.3.8",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz",
|
||||
"integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"inherits": "^2.0.3",
|
||||
"string_decoder": "^1.1.1",
|
||||
"util-deprecate": "^1.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
"core-util-is": "~1.0.0",
|
||||
"inherits": "~2.0.3",
|
||||
"isarray": "~1.0.0",
|
||||
"process-nextick-args": "~2.0.0",
|
||||
"safe-buffer": "~5.1.1",
|
||||
"string_decoder": "~1.1.1",
|
||||
"util-deprecate": "~1.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/readable-stream/node_modules/safe-buffer": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/readdirp": {
|
||||
"version": "3.6.0",
|
||||
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
|
||||
|
|
@ -10783,6 +10773,20 @@
|
|||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/tar-stream/node_modules/readable-stream": {
|
||||
"version": "3.6.0",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
|
||||
"integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"inherits": "^2.0.3",
|
||||
"string_decoder": "^1.1.1",
|
||||
"util-deprecate": "^1.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/tar/node_modules/minipass": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/minipass/-/minipass-4.0.0.tgz",
|
||||
|
|
@ -11089,16 +11093,16 @@
|
|||
}
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "4.9.4",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.4.tgz",
|
||||
"integrity": "sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==",
|
||||
"version": "5.3.3",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz",
|
||||
"integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.2.0"
|
||||
"node": ">=14.17"
|
||||
}
|
||||
},
|
||||
"node_modules/uc.micro": {
|
||||
|
|
@ -11362,6 +11366,14 @@
|
|||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/uvu/node_modules/kleur": {
|
||||
"version": "4.1.5",
|
||||
"resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.5.tgz",
|
||||
"integrity": "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/v8-to-istanbul": {
|
||||
"version": "9.2.0",
|
||||
"resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.2.0.tgz",
|
||||
|
|
|
|||
|
|
@ -340,7 +340,7 @@
|
|||
"glob": "^8.0.3",
|
||||
"json-schema-to-typescript": "^12.0.0",
|
||||
"ovsx": "^0.8.3",
|
||||
"typescript": "^4.9.3",
|
||||
"typescript": "^5.3.3",
|
||||
"vite": "^4.3.9",
|
||||
"vsce": "^2.15.0"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -276,7 +276,7 @@ export function getSidebarContent(
|
|||
respond(await ide.listWorkspaceContents());
|
||||
break;
|
||||
}
|
||||
case "getWorkspaceDir": {
|
||||
case "getWorkspaceDirs": {
|
||||
respond(await ide.getWorkspaceDirs());
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5579,7 +5579,25 @@ read@^1.0.7:
|
|||
dependencies:
|
||||
mute-stream "~0.0.4"
|
||||
|
||||
readable-stream@^3.1.1, readable-stream@^3.4.0, readable-stream@^3.6.0:
|
||||
readable-stream@^3.1.1:
|
||||
version "3.6.0"
|
||||
resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz"
|
||||
integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==
|
||||
dependencies:
|
||||
inherits "^2.0.3"
|
||||
string_decoder "^1.1.1"
|
||||
util-deprecate "^1.0.1"
|
||||
|
||||
readable-stream@^3.4.0:
|
||||
version "3.6.0"
|
||||
resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz"
|
||||
integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==
|
||||
dependencies:
|
||||
inherits "^2.0.3"
|
||||
string_decoder "^1.1.1"
|
||||
util-deprecate "^1.0.1"
|
||||
|
||||
readable-stream@^3.6.0:
|
||||
version "3.6.0"
|
||||
resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz"
|
||||
integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==
|
||||
|
|
@ -6466,10 +6484,10 @@ typed-rest-client@^1.8.4:
|
|||
tunnel "0.0.6"
|
||||
underscore "^1.12.1"
|
||||
|
||||
typescript@^4.9.3, "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta":
|
||||
version "4.9.4"
|
||||
resolved "https://registry.npmjs.org/typescript/-/typescript-4.9.4.tgz"
|
||||
integrity sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==
|
||||
typescript@^5.3.3, "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta":
|
||||
version "5.3.3"
|
||||
resolved "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz"
|
||||
integrity sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==
|
||||
|
||||
uc.micro@^1.0.1, uc.micro@^1.0.5:
|
||||
version "1.0.6"
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ import {
|
|||
getMetaKeyLabel,
|
||||
getPlatform,
|
||||
} from "../../util";
|
||||
import { postToIde } from "../../util/ide";
|
||||
import { isJetBrains, postToIde } from "../../util/ide";
|
||||
import {
|
||||
handleKeyDownJetBrains,
|
||||
handleKeyDownJetBrainsMac,
|
||||
|
|
@ -1642,7 +1642,7 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => {
|
|||
}}
|
||||
className="mr-auto"
|
||||
>
|
||||
New Session ({getMetaKeyLabel()} M)
|
||||
New Session ({getMetaKeyLabel()} {isJetBrains() ? "J" : "M"})
|
||||
</NewSessionButton>
|
||||
) : null)}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ function useChatHandler(dispatch: Dispatch) {
|
|||
dispatch(addLogs(pairedLogs));
|
||||
} catch (e) {
|
||||
console.log("Continue: error streaming response: ", e);
|
||||
errorPopup(e.message);
|
||||
errorPopup(`Error streaming response: ${e}`);
|
||||
} finally {
|
||||
dispatch(setInactive());
|
||||
defaultModel.writeLog = undefined;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { Dispatch } from "@reduxjs/toolkit";
|
||||
import { useEffect, useState } from "react";
|
||||
import { setServerStatusMessage } from "../redux/slices/miscSlice";
|
||||
import { errorPopup, postToIde } from "../util/ide";
|
||||
import { errorPopup, isJetBrains, postToIde } from "../util/ide";
|
||||
|
||||
import {
|
||||
intermediateToFinalConfig,
|
||||
|
|
@ -69,7 +69,10 @@ function useSetup(dispatch: Dispatch<any>) {
|
|||
|
||||
useEffect(() => {
|
||||
const handleKeyDown = (event: any) => {
|
||||
if (isMetaEquivalentKeyPressed(event) && event.code === "KeyM") {
|
||||
if (
|
||||
isMetaEquivalentKeyPressed(event) &&
|
||||
(isJetBrains() ? event.code === "KeyJ" : event.code === "KeyM")
|
||||
) {
|
||||
setIgnoreHighlightedCode(true);
|
||||
setTimeout(() => {
|
||||
setIgnoreHighlightedCode(false);
|
||||
|
|
|
|||
|
|
@ -81,3 +81,13 @@ export function deleteModel(title: any) {
|
|||
export function addOpenAIKey(key: string) {
|
||||
postToIde("addOpenAIKey", { key });
|
||||
}
|
||||
|
||||
export function appendText(text: string) {
|
||||
const div = document.createElement("div");
|
||||
div.innerText = text;
|
||||
document.body.appendChild(div);
|
||||
}
|
||||
|
||||
export function isJetBrains() {
|
||||
return localStorage.getItem("ide") === "jetbrains";
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue