add env var for running GUI

This commit is contained in:
Test 2024-10-17 17:57:50 -07:00
parent c439620dd2
commit 4f5f92bc23
18 changed files with 110 additions and 133 deletions

5
.idea/modules.xml generated
View file

@ -2,10 +2,9 @@
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/modules/com.github.continuedev.continueintellijextension.continue-intellij-extension.iml" filepath="$PROJECT_DIR$/.idea/modules/com.github.continuedev.continueintellijextension.continue-intellij-extension.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/com.github.continuedev.continueintellijextension.continue-intellij-extension.main.iml" filepath="$PROJECT_DIR$/.idea/modules/com.github.continuedev.continueintellijextension.continue-intellij-extension.main.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/continue-intellij-extension.iml" filepath="$PROJECT_DIR$/.idea/modules/continue-intellij-extension.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/continue-intellij-extension.main.iml" filepath="$PROJECT_DIR$/.idea/modules/continue-intellij-extension.main.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/continue-intellij-extension.test.iml" filepath="$PROJECT_DIR$/.idea/modules/continue-intellij-extension.test.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/com.github.continuedev.continueintellijextension.continue-intellij-extension.test.iml" filepath="$PROJECT_DIR$/.idea/modules/com.github.continuedev.continueintellijextension.continue-intellij-extension.test.iml" />
</modules>
</component>
</project>

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="AdditionalModuleElements">
<content url="file://$MODULE_DIR$/../..">
<sourceFolder url="file://$MODULE_DIR$/../../extensions/intellij/.gradle/8.3/dependencies-accessors/5ff144de810dd952e050983bda2040fa7aa351f8/sources" isTestSource="false" />
</content>
</component>
</module>

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="AdditionalModuleElements">
<content url="file://$MODULE_DIR$/../../extensions/intellij/src/test" dumb="true">
<sourceFolder url="file://$MODULE_DIR$/../../extensions/intellij/src/test" isTestSource="true" />
</content>
</component>
</module>

View file

@ -0,0 +1,7 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run Continue" type="CompoundRunConfigurationType">
<toRun name="Run Extension" type="GradleRunConfiguration" />
<toRun name="GUI: Start dev server" type="js.build_tools.npm" />
<method v="2" />
</configuration>
</component>

3
.idea/scopes/Continue.xml generated Normal file
View file

@ -0,0 +1,3 @@
<component name="DependencyValidationManager">
<scope name="Continue" pattern="!file[com.github.continuedev.continueintellijextension.continue-intellij-extension]:gui/dist//*&amp;&amp;!file[com.github.continuedev.continueintellijextension.continue-intellij-extension]:extensions/vscode/gui//*&amp;&amp;!file[com.github.continuedev.continueintellijextension.continue-intellij-extension]:core/vendor//*" />
</component>

View file

@ -1,30 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run Continue" type="GradleRunConfiguration" factoryName="Gradle" focusToolWindowBeforeRun="true">
<log_file alias="idea.log" path="$PROJECT_DIR$/extensions/intellij/build/idea-sandbox/system/log/idea.log" />
<ExternalSystemSettings>
<option name="env">
<map>
<entry key="ORG_GRADLE_PROJECT_platformVersion" value="2024.1" />
</map>
</option>
<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="runIde" />
</list>
</option>
<option name="vmOptions" value="" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>false</RunAsTest>
<method v="2" />
</configuration>
</component>

View file

@ -1,8 +1,9 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run Continue (TCP)" type="GradleRunConfiguration" factoryName="Gradle">
<configuration default="false" name="Run Extension" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="env">
<map>
<entry key="GUI_URL" value="http://localhost:5173/jetbrains_index.html" />
<entry key="ORG_GRADLE_PROJECT_platformVersion" value="2024.1" />
<entry key="USE_TCP" value="true" />
</map>

View file

