Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR: Initial traceback setup to use selected syntax style (IPython Console) #22965

Merged
merged 22 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
0efc145
IPython Console: Initial traceback setup to use selected syntax style
dalthviz Nov 12, 2024
44a08d3
IPython Console: Enable going to file from xmode plain and context fo…
dalthviz Nov 15, 2024
79dcad4
IPython Console: Use kernel configuration handler for traceback highl…
dalthviz Nov 16, 2024
1c0bec4
git subrepo pull --remote=https://github.com/dalthviz/spyder-kernels.…
dalthviz Nov 16, 2024
0927a4b
IPython Console: Prevent premature call to config traceback highlight…
dalthviz Nov 16, 2024
84b92b8
git subrepo pull --remote=https://github.com/dalthviz/spyder-kernels.…
dalthviz Nov 16, 2024
6c12cb1
IPython Console: Enable traceback config from Spyder call to '_syntax…
dalthviz Nov 16, 2024
06fc003
Merge branch 'master' into fixes_issue_22412
dalthviz Nov 18, 2024
ef967a4
git subrepo pull --remote=https://github.com/dalthviz/spyder-kernels.…
dalthviz Nov 19, 2024
23928f7
IPython Console: Pass syntax style dict to kernel config call
dalthviz Nov 19, 2024
929b27e
git subrepo pull --remote=https://github.com/dalthviz/spyder-kernels.…
dalthviz Nov 19, 2024
5baef98
Testing
dalthviz Nov 19, 2024
0c5e18f
git subrepo pull --remote=https://github.com/dalthviz/spyder-kernels.…
dalthviz Nov 19, 2024
d0be460
git subrepo pull --remote=https://github.com/dalthviz/spyder-kernels.…
dalthviz Nov 19, 2024
8e0d158
git subrepo pull --remote=https://github.com/dalthviz/spyder-kernels.…
dalthviz Nov 19, 2024
a6cb0c2
Merge branch 'master' into fixes_issue_22412
dalthviz Nov 20, 2024
a067c56
git subrepo pull --remote=https://github.com/dalthviz/spyder-kernels.…
dalthviz Nov 20, 2024
55d747c
Code style
dalthviz Nov 20, 2024
09750ea
git subrepo pull --remote=https://github.com/dalthviz/spyder-kernels.…
dalthviz Nov 21, 2024
41c288a
Apply suggestions from code review
dalthviz Nov 26, 2024
5dd2016
git subrepo pull (merge) --remote=https://github.com/spyder-ide/spyde…
dalthviz Nov 26, 2024
6378f5c
Merge branch 'master' into fixes_issue_22412
dalthviz Nov 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions external-deps/spyder-kernels/.gitrepo

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 28 additions & 7 deletions external-deps/spyder-kernels/spyder_kernels/console/kernel.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions external-deps/spyder-kernels/spyder_kernels/console/shell.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions external-deps/spyder-kernels/spyder_kernels/console/start.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions external-deps/spyder-kernels/spyder_kernels/customize/umr.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

138 changes: 138 additions & 0 deletions external-deps/spyder-kernels/spyder_kernels/utils/style.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion spyder/app/tests/test_mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -6502,7 +6502,7 @@ def test_clickable_ipython_tracebacks(main_window, qtbot, tmp_path):
control.setFocus()
find_widget = main_window.ipyconsole.get_widget().find_widget
find_widget.show()
find_widget.search_text.lineEdit().setText(' File')
find_widget.search_text.lineEdit().setText('File')
find_widget.find_previous()

# Position mouse on top of that line
Expand Down
12 changes: 11 additions & 1 deletion spyder/plugins/ipythonconsole/widgets/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ def __init__(
self._init_kernel_setup = False
self._is_banner_shown = False

# Set bright colors instead of bold formatting for better traceback
# readability.
self._ansi_processor.bold_text_enabled = False

if handlers is None:
handlers = {}
else:
Expand Down Expand Up @@ -697,7 +701,7 @@ def set_color_scheme(self, color_scheme, reset=True):
self.style_sheet, dark_color = create_qss_style(color_scheme)
self.syntax_style = color_scheme
self._style_sheet_changed()
self._syntax_style_changed()
self._syntax_style_changed(changed={})
if reset:
self.reset(clear=True)
if not self.spyder_kernel_ready:
Expand Down Expand Up @@ -1438,6 +1442,12 @@ def _syntax_style_changed(self, changed=None):
if self.syntax_style:
self._highlighter._style = create_style_class(self.syntax_style)
self._highlighter._clear_caches()
if changed is None:
return
self.set_kernel_configuration(
"traceback_highlight_style",
get_color_scheme(self.syntax_style),
)
else:
self._highlighter.set_style_sheet(self.style_sheet)

Expand Down
15 changes: 10 additions & 5 deletions spyder/utils/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,21 @@ def remove_backslashes(path):

def get_error_match(text):
"""Check if text contains a Python error."""
# For regular Python tracebacks and IPython 7 or less.
# For regular Python tracebacks and IPython 7 or less (xmode plain).
match_python = re.match(r' File "(.*)", line (\d*)', text)
if match_python is not None:
return match_python

# For IPython 8+ tracebacks.
# For IPython 8+ tracebacks (xmode plain).
# Fixes spyder-ide/spyder#20407
ipython8_match = re.match(r' File (.*):(\d*)', text)
if ipython8_match is not None:
return ipython8_match
ipython8_plain_match = re.match(r' File (.*):(\d*)', text)
if ipython8_plain_match is not None:
return ipython8_plain_match

# For IPython 8+ tracebacks (xmode context).
ipython8_context_match = re.match(r'File (.*):(\d*)', text)
if ipython8_context_match is not None:
return ipython8_context_match

return False

Expand Down
Loading