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: Make match and case be highlighted as Python keywords (Editor) #21042

Merged
merged 2 commits into from
Jun 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 5 additions & 1 deletion spyder/plugins/ipythonconsole/tests/test_ipythonconsole.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from IPython.core import release as ipy_release
from IPython.core.application import get_ipython_dir
from flaky import flaky
import numpy as np
from packaging.version import parse
import pytest
from qtpy.QtCore import Qt
Expand Down Expand Up @@ -83,14 +84,17 @@ def test_banners(ipyconsole, qtbot):
"open interval ..."]),
("vectorize",
["pyfunc", "otype", "signature"],
["Generalized function class.<br>",
["Returns an object that acts like pyfunc, but takes arrays as<br>input."
"<br>",
"Define a vectorized function which takes a nested sequence ..."]),
("absolute",
["x", "/", "out"],
["Parameters<br>", "x : array_like ..."])]
)
@pytest.mark.skipif(not os.name == 'nt',
reason="Times out on macOS and fails on Linux")
@pytest.mark.skipif(parse(np.__version__) < parse('1.25.0'),
reason="Documentation for np.vectorize is different")
def test_get_calltips(ipyconsole, qtbot, function, signature, documentation):
"""Test that calltips show the documentation."""
shell = ipyconsole.get_current_shellwidget()
Expand Down
2 changes: 1 addition & 1 deletion spyder/utils/syntaxhighlighters.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ def get_code_cell_name(text):
class PythonSH(BaseSH):
"""Python Syntax Highlighter"""
# Syntax highlighting rules:
add_kw = ['async', 'await']
add_kw = ['async', 'await', 'match', 'case']
PROG = re.compile(make_python_patterns(additional_keywords=add_kw), re.S)
IDPROG = re.compile(r"\s+(\w+)", re.S)
ASPROG = re.compile(r"\b(as)\b")
Expand Down