mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-87975 debugpy: add Jupyter backend switch handler and improve debugpy switcher UI
JupyterDebugBackendSwitchHandler — new handler for backend switching: restarts the Jupyter kernel for a clean state. PyDebuggerBackendSwitcherAction — Beta instead of New for debugpy; "Report Issue" now pre-fills the description with system information Merge-request: IJ-MR-195507 Merged-by: Egor Eliseev <Egor.Eliseev@jetbrains.com> (cherry picked from commit ba620baef07b931fe85f62e582dd075fdc2517c1) GitOrigin-RevId: 101da0656ca06fcfcfee2c687a7ade4920b92eae
This commit is contained in:
committed by
intellij-monorepo-bot
parent
f706d1e04c
commit
54a1d7a280
@@ -886,9 +886,6 @@ debugger.backend.switcher.label=Debugger mode:
|
||||
debugger.backend.pydevd.description=The core debugger engine that runs inside Python. Handles breakpoints, stepping, and execution control behind the scenes.
|
||||
debugger.backend.debugpy.description=Connects your IDE to a running Python program for debugging. Enables breakpoints, stepping, variable inspection, and remote debugging from your editor.
|
||||
debugger.backend.debugpy.disabled.tooltip=debugpy requires Python 3.9 or later
|
||||
debugger.backend.switch.during.session.title=Switch Debugger Backend
|
||||
debugger.backend.switch.during.session.message=Debugger backend cannot be switched during a running debug session. To apply the new setting, your current sessions will have to be restarted.
|
||||
debugger.backend.switch.and.restart=Switch and Restart
|
||||
|
||||
python.local.attach.group.name=Python
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ import com.intellij.openapi.components.State;
|
||||
import com.intellij.openapi.components.Storage;
|
||||
import com.intellij.openapi.components.StoragePathMacros;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.xdebugger.XDebugSession;
|
||||
import com.intellij.xdebugger.XDebugSessionListener;
|
||||
@@ -168,30 +167,12 @@ public final class PyDebuggerOptionsProvider implements PersistentStateComponent
|
||||
}
|
||||
|
||||
/**
|
||||
* Switches to {@code newBackend}, prompting the user to confirm a session restart when sessions are active.
|
||||
*
|
||||
* @return {@code true} if the backend was changed (possibly with a restart), {@code false} if the user cancelled.
|
||||
* Switches to {@code newBackend} and restarts active Python debug sessions if any.
|
||||
*/
|
||||
public static boolean switchBackendWithRestart(@NotNull Project project, @NotNull PyDebuggerBackend newBackend) {
|
||||
PyDebuggerOptionsProvider options = getInstance(project);
|
||||
if (options.getSelectedBackend() == newBackend) return true;
|
||||
boolean hasSessions = hasActivePythonSessions(project);
|
||||
if (hasSessions) {
|
||||
int result = Messages.showDialog(
|
||||
project,
|
||||
PyBundle.message("debugger.backend.switch.during.session.message"),
|
||||
PyBundle.message("debugger.backend.switch.during.session.title"),
|
||||
new String[]{PyBundle.message("debugger.backend.switch.and.restart"), Messages.getCancelButton()},
|
||||
0,
|
||||
Messages.getWarningIcon()
|
||||
);
|
||||
if (result != 0) return false;
|
||||
}
|
||||
options.setSelectedBackend(newBackend);
|
||||
if (hasSessions) {
|
||||
restartAllPythonSessions(project);
|
||||
}
|
||||
return true;
|
||||
@ApiStatus.Internal
|
||||
public static void switchBackendWithRestart(@NotNull Project project, @NotNull PyDebuggerBackend newBackend) {
|
||||
getInstance(project).setSelectedBackend(newBackend);
|
||||
restartAllPythonSessions(project);
|
||||
}
|
||||
|
||||
public static void restartAllPythonSessions(@NotNull Project project) {
|
||||
|
||||
Reference in New Issue
Block a user