python: Improve handling of triple-quoted strings (#20664)

Closes #13998

/cc @notpeter would you mind giving this branch a go to see if this is
pleasant to use? This impl is not quite what VSC has, but I think it
feels okay?

In this PR, the sequence goes as follows:
1st keypress: "|"
2nd keypress: ""|
3rd keypress: """|"""

Release Notes:

- Improved handling of triple-quote strings in Python.
This commit is contained in:
Piotr Osiewicz 2024-11-14 15:12:46 +01:00 committed by GitHub
parent a650fe0d77
commit 49eb865e8a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -5,6 +5,8 @@ first_line_pattern = '^#!.*\bpython[0-9.]*\b'
line_comments = ["# "]
autoclose_before = ";:.,=}])>"
brackets = [
{ start = "\"\"\"", end = "\"\"\"", close = true, newline = false, not_in = ["string"] },
{ start = "'''", end = "'''", close = true, newline = false, not_in = ["string"] },
{ start = "{", end = "}", close = true, newline = true },
{ start = "[", end = "]", close = true, newline = true },
{ start = "(", end = ")", close = true, newline = true },