[Groovy] Replace ConsoleViewContentType#NON_INTERACTIVE_USER_INPUT by creating GroovyConsoleView more precisely

IDEA-352801

GitOrigin-RevId: 03c0b03698a29230b5689e1ec87015e920ce9e1f
This commit is contained in:
Georgii Ustinov
2024-05-21 13:37:47 +03:00
committed by intellij-monorepo-bot
parent 712765cac2
commit a6cf901dd2
5 changed files with 17 additions and 12 deletions

View File

@@ -89,7 +89,6 @@ c:com.intellij.execution.ui.ConsoleViewContentType
- sf:LOG_VERBOSE_OUTPUT_KEY:com.intellij.openapi.editor.colors.TextAttributesKey
- sf:LOG_WARNING_OUTPUT:com.intellij.execution.ui.ConsoleViewContentType
- sf:LOG_WARNING_OUTPUT_KEY:com.intellij.openapi.editor.colors.TextAttributesKey
- sf:NON_INTERACTIVE_USER_INPUT:com.intellij.execution.ui.ConsoleViewContentType
- sf:NORMAL_OUTPUT:com.intellij.execution.ui.ConsoleViewContentType
- sf:NORMAL_OUTPUT_KEY:com.intellij.openapi.editor.colors.TextAttributesKey
- sf:OUTPUT_TYPES:com.intellij.execution.ui.ConsoleViewContentType[]

View File

@@ -47,7 +47,6 @@ public class ConsoleViewContentType {
public static final ConsoleViewContentType ERROR_OUTPUT = new ConsoleViewContentType("ERROR_OUTPUT", ERROR_OUTPUT_KEY);
public static final ConsoleViewContentType SYSTEM_OUTPUT = new ConsoleViewContentType("SYSTEM_OUTPUT", SYSTEM_OUTPUT_KEY);
public static final ConsoleViewContentType USER_INPUT = new ConsoleViewContentType("USER_INPUT", USER_INPUT_KEY);
public static final ConsoleViewContentType NON_INTERACTIVE_USER_INPUT = new ConsoleViewContentType("NON_INTERACTIVE_USER_INPUT", USER_INPUT_KEY);
public static final ConsoleViewContentType[] OUTPUT_TYPES = {NORMAL_OUTPUT, ERROR_OUTPUT, USER_INPUT, SYSTEM_OUTPUT};

View File

@@ -980,13 +980,6 @@ public class ConsoleViewImplTest extends LightPlatformTestCase {
}
}
public void testSupportsNonInteractiveUserInput() {
myConsole.print("> ", ConsoleViewContentType.NON_INTERACTIVE_USER_INPUT);
myConsole.print("input", ConsoleViewContentType.NON_INTERACTIVE_USER_INPUT);
myConsole.flushDeferredText();
assertMarkersEqual(getAllRangeHighlighters(), new ExpectedHighlighter(0, 7, ConsoleViewContentType.NON_INTERACTIVE_USER_INPUT));
}
public void testTypingMustLeadToMergedUserInputTokensAtTheDocumentEnd() {
myConsole.type(myConsole.getEditor(), "/");
myConsole.flushDeferredText();

View File

@@ -66,8 +66,8 @@ public final class GroovyConsole {
private void doExecute(@NotNull String command) {
for (String line : command.trim().split("\n")) {
myConsoleView.print("> ", ConsoleViewContentType.NON_INTERACTIVE_USER_INPUT);
myConsoleView.print(line, ConsoleViewContentType.NON_INTERACTIVE_USER_INPUT);
myConsoleView.print("> ", ConsoleViewContentType.USER_INPUT);
myConsoleView.print(line, ConsoleViewContentType.USER_INPUT);
myConsoleView.print("\n", ConsoleViewContentType.NORMAL_OUTPUT);
}
ApplicationManager.getApplication().executeOnPooledThread(

View File

@@ -1,11 +1,25 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.plugins.groovy.console
import com.intellij.execution.impl.ConsoleState
import com.intellij.execution.impl.ConsoleState.NotStartedStated
import com.intellij.execution.impl.ConsoleViewImpl
import com.intellij.execution.impl.ConsoleViewRunningState
import com.intellij.execution.process.ProcessHandler
import com.intellij.execution.ui.ConsoleViewContentType
import com.intellij.openapi.project.Project
import com.intellij.psi.search.GlobalSearchScope
class GroovyConsoleView(project: Project) : ConsoleViewImpl(project, true) {
class GroovyConsoleView(project: Project) : ConsoleViewImpl(
project,
GlobalSearchScope.allScope(project),
true,
object : NotStartedStated() {
override fun attachTo(console: ConsoleViewImpl, processHandler: ProcessHandler): ConsoleState {
return ConsoleViewRunningState(console, processHandler, this, true, false)
}
},
true) {
companion object {
private const val RESULT_MARKER = "ee2d5778-e2f4-4705-84ef-0847535c32f4"