From 883e100432d6d85b2fee5f34377ccbc2d66dadbd Mon Sep 17 00:00:00 2001 From: Test Date: Tue, 5 Nov 2024 17:17:51 -0800 Subject: [PATCH] chore: add useOSR setting --- docs/docs/reference.md | 4 +++- .../toolWindow/ContinueBrowser.kt | 18 +++++++++++++++++- extensions/vscode/config_schema.json | 5 +++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/docs/docs/reference.md b/docs/docs/reference.md index 391273943..0ce6fc6a1 100644 --- a/docs/docs/reference.md +++ b/docs/docs/reference.md @@ -369,6 +369,7 @@ Customizable UI settings to control interface appearance and behavior. - `fontSize`: Specifies font size for UI elements. - `displayRawMarkdown`: If `true`, shows raw markdown in responses. - `showChatScrollbar`: If `true`, enables a scrollbar in the chat window. +- `useOSR`: Controls off-screen rendering in JetBrains IDEs. By default, Continue will automatically determine whether to use OSR based on your IDE version. Set this to `true` to force OSR on, or `false` to force it off. Only applies to JetBrains IDEs. Example: @@ -377,7 +378,8 @@ Example: "ui": { "codeBlockToolbarPosition": "bottom", "fontSize": 14, - "displayRawMarkdown": false + "displayRawMarkdown": false, + "useOSR": true } } ``` diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinueBrowser.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinueBrowser.kt index 6d132b030..7aaefa10f 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinueBrowser.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinueBrowser.kt @@ -275,7 +275,11 @@ class ContinueBrowser(val project: Project, url: String) { } /** - * This function checks if the pluginSinceBuild is greater than or equal to 233, which corresponds + * This function checks if off-screen rendering (OSR) should be used. + * + * If ui.useOSR is set in config.json, that value is used. + * + * Otherwise, we check if the pluginSinceBuild is greater than or equal to 233, which corresponds * to IntelliJ platform version 2023.3 and later. * * Setting `setOffScreenRendering` to `false` causes a number of issues such as a white screen flash when loading @@ -293,6 +297,18 @@ class ContinueBrowser(val project: Project, url: String) { * it's a simple integer without dot notation, making it easier to compare. */ private fun shouldRenderOffScreen(): Boolean { + val continuePluginService = ServiceManager.getService( + project, + ContinuePluginService::class.java + ) + + // Check if useOSR is explicitly set in config + val useOSR = continuePluginService.coreMessenger?.config?.ui?.useOSR + if (useOSR != null) { + return useOSR + } + + // Fall back to version check val minBuildNumber = 233 val applicationInfo = ApplicationInfo.getInstance() val currentBuildNumber = applicationInfo.build.baselineVersion diff --git a/extensions/vscode/config_schema.json b/extensions/vscode/config_schema.json index 49734ac29..80cc304b3 100644 --- a/extensions/vscode/config_schema.json +++ b/extensions/vscode/config_schema.json @@ -2777,6 +2777,11 @@ "x-intellij-html-description": "If set to true, a scrollbar will be displayed in the chat window to navigate through messages.", "default": false, "type": "boolean" + }, + "useOSR": { + "type": "boolean", + "description": "Whether to use off-screen rendering in JetBrains IDEs. By default, Continue will automatically determine whether to use OSR based on your IDE version. Set this to true to force OSR on, or false to force it off.", + "default": null } } },