From 4b36557a597ac25733babaf50bad0361ec2a060f Mon Sep 17 00:00:00 2001 From: deathaxe Date: Wed, 13 Dec 2023 18:58:36 +0100 Subject: [PATCH] [Python] Fix double quoted u-string scope --- Python/Python.sublime-syntax | 2 +- Python/tests/syntax_test_python_strings.py | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Python/Python.sublime-syntax b/Python/Python.sublime-syntax index d05c8f5901..c9131fad00 100644 --- a/Python/Python.sublime-syntax +++ b/Python/Python.sublime-syntax @@ -3188,7 +3188,7 @@ contexts: double-quoted-u-string-body: - meta_include_prototype: false - - meta_content_scope: meta.string.python string.quoted.double.block.python + - meta_content_scope: meta.string.python string.quoted.double.python - include: double-quoted-string-end - include: double-quoted-u-string-syntax diff --git a/Python/tests/syntax_test_python_strings.py b/Python/tests/syntax_test_python_strings.py index a07d2f2fc6..2fbffdcbe7 100644 --- a/Python/tests/syntax_test_python_strings.py +++ b/Python/tests/syntax_test_python_strings.py @@ -36,17 +36,30 @@ # ^ keyword.other.DML.sql conn.execute(U"SELECT * FROM foobar") +# ^ meta.string.python string.quoted.double.python punctuation.definition.string.begin.python +# ^^^^^^^^^^^^^^^^^^^^ meta.string.python source.sql +# ^ meta.string.python string.quoted.double.python punctuation.definition.string.end.python # ^ keyword.other.DML.sql conn.execute(U'SELECT * FROM foobar') +# ^ meta.string.python string.quoted.single.python punctuation.definition.string.begin.python +# ^^^^^^^^^^^^^^^^^^^^ meta.string.python source.sql +# ^ meta.string.python string.quoted.single.python punctuation.definition.string.end.python # ^ keyword.other.DML.sql # In this example, the Python string is not raw, so \t is a python escape conn.execute(u"SELECT * FROM foobar WHERE foo = '\t'") +# ^ storage.type.string.python +# ^ meta.string.python string.quoted.double.python punctuation.definition.string.begin.python +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.python source.sql # ^ keyword.other.DML.sql # ^ constant.character.escape.python +# ^ meta.string.python string.quoted.double.python punctuation.definition.string.end.python conn.execute(u'SELECT * FROM foobar') +# ^ meta.string.python string.quoted.single.python punctuation.definition.string.begin.python +# ^^^^^^^^^^^^^^^^^^^^ meta.string.python source.sql +# ^ meta.string.python string.quoted.single.python punctuation.definition.string.end.python # ^ keyword.other.DML.sql # In this example, the Python string is raw, so the \b should be a SQL escape