Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show cody console only in dev mode #2694

Merged
merged 1 commit into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,7 @@ tasks {
"${layout.buildDirectory.asFile.get()}/sourcegraph/cody-agent-trace.json",
"cody-agent.directory" to buildCodyDir.parent,
"sourcegraph.verbose-logging" to "true",
"cody-agent.panic-when-out-of-sync" to
(System.getProperty("cody-agent.panic-when-out-of-sync") ?: "true"),
"cody-agent.is-dev-mode" to (System.getProperty("cody-agent.is-dev-mode") ?: "true"),
"cody-agent.fullDocumentSyncEnabled" to
(System.getProperty("cody-agent.fullDocumentSyncEnabled") ?: "false"),
"cody.autocomplete.enableFormatting" to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import com.sourcegraph.cody.agent.protocol_generated.ProtocolTextDocument
import com.sourcegraph.cody.agent.protocol_generated.ProtocolTextDocumentContentChangeEvent
import com.sourcegraph.cody.agent.protocol_generated.Range
import com.sourcegraph.cody.agent.protocol_generated.TestingParams
import com.sourcegraph.config.ConfigUtil
import java.awt.Point
import java.nio.file.FileSystems
import java.util.Locale
Expand All @@ -28,17 +29,18 @@ object ProtocolTextDocumentExt {
selection: Range? = null,
selectedText: String? = null
): TestingParams? {
if (!TestingParamsExt.doIncludeTestingParam) {
return null
if (ConfigUtil.isDevMode()) {
return TestingParams(
selectedText = selectedText,
sourceOfTruthDocument =
ProtocolTextDocument(
uri = uri,
content = content,
selection = selection,
))
}
return TestingParams(
selectedText = selectedText,
sourceOfTruthDocument =
ProtocolTextDocument(
uri = uri,
content = content,
selection = selection,
))

return null
}

@RequiresEdt
Expand Down

This file was deleted.

8 changes: 6 additions & 2 deletions src/main/kotlin/com/sourcegraph/cody/error/CodyConsole.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,12 @@ class CodyConsole(project: Project) {
logger.info(messageText)
}

if (ConfigUtil.isCodyDebugEnabled()) {
toolWindow?.contentManager?.getReady(this)?.doWhenDone { toolWindow.show() }
if (ConfigUtil.isCodyDebugEnabled() && ConfigUtil.isDevMode()) {
toolWindow?.contentManager?.getReady(this)?.doWhenDone {
if (!toolWindow.isVisible) {
toolWindow.show()
}
}
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/kotlin/com/sourcegraph/config/ConfigUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ object ConfigUtil {

@JvmStatic fun isCodyDebugEnabled(): Boolean = CodyApplicationSettings.instance.isCodyDebugEnabled

@JvmStatic fun isDevMode(): Boolean = System.getProperty("cody-agent.is-dev-mode") == "true"

@JvmStatic
fun isCodyUIHintsEnabled(): Boolean = CodyApplicationSettings.instance.isCodyUIHintsEnabled

Expand Down
Loading