PY-56911 Hide "ASYNCIO_DEBUGGER_ENV"

IJ-CR-97594

GitOrigin-RevId: 863b711c0667dbd964fd8353bf09b9cbee4d9bf9
This commit is contained in:
Egor Eliseev
2022-11-01 14:02:15 +02:00
committed by intellij-monorepo-bot
parent b20825ad9c
commit a1f670ab9d
4 changed files with 12 additions and 9 deletions

View File

@@ -25,6 +25,7 @@ import com.intellij.util.IJSwingUtilities;
import com.jetbrains.python.console.actions.CommandQueueForPythonConsoleService;
import com.jetbrains.python.console.pydev.ConsoleCommunication;
import com.jetbrains.python.parsing.console.PythonConsoleData;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -42,6 +43,8 @@ public final class PyConsoleUtil {
private static final String IPYTHON_PAGING_PROMPT = "---Return to continue, q to quit---";
public static final @NonNls String ASYNCIO_REPL_ENV = "ASYNCIO_REPL";
private static final String[] PROMPTS = new String[]{
ORDINARY_PROMPT,
INDENT_PROMPT,

View File

@@ -102,6 +102,7 @@ import java.util.function.Function;
import java.util.stream.Collectors;
import static com.intellij.execution.runners.AbstractConsoleRunnerWithHistory.registerActionShortcuts;
import static com.jetbrains.python.console.PyConsoleUtil.ASYNCIO_REPL_ENV;
/**
* @author traff, oleg
@@ -118,8 +119,6 @@ public class PydevConsoleRunnerImpl implements PydevConsoleRunner {
"sys.path.extend([" + WORKING_DIR_AND_PYTHON_PATHS + "])\n";
public static final @NonNls String STARTED_BY_RUNNER = "startedByRunner";
public static final @NonNls String INLINE_OUTPUT_SUPPORTED = "INLINE_OUTPUT_SUPPORTED";
private static final @NonNls String ASYNCIO_REPL_ENV = "ASYNCIO_REPL";
private static final @NonNls String ASYNCIO_REPL_COMMAND = "-m asyncio";
private static final Long WAIT_BEFORE_FORCED_CLOSE_MILLIS = 2000L;

View File

@@ -74,6 +74,7 @@ import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static com.jetbrains.python.debugger.PyDebugSupportUtils.ASYNCIO_ENV;
import static com.jetbrains.python.inspections.PyInterpreterInspection.InterpreterSettingsQuickFix.showPythonInterpreterSettings;
@@ -98,8 +99,6 @@ public class PyDebugRunner implements ProgramRunner<RunnerSettings> {
@SuppressWarnings("SpellCheckingInspection")
private static final @NonNls String PYTHONPATH_ENV_NAME = "PYTHONPATH";
private static final @NonNls String ASYNCIO_ENV = "ASYNCIO_DEBUGGER_ENV";
private static final Logger LOG = Logger.getInstance(PyDebugRunner.class);
@Override
@@ -140,11 +139,6 @@ public class PyDebugRunner implements ProgramRunner<RunnerSettings> {
}
protected Promise<@NotNull XDebugSession> createSession(@NotNull RunProfileState state, @NotNull final ExecutionEnvironment environment) {
RunProfile runProfile = environment.getRunProfile();
if (RegistryManager.getInstance().is("python.debug.asyncio.repl") && runProfile instanceof AbstractPythonRunConfiguration<?>) {
((AbstractPythonRunConfiguration<?>) runProfile).getEnvs().put(ASYNCIO_ENV, "True");
}
return AppUIExecutor.onUiThread()
.submit(FileDocumentManager.getInstance()::saveAllDocuments)
.thenAsync(ignored -> {
@@ -628,6 +622,10 @@ public class PyDebugRunner implements ProgramRunner<RunnerSettings> {
environmentController.appendTargetPathToPathsValue(PYTHONPATH_ENV_NAME, CYTHON_EXTENSIONS_DIR);
}
if (RegistryManager.getInstance().is("python.debug.asyncio.repl")) {
environmentController.putFixedValue(ASYNCIO_ENV, "True");
}
final AbstractPythonRunConfiguration runConfiguration = runProfile instanceof AbstractPythonRunConfiguration ?
(AbstractPythonRunConfiguration)runProfile : null;
final Module module = runConfiguration != null ? runConfiguration.getModule() : null;

View File

@@ -14,6 +14,7 @@ import com.intellij.xdebugger.XDebugSession;
import com.intellij.xdebugger.impl.ui.DebuggerUIUtil;
import com.jetbrains.python.PyTokenTypes;
import com.jetbrains.python.psi.*;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -23,6 +24,8 @@ public final class PyDebugSupportUtils {
private PyDebugSupportUtils() {
}
public static final @NonNls String ASYNCIO_ENV = "ASYNCIO_DEBUGGER_ENV";
// can expression be evaluated, or should be executed
public static boolean isExpression(final Project project, final String expression) {
return ReadAction.compute(() -> {