Skip to content

Commit 0dd0a72

Browse files
zuevmaximauduchinok
authored andcommitted
[console] IJPL-246107 Migrate ProcessOutputType comparison to isStdout/isStderr/isSystem checks
GitOrigin-RevId: 90d9ea72245f007149dae8c0c49a7b54ef643482
1 parent ca1787e commit 0dd0a72

2 files changed

Lines changed: 8 additions & 9 deletions

File tree

rider-fsharp/src/main/java/com/jetbrains/rider/plugins/fsharp/services/fsi/FsiProcessHandler.kt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package com.jetbrains.rider.plugins.fsharp.services.fsi
33
import com.intellij.execution.process.OSProcessHandler
44
import com.intellij.execution.process.ProcessEvent
55
import com.intellij.execution.process.ProcessListener
6-
import com.intellij.execution.process.ProcessOutputTypes
6+
import com.intellij.execution.process.ProcessOutputType
77
import com.intellij.execution.ui.ConsoleViewContentType
88
import com.intellij.openapi.rd.util.launchOnUi
99
import com.intellij.openapi.util.Key
@@ -36,12 +36,12 @@ internal class FsiProcessHandler(
3636
lifetime.launchOnUi {
3737
it.consumeEach { (text, outputType) ->
3838
if (text != "> ") {
39-
when (outputType) {
40-
ProcessOutputTypes.STDOUT -> {
39+
when {
40+
ProcessOutputType.isStdout(outputType) -> {
4141
fsiInputOutputProcessor.printOutputText(text, ConsoleViewContentType.NORMAL_OUTPUT)
4242
}
4343

44-
ProcessOutputTypes.STDERR -> {
44+
ProcessOutputType.isStderr(outputType) -> {
4545
fsiInputOutputProcessor.printOutputText(text, ConsoleViewContentType.ERROR_OUTPUT)
4646
}
4747
}
@@ -56,9 +56,8 @@ internal class FsiProcessHandler(
5656
}
5757

5858
override fun notifyTextAvailable(text: String, outputType: Key<*>) {
59-
when (outputType) {
60-
ProcessOutputTypes.STDOUT,
61-
ProcessOutputTypes.STDERR -> {
59+
when {
60+
ProcessOutputType.isStdout(outputType) || ProcessOutputType.isStderr(outputType) -> {
6261
ThreadingAssertions.assertBackgroundThread()
6362
channel.trySendBlocking(text to outputType)
6463
}

rider-fsharp/src/main/java/com/jetbrains/rider/plugins/fsharp/services/fsi/FsiSandboxInfoUpdater.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class FsiSandboxInfoUpdater(
9191
fun onOutputEnd() {
9292
if (!ProcessOutputType.isSystem(fsiProcessOutputListener.lastOutputType)) {
9393
verifiedCommandNumber += 1
94-
if (fsiProcessOutputListener.lastOutputType == ProcessOutputTypes.STDOUT) {
94+
if (ProcessOutputType.isStdout(fsiProcessOutputListener.lastOutputType)) {
9595
correctCommandNumbers.add(verifiedCommandNumber)
9696

9797
updateSandboxInfo()
@@ -106,7 +106,7 @@ class FsiSandboxInfoUpdater(
106106
var lastOutputType: Key<*> = ProcessOutputTypes.SYSTEM
107107

108108
override fun onTextAvailable(event: ProcessEvent, outputType: Key<*>) {
109-
if (outputType == ProcessOutputTypes.STDOUT && !ProcessOutputType.isSystem(lastOutputType))
109+
if (ProcessOutputType.isStdout(outputType) && !ProcessOutputType.isSystem(lastOutputType))
110110
lastOutputType = ProcessOutputTypes.STDOUT
111111
}
112112

0 commit comments

Comments
 (0)