Merge branch 'main' of github.com:continuedev/continue into jacob/feature/next-edit-mvp

This commit is contained in:
Jacob Kim 2025-06-25 09:23:35 -07:00
commit cc7b5b0a0c
9 changed files with 14 additions and 248 deletions

View file

@ -124,14 +124,6 @@ describe("CodebaseIndexer", () => {
return updates;
}
async function refreshIndexFiles(files: string[]) {
const updates = [];
for await (const update of codebaseIndexer.refreshFiles(files)) {
updates.push(update);
}
return updates;
}
async function getAllIndexedFiles() {
const files = await testIndex.getIndexedFilesForTags(
await testIde.getTags(testIndex.artifactId),
@ -197,7 +189,7 @@ describe("CodebaseIndexer", () => {
test("should successfuly re-index specific files", async () => {
// Could add more specific tests for this but uses similar logic
const before = await getAllIndexedFiles();
await refreshIndexFiles(before);
await codebaseIndexer.refreshCodebaseIndexFiles(before);
const after = await getAllIndexedFiles();
expect(after.length).toBe(before.length);

View file

@ -43,7 +43,7 @@ export class CodebaseIndexer {
* - To limit memory usage for indexes that perform computations locally, e.g. FTS
* - To make as few requests as possible to the embeddings providers
*/
filesPerBatch = 500;
filesPerBatch = 200;
private indexingCancellationController: AbortController | undefined;
private codebaseIndexingState: IndexingProgressUpdate;
private readonly pauseToken: PauseToken;
@ -75,16 +75,10 @@ export class CodebaseIndexer {
this.pauseToken = new PauseToken(initialPaused);
}
/**
* Set the paused state of the indexer
*/
set paused(value: boolean) {
this.pauseToken.paused = value;
}
/**
* Get the current paused state of the indexer
*/
get paused(): boolean {
return this.pauseToken.paused;
}
@ -235,7 +229,9 @@ export class CodebaseIndexer {
}
}
async *refreshFiles(files: string[]): AsyncGenerator<IndexingProgressUpdate> {
private async *refreshFiles(
files: string[],
): AsyncGenerator<IndexingProgressUpdate> {
let progress = 0;
if (files.length === 0) {
yield {
@ -525,7 +521,7 @@ export class CodebaseIndexer {
repoName,
)) {
yield {
progress: progress,
progress,
desc,
status: "indexing",
};

View file

@ -546,7 +546,7 @@ class Bedrock extends BaseLLM {
}
// EMBED //
async embed(chunks: string[]): Promise<number[][]> {
async _embed(chunks: string[]): Promise<number[][]> {
const credentials = await this._getCredentials();
const client = new BedrockRuntimeClient({
region: this.region,

View file

@ -25,16 +25,7 @@ class HuggingFaceTEIEmbeddingsProvider extends BaseLLM {
});
}
async embed(chunks: string[]) {
const batchedChunks = this.getBatchedChunks(chunks);
const results = await Promise.all(
batchedChunks.map((batch) => this.doEmbedRequest(batch)),
);
return results.flat();
}
async doEmbedRequest(batch: string[]): Promise<number[][]> {
async _embed(batch: string[]): Promise<number[][]> {
const headers: Record<string, string> = {
"Content-Type": "application/json",
};

View file

@ -141,7 +141,7 @@ class SageMaker extends BaseLLM {
}
}
async embed(chunks: string[]) {
async _embed(chunks: string[]) {
const credentials = await this._getCredentials();
const client = new SageMakerRuntimeClient({
region: this.region,

View file

@ -2,9 +2,9 @@ package com.github.continuedev.continueintellijextension.auth
import com.github.continuedev.continueintellijextension.services.ContinueExtensionSettings
import com.github.continuedev.continueintellijextension.services.ContinuePluginService
import com.github.continuedev.continueintellijextension.utils.Desktop
import com.google.gson.Gson
import com.intellij.credentialStore.Credentials
import com.intellij.ide.BrowserUtil
import com.intellij.ide.passwordSafe.PasswordSafe
import com.intellij.ide.util.PropertiesComponent
import com.intellij.openapi.application.ApplicationManager
@ -165,7 +165,7 @@ class ContinueAuthService {
// Still open the URL in the browser (keeping existing behavior)
if (authUrl != null) {
Desktop.browse(java.net.URI(authUrl))
BrowserUtil.open(authUrl!!)
}
return authUrl

View file

@ -10,6 +10,7 @@ import com.github.continuedev.continueintellijextension.utils.*
import com.intellij.codeInsight.daemon.impl.HighlightInfo
import com.intellij.execution.configurations.GeneralCommandLine
import com.intellij.execution.util.ExecUtil
import com.intellij.ide.BrowserUtil
import com.intellij.ide.plugins.PluginManager
import com.intellij.ide.plugins.PluginManagerCore
import com.intellij.lang.annotation.HighlightSeverity
@ -211,7 +212,7 @@ class IntelliJIDE(
override suspend fun openUrl(url: String) {
withContext(Dispatchers.IO) {
Desktop.browse(URI(url))
BrowserUtil.browse(url)
}
}

View file

@ -1,214 +0,0 @@
/*
* Copyright © 2017 jjYBdx4IL (https://github.com/jjYBdx4IL)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.continuedev.continueintellijextension.utils
import org.apache.commons.lang3.SystemUtils
import org.slf4j.LoggerFactory
import java.io.File
import java.io.IOException
import java.net.URI
object Desktop {
private val LOG = LoggerFactory.getLogger(Desktop::class.java)
fun browse(uri: URI): Boolean {
if (browseDESKTOP(uri)) {
return true
}
if (openSystemSpecific(uri.toString())) {
return true
}
LOG.warn("failed to browse {}", uri)
return false
}
fun open(file: File): Boolean {
if (openDESKTOP(file)) {
return true
}
if (openSystemSpecific(file.path)) {
return true
}
LOG.warn("failed to open {}", file.absolutePath)
return false
}
fun edit(file: File): Boolean {
if (editDESKTOP(file)) {
return true
}
if (openSystemSpecific(file.path)) {
return true
}
LOG.warn("failed to edit {}", file.absolutePath)
return false
}
private fun openSystemSpecific(what: String): Boolean {
if (SystemUtils.IS_OS_LINUX) {
if (isXDG() && runCommand("xdg-open", "%s", what)) {
return true
}
if (isKDE() && runCommand("kde-open", "%s", what)) {
return true
}
if (isGNOME() && runCommand("gnome-open", "%s", what)) {
return true
}
if (runCommand("kde-open", "%s", what)) {
return true
}
if (runCommand("gnome-open", "%s", what)) {
return true
}
}
if (SystemUtils.IS_OS_MAC && runCommand("open", "%s", what)) {
return true
}
if (SystemUtils.IS_OS_WINDOWS && runCommand("explorer", "%s", what)) {
return true
}
return false
}
private fun browseDESKTOP(uri: URI): Boolean {
return try {
if (!java.awt.Desktop.isDesktopSupported()) {
LOG.debug("Platform is not supported.")
return false
}
if (!java.awt.Desktop.getDesktop().isSupported(java.awt.Desktop.Action.BROWSE)) {
LOG.debug("BROWSE is not supported.")
return false
}
LOG.info("Trying to use Desktop.getDesktop().browse() with {}", uri.toString())
java.awt.Desktop.getDesktop().browse(uri)
true
} catch (t: Throwable) {
LOG.error("Error using desktop browse.", t)
false
}
}
private fun openDESKTOP(file: File): Boolean {
return try {
if (!java.awt.Desktop.isDesktopSupported()) {
LOG.debug("Platform is not supported.")
return false
}
if (!java.awt.Desktop.getDesktop().isSupported(java.awt.Desktop.Action.OPEN)) {
LOG.debug("OPEN is not supported.")
return false
}
LOG.info("Trying to use Desktop.getDesktop().open() with {}", file.toString())
java.awt.Desktop.getDesktop().open(file)
true
} catch (t: Throwable) {
LOG.error("Error using desktop open.", t)
false
}
}
private fun editDESKTOP(file: File): Boolean {
return try {
if (!java.awt.Desktop.isDesktopSupported()) {
LOG.debug("Platform is not supported.")
return false
}
if (!java.awt.Desktop.getDesktop().isSupported(java.awt.Desktop.Action.EDIT)) {
LOG.debug("EDIT is not supported.")
return false
}
LOG.info("Trying to use Desktop.getDesktop().edit() with {}", file)
java.awt.Desktop.getDesktop().edit(file)
true
} catch (t: Throwable) {
LOG.error("Error using desktop edit.", t)
false
}
}
private fun runCommand(command: String, args: String, file: String): Boolean {
LOG.info("Trying to exec:\n cmd = {}\n args = {}\n %s = {}", command, args, file)
val parts = prepareCommand(command, args, file)
return try {
val p = Runtime.getRuntime().exec(parts)
if (p == null) {
false
} else {
try {
val retval = p.exitValue()
if (retval == 0) {
LOG.error("Process ended immediately.")
false
} else {
LOG.error("Process crashed.")
false
}
} catch (itse: IllegalThreadStateException) {
LOG.error("Process is running.")
true
}
}
} catch (e: IOException) {
LOG.error("Error running command.", e)
false
}
}
private fun prepareCommand(command: String, args: String?, file: String): Array<String> {
val parts = mutableListOf<String>()
parts.add(command)
args?.split(" ")?.forEach { s ->
parts.add(String.format(s, file).trim())
}
return parts.toTypedArray()
}
private fun isXDG(): Boolean {
val xdgSessionId = System.getenv("XDG_SESSION_ID")
return !xdgSessionId.isNullOrEmpty()
}
private fun isGNOME(): Boolean {
val gdmSession = System.getenv("GDMSESSION")
return gdmSession?.lowercase()?.contains("gnome") == true
}
private fun isKDE(): Boolean {
val gdmSession = System.getenv("GDMSESSION")
return gdmSession?.lowercase()?.contains("kde") == true
}
}

View file

@ -2,7 +2,7 @@
"name": "continue",
"icon": "media/icon.png",
"author": "Continue Dev, Inc",
"version": "1.1.50",
"version": "1.1.51",
"repository": {
"type": "git",
"url": "https://github.com/continuedev/continue"