Commit d34392a7 authored by Elizaveta Shashkova's avatar Elizaveta Shashkova
Browse files

PY-34398 Stop debug session after cell execution and save cell ids between...

PY-34398 Stop debug session after cell execution and save cell ids between debug sessions (IDEA-CR-44654 )
parent 83f5c05e
Branches unavailable Tags unavailable
No related merge requests found
Showing with 36 additions and 12 deletions
+36 -12
......@@ -620,9 +620,10 @@ class NetCommandFactory:
cmdText = '<process/>'
return NetCommand(CMD_PROCESS_CREATED, 0, cmdText)
def make_show_cython_warning_message(self):
def make_show_warning_message(self, message_id):
try:
return NetCommand(CMD_SHOW_CYTHON_WARNING, 0, '')
cmdText = '<xml><warning id="%s" /></xml>' % message_id
return NetCommand(CMD_SHOW_CYTHON_WARNING, 0, cmdText)
except:
return self.make_error_message(0, get_exception_traceback_str())
......
......@@ -1031,7 +1031,7 @@ class PyDB:
PyDBCommandThread(self).start()
if show_tracing_warning or show_frame_eval_warning:
cmd = self.cmd_factory.make_show_cython_warning_message()
cmd = self.cmd_factory.make_show_warning_message("cython")
self.writer.add_command(cmd)
......
......@@ -390,9 +390,17 @@ def setup_client_server_paths(paths):
setup_client_server_paths(PATHS_FROM_ECLIPSE_TO_PYTHON)
def _is_int(filename):
# isdigit() doesn't support negative numbers
try:
int(filename)
return True
except:
return False
def is_real_file(filename):
# Check for Jupyter cells
return not filename.isdigit() and not filename.startswith("<ipython-input")
return not _is_int(filename) and not filename.startswith("<ipython-input")
# For given file f returns tuple of its absolute path, real path and base name
def get_abs_path_real_path_and_base_from_file(f):
......
......@@ -39,7 +39,10 @@ public interface IPyDebugProcess extends PyFrameAccessor {
void consoleInputRequested(boolean isStarted);
@Deprecated
void showCythonWarning();
void showWarning(String warningId);
XDebugSession getSession();
}
......@@ -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) {
......
......@@ -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()) {
......
......@@ -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);
......
......@@ -81,7 +81,7 @@ public class PyDebugProcess extends XDebugProcess implements IPyDebugProcess, Pr
private static final Logger LOG = Logger.getInstance("#com.jetbrains.python.debugger.PyDebugProcess");
private static final int CONNECTION_TIMEOUT = 60000;
private static final NotificationGroup NOTIFICATION_GROUP =
public static final NotificationGroup NOTIFICATION_GROUP =
NotificationGroup.toolWindowGroup(PyBundle.message("debug.notification.group"), ToolWindowId.DEBUG);
private final ProcessDebugger myDebugger;
......@@ -388,10 +388,15 @@ public class PyDebugProcess extends XDebugProcess implements IPyDebugProcess, Pr
}
@Override
public void showCythonWarning() {
if (!isCythonWarningShown) {
PyCythonExtensionWarning.showCythonExtensionWarning(getSession().getProject());
isCythonWarningShown = true;
public void showCythonWarning() { }
@Override
public void showWarning(String warningId) {
if (warningId.equals("cython")) {
if (!isCythonWarningShown) {
PyCythonExtensionWarning.showCythonExtensionWarning(getSession().getProject());
isCythonWarningShown = true;
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment