소스 검색

Change `$` node path shorthand regex to match only valid paths (#276)

Co-authored-by: Hugo Locurcio <[email protected]>
Vlad-Zumer 4 년 전
부모
커밋
29f1bc0ceb
2개의 변경된 파일12개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      syntaxes/GDScript.tmLanguage.json
  2. 11 0
      syntaxes/README.md

+ 1 - 1
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": {

+ 11 - 0
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.