From 49eb865e8aaac79f0c33b8b028bf5d47bf733e05 Mon Sep 17 00:00:00 2001 From: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Date: Thu, 14 Nov 2024 15:12:46 +0100 Subject: [PATCH] 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. --- crates/languages/src/python/config.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/languages/src/python/config.toml b/crates/languages/src/python/config.toml index a51a186007..0b12f4b5f0 100644 --- a/crates/languages/src/python/config.toml +++ b/crates/languages/src/python/config.toml @@ -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 },