@ -1,40 +1,25 @@
# IntelliJ Platform Artifacts Repositories -> https://plugins.jetbrains.com/docs/intellij/intellij-artifacts.html
pluginGroup=com.github.continuedev.continueintellijextension
pluginName=continue-intellij-extension
pluginRepositoryUrl=https://github.com/continuedev/continue
# SemVer format -> https://semver.org
pluginVersion=0.0.76
# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
pluginSinceBuild=223
#pluginUntilBuild = 232.*
# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension
platformType=IC
platformVersion=2022.3.3
#platformVersion = LATEST-EAP-SNAPSHOT
# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22
platformPlugins=org.jetbrains.plugins.terminal
# Gradle Releases -> https://github.com/gradle/gradle/releases
gradleVersion=8.3
# Opt-out flag for bundling Kotlin standard library -> https://jb.gg/intellij-platform-kotlin-stdlib
kotlin.stdlib.default.dependency=false
# Enable Gradle Configuration Cache -> https://docs.gradle.org/current/userguide/configuration_cache.html
org.gradle.configuration-cache=true
# Enable Gradle Build Cache -> https://docs.gradle.org/current/userguide/build_cache.html
org.gradle.caching=true
# Enable Gradle Kotlin DSL Lazy Property Assignment -> https://docs.gradle.org/current/userguide/kotlin_dsl.html#kotdsl:assignment
systemProp.org.gradle.unsafe.kotlin.assignment=true

View file

