fix: use older API from 2023.3
This commit is contained in:
parent
d5294ae0c1
commit
29dc0e1840
6 changed files with 60 additions and 68 deletions
|
|
@ -1,26 +1,24 @@
|
|||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Run Test IDE" type="GradleRunConfiguration" factoryName="Gradle">
|
||||
<ExternalSystemSettings>
|
||||
<option name="executionName"/>
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$/extensions/intellij"/>
|
||||
<option name="externalSystemIdString" value="GRADLE"/>
|
||||
<option name="scriptParameters" value=""/>
|
||||
<option name="taskDescriptions">
|
||||
<list/>
|
||||
</option>
|
||||
<option name="taskNames">
|
||||
<list>
|
||||
<option value="runIdeForUiTests"/>
|
||||
</list>
|
||||
</option>
|
||||
</ExternalSystemSettings>
|
||||
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
|
||||
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
|
||||
<DebugAllEnabled>false</DebugAllEnabled>
|
||||
<RunAsTest>false</RunAsTest>
|
||||
<method v="2">
|
||||
<option name="Gradle.BeforeRunTask" enabled="true" tasks="clean"
|
||||
externalProjectPath="$PROJECT_DIR$/extensions/intellij" vmOptions="" scriptParameters=""/>
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration default="false" name="Run Test IDE" type="GradleRunConfiguration" factoryName="Gradle">
|
||||
<ExternalSystemSettings>
|
||||
<option name="executionName" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$/extensions/intellij" />
|
||||
<option name="externalSystemIdString" value="GRADLE" />
|
||||
<option name="scriptParameters" value="" />
|
||||
<option name="taskDescriptions">
|
||||
<list />
|
||||
</option>
|
||||
<option name="taskNames">
|
||||
<list>
|
||||
<option value="runIdeForUiTests" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="vmOptions" />
|
||||
</ExternalSystemSettings>
|
||||
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
|
||||
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
|
||||
<DebugAllEnabled>false</DebugAllEnabled>
|
||||
<RunAsTest>false</RunAsTest>
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
||||
|
|
@ -5,16 +5,13 @@ import org.jetbrains.intellij.platform.gradle.tasks.PrepareSandboxTask
|
|||
fun environment(key: String) = providers.environmentVariable(key)
|
||||
|
||||
val remoteRobotVersion = "0.11.23"
|
||||
val platformType: String by project
|
||||
val platformVersion: String by project
|
||||
val pluginGroup: String by project
|
||||
val pluginVersion: String by project
|
||||
val pluginSinceBuild: String by project
|
||||
val pluginRepositoryUrl: String by project
|
||||
val isEap get() = environment("RELEASE_CHANNEL").orNull == "eap"
|
||||
|
||||
plugins {
|
||||
kotlin("jvm") version "1.8.0"
|
||||
kotlin("jvm") version "1.9.21"
|
||||
id("org.jetbrains.intellij.platform") version "2.6.0"
|
||||
id("org.jetbrains.changelog") version "2.1.2"
|
||||
id("org.jetbrains.qodana") version "0.1.13"
|
||||
|
|
@ -34,7 +31,7 @@ repositories {
|
|||
|
||||
dependencies {
|
||||
intellijPlatform {
|
||||
create("IC", "2024.1")
|
||||
create("IC", platformVersion)
|
||||
plugins(listOf("org.jetbrains.plugins.terminal:223.8214.6"))
|
||||
testFramework(TestFrameworkType.Platform)
|
||||
}
|
||||
|
|
@ -50,27 +47,28 @@ dependencies {
|
|||
testRuntimeOnly("org.junit.vintage:junit-vintage-engine:5.10.0") // required to run both JUnit 5 and JUnit 3
|
||||
}
|
||||
|
||||
kotlin { jvmToolchain(17) }
|
||||
kotlin {
|
||||
jvmToolchain(17)
|
||||
}
|
||||
|
||||
intellijPlatform {
|
||||
pluginConfiguration {
|
||||
ideaVersion {
|
||||
sinceBuild = "241"
|
||||
sinceBuild = "233"
|
||||
}
|
||||
}
|
||||
pluginVerification {
|
||||
ides {
|
||||
ide("IC", "2025.1.4")
|
||||
ide("IC", "2025.2")
|
||||
ide("IC", "2025.1")
|
||||
ide("IC", "2024.3")
|
||||
ide("IC", "2024.2")
|
||||
ide("IC", "2024.1")
|
||||
ide("IC", "2023.3")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
changelog {
|
||||
groups.empty()
|
||||
repositoryUrl = pluginRepositoryUrl
|
||||
}
|
||||
|
||||
qodana {
|
||||
cachePath = provider { file(".qodana").canonicalPath }
|
||||
reportPath = provider { file("build/reports/inspections").canonicalPath }
|
||||
|
|
@ -78,7 +76,11 @@ qodana {
|
|||
showReport = environment("QODANA_SHOW_REPORT").map { it.toBoolean() }.getOrElse(false)
|
||||
}
|
||||
|
||||
koverReport { defaults { xml { onCheck = true } } }
|
||||
koverReport {
|
||||
defaults {
|
||||
xml { onCheck = true }
|
||||
}
|
||||
}
|
||||
|
||||
intellijPlatformTesting {
|
||||
runIde {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
pluginGroup=com.github.continuedev.continueintellijextension
|
||||
pluginRepositoryUrl=https://github.com/continuedev/continue
|
||||
pluginVersion=1.0.34
|
||||
platformVersion=2023.3
|
||||
kotlin.stdlib.default.dependency=false
|
||||
org.gradle.configuration-cache=true
|
||||
org.gradle.caching=true
|
||||
|
|
|
|||
|
|
@ -15,8 +15,7 @@ class ContinueCompletionService(private val project: Project) : CompletionServic
|
|||
|
||||
override suspend fun getAutocomplete(uuid: String, url: String, line: Int, column: Int): String? {
|
||||
val requestInput = getCompletionInput(uuid, url, line, column)
|
||||
val modelTimeout = project.service<ProfileInfoService>().fetchModelTimeoutOrNull()
|
||||
?: return null
|
||||
val modelTimeout = project.service<ProfileInfoService>().fetchModelTimeoutOrNull() ?: 1000.0
|
||||
return withTimeoutOrNull(modelTimeout.milliseconds) {
|
||||
suspendCancellableCoroutine { continuation ->
|
||||
project.service<ContinuePluginService>().coreMessenger?.request(
|
||||
|
|
|
|||
|
|
@ -1,21 +1,14 @@
|
|||
@file:Suppress("UnstableApiUsage")
|
||||
|
||||
package com.github.continuedev.continueintellijextension.autocomplete
|
||||
|
||||
import com.github.continuedev.continueintellijextension.services.ContinueExtensionSettings
|
||||
import com.github.continuedev.continueintellijextension.utils.uuid
|
||||
import com.intellij.codeInsight.inline.completion.DefaultInlineCompletionInsertHandler
|
||||
import com.intellij.codeInsight.inline.completion.InlineCompletionEvent
|
||||
import com.intellij.codeInsight.inline.completion.InlineCompletionInsertEnvironment
|
||||
import com.intellij.codeInsight.inline.completion.InlineCompletionInsertHandler
|
||||
import com.intellij.codeInsight.inline.completion.InlineCompletionProvider
|
||||
import com.intellij.codeInsight.inline.completion.InlineCompletionProviderID
|
||||
import com.intellij.codeInsight.inline.completion.InlineCompletionRequest
|
||||
import com.intellij.codeInsight.inline.completion.*
|
||||
import com.intellij.codeInsight.inline.completion.elements.InlineCompletionElement
|
||||
import com.intellij.codeInsight.inline.completion.elements.InlineCompletionGrayTextElement
|
||||
import com.intellij.codeInsight.inline.completion.suggestion.InlineCompletionSuggestion
|
||||
import com.intellij.codeInsight.inline.completion.suggestion.InlineCompletionVariant
|
||||
import com.intellij.openapi.components.service
|
||||
import com.intellij.openapi.project.Project
|
||||
import kotlinx.coroutines.flow.flow
|
||||
|
||||
class ContinueInlineCompletionProvider : InlineCompletionProvider {
|
||||
override val id get() = InlineCompletionProviderID("Continue")
|
||||
|
|
@ -29,7 +22,7 @@ class ContinueInlineCompletionProvider : InlineCompletionProvider {
|
|||
override suspend fun getSuggestion(request: InlineCompletionRequest): InlineCompletionSuggestion {
|
||||
val editor = request.editor
|
||||
val project = editor.project
|
||||
?: return InlineCompletionSuggestion.Empty
|
||||
?: return InlineCompletionSuggestion.empty()
|
||||
lastUuid = uuid()
|
||||
lastProject = project
|
||||
val variant = project.service<CompletionService>().getAutocomplete(
|
||||
|
|
@ -39,15 +32,9 @@ class ContinueInlineCompletionProvider : InlineCompletionProvider {
|
|||
editor.caretModel.primaryCaret.logicalPosition.column
|
||||
)
|
||||
if (variant == null)
|
||||
return InlineCompletionSuggestion.Empty
|
||||
return object : InlineCompletionSuggestion {
|
||||
override suspend fun getVariants(): List<InlineCompletionVariant> {
|
||||
val completion = InlineCompletionVariant.build(
|
||||
request.file.virtualFile,
|
||||
flow { emit(InlineCompletionGrayTextElement(variant)) }
|
||||
)
|
||||
return listOf(completion)
|
||||
}
|
||||
return InlineCompletionSuggestion.empty()
|
||||
return InlineCompletionSuggestion.withFlow {
|
||||
emit(InlineCompletionGrayTextElement(variant))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -69,10 +69,6 @@ class ContinueInlineCompletionProviderTest : BasePlatformTestCase() {
|
|||
assertFileContent("digits = '1234567890'<caret>")
|
||||
}
|
||||
|
||||
fun `test cycle between multiple completion variants`() {
|
||||
// todo implement
|
||||
}
|
||||
|
||||
fun `test multiline`() = myFixture.testInlineCompletion {
|
||||
registerSuggestion(": i32) -> i32 {\n a + b\n}")
|
||||
init(PlainTextFileType.INSTANCE, "fn add(a: i32, b<caret>")
|
||||
|
|
@ -89,18 +85,28 @@ class ContinueInlineCompletionProviderTest : BasePlatformTestCase() {
|
|||
}
|
||||
|
||||
fun `test accepting completion notifies the service with valid UUID`() = myFixture.testInlineCompletion {
|
||||
var acceptedUuid: String? = null
|
||||
registerSuggestion("test") { acceptedUuid = it }
|
||||
var uuid: String? = null
|
||||
registerSuggestion("test") { uuid = it }
|
||||
init(PlainTextFileType.INSTANCE, "test <caret>")
|
||||
callInlineCompletion()
|
||||
delay()
|
||||
insertWithTab()
|
||||
assertFileContent("test test<caret>")
|
||||
assertDoesNotThrow {
|
||||
UUID.fromString(acceptedUuid)
|
||||
UUID.fromString(uuid)
|
||||
}
|
||||
}
|
||||
|
||||
fun `test not accepting completions is not notifying service with UUID`() = myFixture.testInlineCompletion {
|
||||
var uuid: String? = null
|
||||
registerSuggestion("test") { uuid = it }
|
||||
init(PlainTextFileType.INSTANCE, "test <caret>")
|
||||
callInlineCompletion()
|
||||
delay()
|
||||
assertInlineRender("test")
|
||||
assertNull(uuid)
|
||||
}
|
||||
|
||||
private fun registerSuggestion(variant: String?, accept: (String?) -> Unit = {}) =
|
||||
myFixture.project.replaceService(
|
||||
CompletionService::class.java,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue