This commit is contained in:
Nate 2024-10-22 19:34:15 -07:00
commit 484673e5f4
5 changed files with 61 additions and 38 deletions

View file

@ -1,20 +1,20 @@
import { ContinueProxyReranker } from "../../context/rerankers/ContinueProxyReranker.js";
import { ControlPlaneProxyInfo } from "../../control-plane/analytics/IAnalyticsProvider.js";
import { ControlPlaneClient } from "../../control-plane/client.js";
import { controlPlaneEnv } from "../../control-plane/env.js";
import { TeamAnalytics } from "../../control-plane/TeamAnalytics.js";
import {
ContinueConfig,
ContinueRcJson,
IDE,
IdeSettings,
SerializedContinueConfig,
} from "../../index.js";
import ContinueProxyEmbeddingsProvider from "../../indexing/embeddings/ContinueProxyEmbeddingsProvider.js";
import ContinueProxy from "../../llm/llms/stubs/ContinueProxy.js";
import { Telemetry } from "../../util/posthog.js";
import { TTS } from "../../util/tts.js";
import { ConfigResult, loadFullConfigNode } from "../load.js";
} from "../../";
import { ContinueProxyReranker } from "../../context/rerankers/ContinueProxyReranker.js";
import { ControlPlaneProxyInfo } from "../../control-plane/analytics/IAnalyticsProvider.js";
import { ControlPlaneClient } from "../../control-plane/client.js";
import { controlPlaneEnv } from "../../control-plane/env.js";
import { TeamAnalytics } from "../../control-plane/TeamAnalytics.js";
import ContinueProxyEmbeddingsProvider from "../../indexing/embeddings/ContinueProxyEmbeddingsProvider";
import ContinueProxy from "../../llm/llms/stubs/ContinueProxy";
import { Telemetry } from "../../util/posthog";
import { TTS } from "../../util/tts";
import { ConfigResult, loadFullConfigNode } from "../load";
export default async function doLoadConfig(
ide: IDE,
@ -24,13 +24,7 @@ export default async function doLoadConfig(
overrideConfigJson: SerializedContinueConfig | undefined,
workspaceId?: string,
): Promise<ConfigResult<ContinueConfig>> {
let workspaceConfigs: ContinueRcJson[] = [];
try {
workspaceConfigs = await ide.getWorkspaceConfigs();
} catch (e) {
console.warn("Failed to load workspace configs");
}
const workspaceConfigs = await getWorkspaceConfigs(ide);
const ideInfo = await ide.getIdeInfo();
const uniqueId = await ide.getUniqueId();
const ideSettings = await ideSettingsPromise;
@ -128,3 +122,21 @@ async function injectControlPlaneProxyInfo(
return config;
}
async function getWorkspaceConfigs(ide: IDE): Promise<ContinueRcJson[]> {
const ideInfo = await ide.getIdeInfo();
let workspaceConfigs: ContinueRcJson[] = [];
try {
workspaceConfigs = await ide.getWorkspaceConfigs();
// Config is sent over the wire from JB so we need to parse it
if (ideInfo.ideType === "jetbrains") {
workspaceConfigs = (workspaceConfigs as any).map(JSON.parse);
}
} catch (e) {
console.debug("Failed to load workspace configs: ", e);
}
return workspaceConfigs;
}

View file

@ -4,7 +4,7 @@
<option name="env">
<map>
<entry key="GUI_URL" value="http://localhost:5173/jetbrains_index.html" />
<entry key="ORG_GRADLE_PROJECT_platformVersion" value="2024.2.3" />
<entry key="ORG_GRADLE_PROJECT_platformVersion" value="2024.1" />
<entry key="USE_TCP" value="true" />
</map>
</option>

View file

@ -86,7 +86,7 @@ through the `Core binary` task.
- `extensions/intellij`: Breakpoints can be set in Intellij
- `gui`: You'll need to set explicit `debugger` statements in the source code, or through the browser dev tools
- `core`: Breakpoints can be set in VS Code
- `core`: Breakpoints can be set in VS Code (requires restarting the _Core Binary_ task)
### Available Gradle tasks

View file

@ -300,7 +300,7 @@ class IdeProtocolClient(
"getWorkspaceConfigs" -> {
val workspaceDirs = workspaceDirectories()
val configs: List<String> = listOf()
val configs = mutableListOf<String>()
for (workspaceDir in workspaceDirs) {
val workspacePath = File(workspaceDir)
val dir = VirtualFileManager.getInstance().findFileByUrl("file://$workspacePath")
@ -312,7 +312,7 @@ class IdeProtocolClient(
if (file.endsWith(".continuerc.json")) {
val filePath = workspacePath.resolve(file)
val fileContent = File(filePath.toString()).readText()
configs.plus(fileContent)
configs.add(fileContent)
}
}
}

View file

@ -225,9 +225,20 @@ function CodeBlockToolBar(props: CodeBlockToolBarProps) {
style={{ backgroundColor: vscEditorBackground }}
onClick={onClickApply}
>
<CommandLineIcon className="w-4 h-4" />
<CommandLineIcon className="h-4 w-4 text-gray-400" />
</ButtonWithTooltip>
)}
<ButtonWithTooltip
text={isApplying ? "Applying..." : "Apply"}
style={{ backgroundColor: vscEditorBackground }}
onClick={onClickApply}
>
{isApplying ? (
<CheckIcon className="h-4 w-4 text-green-400" />
) : (
<PlayIcon className="h-4 w-4 text-gray-400" />
)}
</ButtonWithTooltip>
<ButtonWithTooltip
text="Insert at cursor"
style={{ backgroundColor: vscEditorBackground }}
@ -235,7 +246,7 @@ function CodeBlockToolBar(props: CodeBlockToolBarProps) {
ideMessenger.post("insertAtCursor", { text: props.text })
}
>
<ArrowLeftEndOnRectangleIcon className="w-4 h-4" />
<ArrowLeftEndOnRectangleIcon className="h-4 w-4 text-gray-400" />
</ButtonWithTooltip>
<CopyButtonHeader text={props.text} />
</InnerHoverDiv>
@ -246,7 +257,7 @@ function CodeBlockToolBar(props: CodeBlockToolBarProps) {
return (
<ToolbarDiv>
<div
className="flex items-center gap-1 cursor-pointer max-w-[50%]"
className="flex max-w-[50%] cursor-pointer items-center gap-1"
onClick={onClickHeader}
>
<FileIcon height="20px" width="20px" filename={props.filepath} />
@ -256,18 +267,18 @@ function CodeBlockToolBar(props: CodeBlockToolBarProps) {
<div className="flex items-center gap-1">
<ToolbarButton onClick={onClickCopy}>
<div
className="flex items-center gap-1 hover:brightness-125 transition-colors duration-200"
className="flex items-center gap-1 transition-colors duration-200 hover:brightness-125"
style={{ color: lightGray }}
>
{isCopied ? (
<>
<CheckIcon className="w-3 h-3 text-green-500 hover:brightness-125" />
<CheckIcon className="h-3 w-3 text-green-500 hover:brightness-125" />
<span className="hidden sm:inline">Copied</span>
</>
) : (
<>
<ClipboardIcon className="w-3 h-3 hover:brightness-125" />
<span className="hidden xs:inline">Copy</span>
<ClipboardIcon className="h-3 w-3 hover:brightness-125" />
<span className="xs:inline hidden">Copy</span>
</>
)}
</div>
@ -281,11 +292,11 @@ function CodeBlockToolBar(props: CodeBlockToolBarProps) {
style={{ color: lightGray }}
>
<div
className="flex items-center gap-1 hover:brightness-125 transition-colors duration-200"
className="flex items-center gap-1 transition-colors duration-200 hover:brightness-125"
style={{ color: lightGray }}
>
<PlayIcon className="w-3 h-3" />
<span className="hidden xs:inline">Apply</span>
<PlayIcon className="h-3 w-3" />
<span className="xs:inline hidden">Apply</span>
</div>
</ToolbarButton>
) : applyState === "done" ? (
@ -294,8 +305,8 @@ function CodeBlockToolBar(props: CodeBlockToolBarProps) {
onClick={onClickReject}
tooltipContent={`${getMetaKeyLabel()}⇧⌫`}
>
<XMarkIcon className="w-4 h-4 text-red-500 hover:brightness-125 mr-1" />
<div className="flex items-center gap-1 hover:brightness-125 transition-colors duration-200 ">
<XMarkIcon className="mr-1 h-4 w-4 text-red-500 hover:brightness-125" />
<div className="flex items-center gap-1 transition-colors duration-200 hover:brightness-125">
<span>Reject</span>
</div>
</ToolbarButtonWithTooltip>
@ -304,16 +315,16 @@ function CodeBlockToolBar(props: CodeBlockToolBarProps) {
onClick={onClickAccept}
tooltipContent={`${getMetaKeyLabel()}⇧⏎`}
>
<CheckIcon className="w-4 h-4 text-green-500 hover:brightness-125 mr-1" />
<div className="flex items-center gap-1 hover:brightness-125 transition-colors duration-200">
<CheckIcon className="mr-1 h-4 w-4 text-green-500 hover:brightness-125" />
<div className="flex items-center gap-1 transition-colors duration-200 hover:brightness-125">
<span>Accept</span>
</div>
</ToolbarButtonWithTooltip>
</>
) : (
<div className="flex items-center mr-2">
<div className="mr-2 flex items-center">
<svg
className="animate-spin h-4 w-4 text-gray-400"
className="h-4 w-4 animate-spin text-gray-400"
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"