diff --git a/core/nextEdit/DocumentHistoryTracker.ts b/core/nextEdit/DocumentHistoryTracker.ts index 7cca91f5653..5cae278ffad 100644 --- a/core/nextEdit/DocumentHistoryTracker.ts +++ b/core/nextEdit/DocumentHistoryTracker.ts @@ -61,7 +61,15 @@ export class DocumentHistoryTracker { const documentHistory = this.documentContentHistoryMap.get(documentPath); if (!astHistory || !documentHistory) { - console.error(`Document ${documentPath} not found in AST tracker`); + const lowerPath = documentPath.toLowerCase(); + if ( + !lowerPath.endsWith(".yaml") && + !lowerPath.endsWith(".yml") && + !lowerPath.endsWith(".json") && + !lowerPath.endsWith(".md") + ) { + console.error(`Document ${documentPath} not found in AST tracker`); + } this.addDocument(documentPath, documentContent, ast); return; // Early return - document was added with initial state } @@ -82,7 +90,15 @@ export class DocumentHistoryTracker { const astHistory = this.documentAstMap.get(documentPath); if (!astHistory) { - console.error(`Document ${documentPath} not found in AST tracker`); + const lowerPath = documentPath.toLowerCase(); + if ( + !lowerPath.endsWith(".yaml") && + !lowerPath.endsWith(".yml") && + !lowerPath.endsWith(".json") && + !lowerPath.endsWith(".md") + ) { + console.error(`Document ${documentPath} not found in AST tracker`); + } return null; } if (astHistory.length === 0) { @@ -105,7 +121,15 @@ export class DocumentHistoryTracker { const documentHistory = this.documentContentHistoryMap.get(documentPath); if (!documentHistory) { - console.error(`Document ${documentPath} not found in AST tracker`); + const lowerPath = documentPath.toLowerCase(); + if ( + !lowerPath.endsWith(".yaml") && + !lowerPath.endsWith(".yml") && + !lowerPath.endsWith(".json") && + !lowerPath.endsWith(".md") + ) { + console.error(`Document ${documentPath} not found in AST tracker`); + } return null; } if (documentHistory.length === 0) { diff --git a/extensions/intellij/src/testIntegration/kotlin/com/github/continuedev/continueintellijextension/Autocomplete.kt b/extensions/intellij/src/testIntegration/kotlin/com/github/continuedev/continueintellijextension/Autocomplete.kt index beca6683933..1a6d74e75b9 100644 --- a/extensions/intellij/src/testIntegration/kotlin/com/github/continuedev/continueintellijextension/Autocomplete.kt +++ b/extensions/intellij/src/testIntegration/kotlin/com/github/continuedev/continueintellijextension/Autocomplete.kt @@ -10,7 +10,6 @@ import com.intellij.ide.starter.plugins.PluginConfigurator import com.intellij.ide.starter.project.NoProject import com.intellij.ide.starter.runner.Starter import org.junit.jupiter.api.Test -import org.junit.jupiter.api.Assertions.assertTrue import java.io.File import kotlin.time.Duration.Companion.seconds @@ -32,14 +31,32 @@ class Autocomplete { } codeEditor { keyboard { - enterText("TEST_USER_MESSAGE_0") - space() + escape() // close any popups + enter() + enter() + enter() } - wait(2.seconds) - keyboard { - tab() + var success = false + for (i in 1..10) { + keyboard { + enterText("TEST_USER_MESSAGE_0") + space() + } + wait(2.seconds) + keyboard { + tab() + } + if (text.contains("TEST_LLM_RESPONSE_0")) { + success = true + break + } + keyboard { + enter() + } + } + if (!success) { + throw Exception("DEBUG_TEXT: ${text.take(500)}") } - assertTrue(text.contains("TEST_LLM_RESPONSE_0")) } } } diff --git a/extensions/vscode/src/activation/activate.ts b/extensions/vscode/src/activation/activate.ts index 8aef69fdcf6..48a562381b1 100644 --- a/extensions/vscode/src/activation/activate.ts +++ b/extensions/vscode/src/activation/activate.ts @@ -48,20 +48,20 @@ export async function activateExtension(context: vscode.ExtensionContext) { "config-yaml-schema.json", ).toString(); - try { - await yamlConfig.update( - "schemas", - { - ...yamlSchemas, - [newPath]: [yamlMatcher], - }, - vscode.ConfigurationTarget.Global, - ); - } catch (error) { - console.error( - "Failed to register Continue config.yaml schema, most likely, YAML extension is not installed", - error, - ); + const yamlExtension = vscode.extensions.getExtension("redhat.vscode-yaml"); + if (yamlExtension) { + try { + await yamlConfig.update( + "schemas", + { + ...yamlSchemas, + [newPath]: [yamlMatcher], + }, + vscode.ConfigurationTarget.Global, + ); + } catch (error) { + console.error("Failed to register Continue config.yaml schema", error); + } } const api = new VsCodeContinueApi(vscodeExtension); diff --git a/gui/src/components/mainInput/TipTapEditor/TipTapEditor.tsx b/gui/src/components/mainInput/TipTapEditor/TipTapEditor.tsx index c19ae0af242..2c82bd2ba00 100644 --- a/gui/src/components/mainInput/TipTapEditor/TipTapEditor.tsx +++ b/gui/src/components/mainInput/TipTapEditor/TipTapEditor.tsx @@ -255,10 +255,14 @@ function TipTapEditorInner(props: TipTapEditorProps) { } if (result) { const [_, dataUrl] = result; - const { schema } = editor.state; - const node = schema.nodes.image.create({ src: dataUrl }); - const tr = editor.state.tr.insert(0, node); - editor.view.dispatch(tr); + editor + .chain() + .focus() + .insertContent({ + type: "image", + attrs: { src: dataUrl }, + }) + .run(); } }); event.preventDefault(); @@ -287,12 +291,14 @@ function TipTapEditorInner(props: TipTapEditorProps) { } if (result) { const [_, dataUrl] = result; - const { schema } = editor.state; - const node = schema.nodes.image.create({ src: dataUrl }); - editor.commands.command(({ tr }) => { - tr.insert(0, node); - return true; - }); + editor + .chain() + .focus() + .insertContent({ + type: "image", + attrs: { src: dataUrl }, + }) + .run(); } }); }} diff --git a/gui/src/components/mainInput/TipTapEditor/utils/editorConfig.ts b/gui/src/components/mainInput/TipTapEditor/utils/editorConfig.ts index 3a79c07b83a..ddfc5b0d0bb 100644 --- a/gui/src/components/mainInput/TipTapEditor/utils/editorConfig.ts +++ b/gui/src/components/mainInput/TipTapEditor/utils/editorConfig.ts @@ -161,7 +161,8 @@ export function createEditorConfig(options: { if (!model) return; const items = event.clipboardData?.items; if (items) { - for (const item of items) { + for (let i = 0; i < items.length; i++) { + const item = items[i]; const file = item.getAsFile(); file && modelSupportsImages( @@ -178,7 +179,7 @@ export function createEditorConfig(options: { const node = schema.nodes.image.create({ src: dataUrl, }); - const tr = view.state.tr.insert(0, node); + const tr = view.state.tr.replaceSelectionWith(node); view.dispatch(tr); }, );