From 29f1bc0ceb49e2a50f039a1eed80a3cb386ec676 Mon Sep 17 00:00:00 2001 From: Vlad-Zumer <21068598+Vlad-Zumer@users.noreply.github.com> Date: Tue, 15 Jun 2021 17:39:29 +0100 Subject: [PATCH] Change `$` node path shorthand regex to match only valid paths (#276) Co-authored-by: Hugo Locurcio --- syntaxes/GDScript.tmLanguage.json | 2 +- syntaxes/README.md | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 syntaxes/README.md diff --git a/syntaxes/GDScript.tmLanguage.json b/syntaxes/GDScript.tmLanguage.json index 1ccc66a..c0468c1 100644 --- a/syntaxes/GDScript.tmLanguage.json +++ b/syntaxes/GDScript.tmLanguage.json @@ -204,7 +204,7 @@ "name": "support.function.builtin.gdscript" }, "builtin_get_node_shorthand": { - "match": "\\$[A-Za-z0-9\\_\\/]+", + "match": "\\$((\\\"(\\.\\.\\/)+|\\\"\\/|\\\"[0-9]+|\\\")([0-9A-Za-z\\_]+\\/)*[A-Za-z0-9\\_]+\\\"|[A-Za-z\\_]+(\\/[A-Za-z\\_]+)*)", "name": "support.function.builtin.shorthand.gdscript" }, "builtin_classes": { diff --git a/syntaxes/README.md b/syntaxes/README.md new file mode 100644 index 0000000..25e145d --- /dev/null +++ b/syntaxes/README.md @@ -0,0 +1,11 @@ +# Helpful resources + +You can find the regex syntax that VSCode uses [here](https://macromates.com/manual/en/regular_expressions). + +## Creating and debugging regex + +When creating regexes it is sometimes useful to test against a data set. + +[Regex101](https://regex101.com/) allows for pretty good match testing. Unfortunately, it does not support the regex (Ruby) version that TextMate uses. + +[ExtendsClass's](https://extendsclass.com/regex-tester.html#ruby) regex engine does support the Ruby variant, but the match testing experience is not as good. However, it automatically generates an FSM for your regex, which is very useful when debugging.