@ -1,7 +1,6 @@
package com.github.continuedev.continueintellijextension.toolWindow
import com.github.continuedev.continueintellijextension.services.ContinuePluginService
import com.intellij.collaboration.async.disposingScope
import com.intellij.openapi.actionSystem.ActionManager
import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.components.ServiceManager
@ -15,54 +14,51 @@ import javax.swing.*
const val JS_QUERY_POOL_SIZE = "200"
class ContinuePluginToolWindowFactory : ToolWindowFactory, DumbAware {
override fun createToolWindowContent(project: Project, toolWindow: ToolWindow) {
val continueToolWindow = ContinuePluginWindow(toolWindow, project)
val content = ContentFactory.getInstance().createContent(continueToolWindow.content, null, false)
toolWindow.contentManager.addContent(content)
val titleActions = mutableListOf<AnAction>()
createTitleActions(titleActions)
override fun createToolWindowContent(project: Project, toolWindow: ToolWindow) {
val continueToolWindow = ContinuePluginWindow(project)
val content =
ContentFactory.getInstance().createContent(continueToolWindow.content, null, false)
toolWindow.contentManager.addContent(content)
val titleActions = mutableListOf<AnAction>()
createTitleActions(titleActions)
// Add MaximizeToolWindow action
val action = ActionManager.getInstance().getAction("MaximizeToolWindow")
if (action != null) {
titleActions.add(action)
}
toolWindow.setTitleActions(titleActions)
// Add MaximizeToolWindow action
val action = ActionManager.getInstance().getAction("MaximizeToolWindow")
if (action != null) {
titleActions.add(action)
}
private fun createTitleActions(titleActions: MutableList<in AnAction>) {
val action = ActionManager.getInstance().getAction("ContinueSidebarActionsGroup")
if (action != null) {
titleActions.add(action)
}
toolWindow.setTitleActions(titleActions)
}
private fun createTitleActions(titleActions: MutableList<in AnAction>) {
val action = ActionManager.getInstance().getAction("ContinueSidebarActionsGroup")
if (action != null) {
titleActions.add(action)
}
}
override fun shouldBeAvailable(project: Project) = true
class ContinuePluginWindow(project: Project) {
private val defaultGUIUrl = "http://continue/index.html"
init {
System.setProperty("ide.browser.jcef.jsQueryPoolSize", JS_QUERY_POOL_SIZE)
System.setProperty("ide.browser.jcef.contextMenu.devTools.enabled", "true")
}
override fun shouldBeAvailable(project: Project) = true
val browser: ContinueBrowser by lazy {
val url = System.getenv("GUI_URL")?.toString() ?: defaultGUIUrl
class ContinuePluginWindow(toolWindow: ToolWindow, project: Project) {
init {
System.setProperty("ide.browser.jcef.jsQueryPoolSize", JS_QUERY_POOL_SIZE)
System.setProperty("ide.browser.jcef.contextMenu.devTools.enabled", "true")
}
val browser: ContinueBrowser by lazy {
val url = "http://continue/index.html";
// Use to get hot-reloading in local development
// val url = "http://localhost:5173/jetbrains_index.html";
val browser = ContinueBrowser(project, url)
val continuePluginService = ServiceManager.getService(
project,
ContinuePluginService::class.java
)
continuePluginService.continuePluginWindow = this
browser
}
val content: JComponent
get() = browser.browser.component
val browser = ContinueBrowser(project, url)
val continuePluginService =
ServiceManager.getService(project, ContinuePluginService::class.java)
continuePluginService.continuePluginWindow = this
browser
}
}
val content: JComponent
get() = browser.browser.component
}
}

View file

@ -77,21 +77,21 @@ function BestExperienceConfigForm({
<form onSubmit={handleSubmit}>
<div className="flex flex-col gap-3">
<div>
<div className="text-lg font-bold mb-1 flex flex-row justify-between gap-4">
<div className="mb-1 flex flex-row justify-between gap-4 text-lg font-bold">
<label className="text-lg font-bold">Chat model</label>
<div
className="flex items-center text-xs font-semibold justify-end hidden sm:flex"
className="flex hidden items-center justify-end text-xs font-semibold sm:flex"
style={{ color: lightGray }}
>
<CubeIcon className="w-4 h-4 mr-1 flex-shrink-0" />
<span className="italic text-right inline">
<CubeIcon className="mr-1 h-4 w-4 flex-shrink-0" />
<span className="inline text-right italic">
{chatModel.title}{" "}
<span className="hidden md:inline">by Anthropic</span>
</span>
</div>
</div>
<div className="flex flex-col pb-4 w-full">
<div className="flex w-full flex-col pb-4">
<Input
placeholder="Enter your Anthropic API Key"
value={chatApiKey}
@ -101,7 +101,7 @@ function BestExperienceConfigForm({
<a
href={chatProvider.apiKeyUrl}
target="_blank"
className="text-inherit underline cursor-pointer hover:text-inherit"
className="cursor-pointer text-inherit underline hover:text-inherit"
>
Click here
</a>{" "}
@ -111,23 +111,23 @@ function BestExperienceConfigForm({
</div>
<div>
<div className="text-lg font-bold mb-1 flex flex-row justify-between gap-4">
<div className="mb-1 flex flex-row justify-between gap-4 text-lg font-bold">
<label className="text-lg font-bold">Autocomplete model</label>
<div
className="flex items-center text-xs font-semibold hidden sm:flex"
className="flex hidden items-center text-xs font-semibold sm:flex"
style={{ color: lightGray }}
>
<CubeIcon className="w-4 h-4 mr-1 flex-shrink-0 inline" />
<span className="italic text-right">
<CubeIcon className="mr-1 inline h-4 w-4 flex-shrink-0" />
<span className="text-right italic">
{autocompleteModel.title}{" "}
<span className="hidden md:inline">by Mistral</span>
</span>
</div>
</div>
<div className="flex flex-col pb-4 w-full">
<div className="flex w-full flex-col pb-4">
<Input
placeholder="Enter your Codestral API Key"
placeholder="Enter your Mistral API Key"
value={autocompleteApiKey}
onChange={(e) => setAutocompleteApiKey(e.target.value)}
/>
@ -135,11 +135,11 @@ function BestExperienceConfigForm({
<a
href={autocompleteProvider.apiKeyUrl}
target="_blank"
className="text-inherit underline cursor-pointer hover:text-inherit"
className="cursor-pointer text-inherit underline hover:text-inherit"
>
Click here
</a>{" "}
to create a Codestral API key
to create a Mistral API key
</InputSubtext>
</div>
</div>
@ -154,4 +154,5 @@ function BestExperienceConfigForm({
</form>
);
}
export default BestExperienceConfigForm;

View file

@ -34,7 +34,7 @@ function JetBrainsFetchGitHubTokenDialog({
}
return (
<div className="p-8 flex flex-col gap-3">
<div className="flex flex-col gap-3 p-8">
<div className="text-center">
<h1 className="my-0">Sign in with GitHub</h1>
<p>
@ -66,7 +66,7 @@ function JetBrainsFetchGitHubTokenDialog({
<Button
onClick={submitJetBrainsToken}
disabled={!jbGhAuthToken}
className="grid grid-flow-col items-center gap-2 w-full mt-2"
className="mt-2 grid w-full grid-flow-col items-center gap-2"
>
Get started using our API keys
</Button>

View file

@ -21,19 +21,19 @@ function OllamaModelDownload({
const id = `info-hover-${encodeURIComponent(command)}`;
function onClick() {
ideMessenger.ide.runCommand(command);
void ideMessenger.ide.runCommand(command);
ideMessenger.post("copyText", { text: command });
}
return (
<div className="flex flex-col">
<p className="text-lg font-bold leading-tight mb-2">{title}</p>
<p className="mb-2 text-lg font-bold leading-tight">{title}</p>
{hasDownloaded ? (
<OllamaCompletedStep text={command} />
) : (
<>
<StyledActionButton data-tooltip-id={id} onClick={onClick}>
<p className="font-mono truncate">{command}</p>
<p className="truncate font-mono text-sm">{command}</p>
<CommandLineIcon width={24} height={24} />
</StyledActionButton>

View file

@ -35,17 +35,17 @@ export function OllamaStatus({ isOllamaConnected }: OllamaStatusProps) {
case OllamaConnectionStatuses.WaitingToDownload:
return (
<StyledActionButton onClick={onClickDownload}>
<p className="underline text-sm truncate mr-1">{downloadUrl}</p>
<p className="mr-1 text-sm underline">{downloadUrl}</p>
<ArrowTopRightOnSquareIcon width={24} height={24} />
</StyledActionButton>
);
case OllamaConnectionStatuses.Downloading:
return (
<div className="flex justify-between items-center">
<p className="text-sm w-3/4 font-mono truncate mr-1">
<div className="flex items-center justify-between">
<p className="mr-1 w-3/4 font-mono text-sm">
Checking for connection to Ollama at http://localhost:11434
</p>
<ArrowPathIcon className="h-4 w-4 animate-spin-slow mr-1" />
<ArrowPathIcon className="animate-spin-slow mr-1 h-4 w-4" />
</div>
);
case OllamaConnectionStatuses.Connected:

View file

@ -19,12 +19,12 @@ function ProviderAlert() {
return (
<div className="w-full">
<Alert type="info">
<p className="font-semibold text-sm m-0">
<p className="m-0 text-sm font-semibold">
Prefer to use a different provider like OpenAI?
</p>
<p className="m-0 mt-1">
<p className="m-0 mt-1 text-xs">
<a
className="text-inherit underline cursor-pointer hover:text-inherit"
className="cursor-pointer text-inherit underline hover:text-inherit"
onClick={onClick}
>
Click here

View file

@ -63,7 +63,7 @@ function QuickstartSubmitButton() {
<div className="mt-4 w-full">
<Button
onClick={onClick}
className="grid grid-flow-col items-center gap-2 w-full"
className="grid w-full grid-flow-col items-center gap-2"
>
Get started using our API keys
</Button>

View file

@ -78,7 +78,7 @@ function OnboardingLocalTab() {
OLLAMA_CHECK_INTERVAL_MS,
);
fetchDownloadedModels();
void fetchDownloadedModels();
return () => clearInterval(intervalId);
}, []);
@ -86,7 +86,7 @@ function OnboardingLocalTab() {
return (
<div className="flex flex-col gap-2">
<div className="flex flex-col">
<p className="text-lg font-bold leading-tight mb-2">Install Ollama</p>
<p className="mb-2 text-lg font-bold leading-tight">Install Ollama</p>
<OllamaStatus isOllamaConnected={isOllamaConnected} />
</div>

View file

@ -172,6 +172,7 @@ export const ButtonSubtext = styled.span`
margin-top: 0;
text-align: center;
color: ${lightGray};
font-size: 0.75rem;
`;
export const CustomScrollbarDiv = styled.div`
@ -304,12 +305,12 @@ export const Label = styled.label<{ fontSize?: number }>`
`;
const spin = keyframes`
from {
-webkit-transform: rotate(0deg);
}
to {
-webkit-transform: rotate(360deg);
}
from {
-webkit-transform: rotate(0deg);
}
to {
-webkit-transform: rotate(360deg);
}
`;
export const Loader = styled.div`
@ -362,9 +363,10 @@ export const HeaderButton = styled.button<{
&:hover {
background-color: ${({ inverted, hoverBackgroundColor }) =>
typeof inverted === "undefined" || inverted
? hoverBackgroundColor ?? vscInputBackground
? (hoverBackgroundColor ?? vscInputBackground)
: "transparent"};
}
display: flex;
align-items: center;
justify-content: center;

View file

@ -17,9 +17,6 @@ class Test {
}
fun divide(number: Double): Test {
if (number == 0.0) {
throw IllegalArgumentException("Cannot divide by zero")
}
result /= number
return this
}