mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Add "Don't step into libraries" option (PY-18493)
This commit is contained in:
@@ -453,11 +453,15 @@ class PyDBFrame: # No longer cdef because object was dying when only a reference
|
||||
stop = False
|
||||
main_debugger.first_breakpoint_reached = True
|
||||
else:
|
||||
pass
|
||||
# if the frame is traced after breakpoint stop,
|
||||
# but the file should be ignored while stepping because of filters
|
||||
if step_cmd != -1 and main_debugger.is_filter_enabled and main_debugger.is_ignored_by_filters(filename):
|
||||
return self.trace_dispatch
|
||||
if step_cmd != -1:
|
||||
if main_debugger.is_filter_enabled and main_debugger.is_ignored_by_filters(filename):
|
||||
# ignore files matching stepping filters
|
||||
return self.trace_dispatch
|
||||
if main_debugger.is_filter_libraries and main_debugger.not_in_scope(filename):
|
||||
# ignore library files while stepping
|
||||
return self.trace_dispatch
|
||||
if stop:
|
||||
self.set_suspend(thread, CMD_SET_BREAK)
|
||||
elif flag and plugin_manager is not None:
|
||||
|
||||
@@ -118,10 +118,13 @@ class ThreadTracer:
|
||||
# print('skipped: trace_dispatch', base, frame.f_lineno, event, frame.f_code.co_name, file_type)
|
||||
return None
|
||||
|
||||
# ignore files matching stepping filters
|
||||
if additional_info.pydev_step_cmd != -1 and py_db.is_filter_enabled and \
|
||||
py_db.is_ignored_by_filters(abs_path_real_path_and_base[1]):
|
||||
return None
|
||||
if additional_info.pydev_step_cmd != -1:
|
||||
if py_db.is_filter_enabled and py_db.is_ignored_by_filters(abs_path_real_path_and_base[1]):
|
||||
# ignore files matching stepping filters
|
||||
return None
|
||||
if py_db.is_filter_libraries and py_db.not_in_scope(abs_path_real_path_and_base[1]):
|
||||
# ignore library files while stepping
|
||||
return None
|
||||
|
||||
# print('trace_dispatch', base, frame.f_lineno, event, frame.f_code.co_name, file_type)
|
||||
if additional_info.is_tracing:
|
||||
|
||||
@@ -154,6 +154,10 @@ def is_filter_enabled():
|
||||
return os.getenv('PYDEVD_FILTERS') is not None
|
||||
|
||||
|
||||
def is_filter_libraries():
|
||||
return os.getenv('PYDEVD_FILTER_LIBRARIES') is not None
|
||||
|
||||
|
||||
def _get_stepping_filters(filters_cache=[]):
|
||||
if not filters_cache:
|
||||
filters = os.getenv('PYDEVD_FILTERS', '').split(';')
|
||||
|
||||
@@ -248,6 +248,7 @@ class PyDB:
|
||||
self._filename_to_not_in_scope = {}
|
||||
self.first_breakpoint_reached = False
|
||||
self.is_filter_enabled = pydevd_utils.is_filter_enabled()
|
||||
self.is_filter_libraries = pydevd_utils.is_filter_libraries()
|
||||
|
||||
def get_plugin_lazy_init(self):
|
||||
if self.plugin is None and SUPPORT_PLUGINS:
|
||||
|
||||
@@ -72,6 +72,7 @@ public class PyDebugRunner extends GenericProgramRunner {
|
||||
@SuppressWarnings("SpellCheckingInspection")
|
||||
public static final String GEVENT_SUPPORT = "GEVENT_SUPPORT";
|
||||
public static final String PYDEVD_FILTERS = "PYDEVD_FILTERS";
|
||||
public static final String PYDEVD_FILTER_LIBRARIES = "PYDEVD_FILTER_LIBRARIES";
|
||||
public static boolean isModule = false;
|
||||
|
||||
@Override
|
||||
@@ -295,6 +296,9 @@ public class PyDebugRunner extends GenericProgramRunner {
|
||||
if (debuggerSettings.isSteppingFiltersEnabled()) {
|
||||
cmd.getEnvironment().put(PYDEVD_FILTERS, debuggerSettings.getSteppingFiltersForProject(project));
|
||||
}
|
||||
if (debuggerSettings.isLibrariesFilterEnabled()) {
|
||||
cmd.getEnvironment().put(PYDEVD_FILTER_LIBRARIES, "True");
|
||||
}
|
||||
|
||||
addProjectRootsToEnv(project, cmd);
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ import static java.util.Collections.singletonList;
|
||||
|
||||
|
||||
public class PyDebuggerSettings extends XDebuggerSettings<PyDebuggerSettings> implements Getter<PyDebuggerSettings> {
|
||||
private boolean myLibrariesFilterEnabled;
|
||||
private boolean mySteppingFiltersEnabled;
|
||||
private @NotNull List<PySteppingFilter> mySteppingFilters;
|
||||
public static final String FILTERS_DIVIDER = ";";
|
||||
@@ -47,6 +48,14 @@ public class PyDebuggerSettings extends XDebuggerSettings<PyDebuggerSettings> im
|
||||
return getInstance(PyDebuggerSettings.class);
|
||||
}
|
||||
|
||||
public boolean isLibrariesFilterEnabled() {
|
||||
return myLibrariesFilterEnabled;
|
||||
}
|
||||
|
||||
public void setLibrariesFilterEnabled(boolean librariesFilterEnabled) {
|
||||
myLibrariesFilterEnabled = librariesFilterEnabled;
|
||||
}
|
||||
|
||||
public boolean isSteppingFiltersEnabled() {
|
||||
return mySteppingFiltersEnabled;
|
||||
}
|
||||
|
||||
+14
-4
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.jetbrains.python.debugger.settings.PyDebuggerSteppingConfigurableUi">
|
||||
<grid id="27dc6" binding="myPanel" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<grid id="27dc6" binding="myPanel" layout-manager="GridLayoutManager" row-count="3" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="500" height="400"/>
|
||||
@@ -10,26 +10,36 @@
|
||||
<children>
|
||||
<component id="37156" class="com.intellij.ui.components.JBCheckBox" binding="myStepFilterEnabledCheckBox">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<horizontalAlignment value="2"/>
|
||||
<text value="Do not step into scripts:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<hspacer id="1eb52">
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</hspacer>
|
||||
<grid id="79cc7" binding="mySteppingPanel" custom-create="true" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="2" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
<grid row="2" column="0" row-span="1" col-span="2" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children/>
|
||||
</grid>
|
||||
<component id="5fb35" class="com.intellij.ui.components.JBCheckBox" binding="myLibrariesFilterCheckBox">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<horizontalAlignment value="2"/>
|
||||
<text value="Do not step into library scripts"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
|
||||
+6
-2
@@ -35,9 +35,10 @@ public class PyDebuggerSteppingConfigurableUi implements ConfigurableUi<PyDebugg
|
||||
private static final ColumnInfo[] COLUMNS = {
|
||||
new EnabledColumn(), new FilterColumn()
|
||||
};
|
||||
private JBCheckBox myStepFilterEnabledCheckBox;
|
||||
private JPanel myPanel;
|
||||
private JPanel mySteppingPanel;
|
||||
private JBCheckBox myLibrariesFilterCheckBox;
|
||||
private JBCheckBox myStepFilterEnabledCheckBox;
|
||||
private TableModelEditor<PySteppingFilter> myPySteppingFilterEditor;
|
||||
|
||||
public PyDebuggerSteppingConfigurableUi() {
|
||||
@@ -58,6 +59,7 @@ public class PyDebuggerSteppingConfigurableUi implements ConfigurableUi<PyDebugg
|
||||
|
||||
@Override
|
||||
public void reset(@NotNull PyDebuggerSettings settings) {
|
||||
myLibrariesFilterCheckBox.setSelected(settings.isLibrariesFilterEnabled());
|
||||
myStepFilterEnabledCheckBox.setSelected(settings.isSteppingFiltersEnabled());
|
||||
myPySteppingFilterEditor.reset(settings.getSteppingFilters());
|
||||
myPySteppingFilterEditor.enabled(myStepFilterEnabledCheckBox.isSelected());
|
||||
@@ -65,12 +67,14 @@ public class PyDebuggerSteppingConfigurableUi implements ConfigurableUi<PyDebugg
|
||||
|
||||
@Override
|
||||
public boolean isModified(@NotNull PyDebuggerSettings settings) {
|
||||
return myStepFilterEnabledCheckBox.isSelected() != settings.isSteppingFiltersEnabled()
|
||||
return myLibrariesFilterCheckBox.isSelected() != settings.isLibrariesFilterEnabled()
|
||||
|| myStepFilterEnabledCheckBox.isSelected() != settings.isSteppingFiltersEnabled()
|
||||
|| myPySteppingFilterEditor.isModified();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(@NotNull PyDebuggerSettings settings) throws ConfigurationException {
|
||||
settings.setLibrariesFilterEnabled(myLibrariesFilterCheckBox.isSelected());
|
||||
settings.setSteppingFiltersEnabled(myStepFilterEnabledCheckBox.isSelected());
|
||||
if (myPySteppingFilterEditor.isModified()) {
|
||||
settings.setSteppingFilters(myPySteppingFilterEditor.apply());
|
||||
|
||||
Reference in New Issue
Block a user