PY-34398 Stop debug session after cell execution and save cell ids between debug sessions (IDEA-CR-44654 )

This commit is contained in:
Elizaveta Shashkova
2019-03-05 15:03:07 +03:00
parent 83f5c05eb5
commit d34392a7dd
8 changed files with 36 additions and 12 deletions

View File

@@ -39,7 +39,10 @@ public interface IPyDebugProcess extends PyFrameAccessor {
void consoleInputRequested(boolean isStarted);
@Deprecated
void showCythonWarning();
void showWarning(String warningId);
XDebugSession getSession();
}

View File

@@ -56,7 +56,7 @@ public abstract class AbstractCommand<T> {
public static final int INPUT_REQUESTED = 147;
public static final int PROCESS_CREATED = 149;
public static final int SHOW_CYTHON_WARNING = 150;
public static final int SHOW_WARNING = 150;
public static final int LOAD_FULL_VALUE = 151;
/**
@@ -242,7 +242,7 @@ public abstract class AbstractCommand<T> {
}
public static boolean isShowWarningCommand(final int command) {
return command == SHOW_CYTHON_WARNING;
return command == SHOW_WARNING;
}
public static boolean isExitEvent(final int command) {

View File

@@ -397,6 +397,12 @@ public class ProtocolParser {
return values;
}
public static String parseWarning(final String text) throws PyDebuggerException {
final XppReader reader = openReader(text, true);
reader.moveDown();
return readString(reader, "id", null);
}
private static XppReader openReader(final String text, final boolean checkForContent) throws PyDebuggerException {
final XppReader reader = new XppReader(new StringReader(text), new MXParser(), new NoNameCoder());
if (checkForContent && !reader.hasMoreChildren()) {

View File

@@ -549,7 +549,8 @@ public class RemoteDebugger implements ProcessDebugger {
onProcessCreatedEvent(frame.getSequence());
}
else if (AbstractCommand.isShowWarningCommand(frame.getCommand())) {
myDebugProcess.showCythonWarning();
final String warningId = ProtocolParser.parseWarning(frame.getPayload());
myDebugProcess.showWarning(warningId);
}
else {
placeResponse(frame.getSequence(), frame);