From 72509c562525774967c6fa90c234acfd0335b01a Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Wed, 15 Aug 2018 18:20:04 +0200 Subject: [PATCH] VSCode hangs when opening python file. Fixes #56377 --- .../syntaxes/MagicPython.tmLanguage.json | 54 +++++++++---------- 1 file changed, 24 insertions(+), 30 deletions(-) diff --git a/extensions/python/syntaxes/MagicPython.tmLanguage.json b/extensions/python/syntaxes/MagicPython.tmLanguage.json index fc32d74cec5..44a995bc046 100644 --- a/extensions/python/syntaxes/MagicPython.tmLanguage.json +++ b/extensions/python/syntaxes/MagicPython.tmLanguage.json @@ -4,7 +4,7 @@ "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], - "version": "https://github.com/MagicStack/MagicPython/commit/fb56c6a98d684e30bed1b0f9647e85741a48f914", + "version": "https://github.com/MagicStack/MagicPython/commit/b453f26ed856c9b16a053517c41207e3a72cc7d5", "name": "MagicPython", "scopeName": "source.python", "patterns": [ @@ -97,8 +97,7 @@ }, "docstring-statement": { "begin": "^(?=\\s*[rR]?(\\'\\'\\'|\\\"\\\"\\\"|\\'|\\\"))", - "comment": "the string either terminates correctly or by the beginning of a new line (this is for single line docstrings that aren't terminated) AND it's not followed by another docstring", - "end": "((?<=\\1)|^)(?!\\s*[rR]?(\\'\\'\\'|\\\"\\\"\\\"|\\'|\\\"))", + "end": "(?<=\\'\\'\\'|\\\"\\\"\\\"|\\'|\\\")", "patterns": [ { "include": "#docstring" @@ -165,7 +164,7 @@ { "name": "string.quoted.docstring.single.python", "begin": "(\\'|\\\")", - "end": "(\\1)|(\\n)", + "end": "(\\1)|((?=^]? [-+ ]? \\#?\n \\d* ,? (\\.\\d+)? [bcdeEfFgGnosxX%]? )?\n })\n )\n", + "name": "constant.character.format.placeholder.other.python", + "match": "(?x)\n (?:\n {{ | }}\n | (?:\n {\n \\w*? (\\.[[:alpha:]_]\\w*? | \\[[^\\]'\"]+\\])*?\n (![rsa])?\n ( : \\w? [<>=^]? [-+ ]? \\#?\n \\d* ,? (\\.\\d+)? [bcdeEfFgGnosxX%]? )?\n })\n )\n", "captures": { - "1": { - "name": "constant.character.format.placeholder.other.python" - }, - "3": { + "2": { "name": "storage.type.format.python" }, - "4": { + "3": { "name": "storage.type.format.python" } } }, { - "name": "meta.format.brace.python", - "match": "(?x)\n (\n {\n \\w*? (\\.[[:alpha:]_]\\w*? | \\[[^\\]'\"]+\\])*?\n (![rsa])?\n (:)\n (\n [^'\"{}\\n]+?\n |\n \\{ [^'\"}\\n]*? \\}\n )*\n }\n )\n", - "captures": { - "1": { - "name": "constant.character.format.placeholder.other.python" + "name": "constant.character.format.placeholder.other.python", + "begin": "(?x)\n \\{\n \\w*? (\\.[[:alpha:]_]\\w*? | \\[[^\\]'\"]+\\])*?\n (![rsa])?\n (:)\n (?=[^'\"}\\n]*\\})\n", + "end": "\\}", + "beginCaptures": { + "2": { + "name": "storage.type.format.python" }, "3": { "name": "storage.type.format.python" - }, - "4": { - "name": "storage.type.format.python" } - } + }, + "patterns": [ + { + "match": "(?x) \\{ [^'\"}\\n]*? \\} (?=.*?\\})\n" + } + ] } ] }, @@ -4543,7 +4537,7 @@ }, "string-quoted-single-line": { "name": "string.quoted.single.python", - "begin": "(?:\\b([rR])(?=[uU]))?([uU])?((['\"]))", + "begin": "(\\b[rR](?=[uU]))?([uU])?((['\"]))", "end": "(\\3)|((?