chore: add useOSR setting

This commit is contained in:
Test 2024-11-05 17:17:51 -08:00
parent 7192aa1b02
commit 883e100432
3 changed files with 25 additions and 2 deletions

View file

@ -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
}
}
```

View file

@ -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

View file

@ -2777,6 +2777,11 @@
"x-intellij-html-description": "If set to <code>true</code>, 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
}
}
},