From c79cf153f9a018bd626bf7b53a11b24b35c80e21 Mon Sep 17 00:00:00 2001 From: Nick Drabsch Date: Fri, 13 Jan 2023 13:26:52 +1030 Subject: [PATCH 1/3] Make json file format consistent --- .editorconfig | 9 ++ .vscode/launch.json | 2 +- language-configuration.json | 2 +- package.json | 2 +- syntaxes/fastbuild.tmLanguage.json | 144 ++++++++++++++--------------- 5 files changed, 84 insertions(+), 75 deletions(-) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..3de85d3 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +insert_final_newline = true + +[*.json] +charset = utf-8 +indent_style = space +indent_size = 4 diff --git a/.vscode/launch.json b/.vscode/launch.json index 8384213..5901239 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -10,4 +10,4 @@ "args": ["--extensionDevelopmentPath=${workspaceRoot}" ] } ] -} \ No newline at end of file +} diff --git a/language-configuration.json b/language-configuration.json index aa25710..d796ba8 100644 --- a/language-configuration.json +++ b/language-configuration.json @@ -27,4 +27,4 @@ ["\"", "\""], ["'", "'"] ] -} \ No newline at end of file +} diff --git a/package.json b/package.json index e25704d..66720a5 100644 --- a/package.json +++ b/package.json @@ -28,4 +28,4 @@ "path": "./syntaxes/fastbuild.tmLanguage.json" }] } -} \ No newline at end of file +} diff --git a/syntaxes/fastbuild.tmLanguage.json b/syntaxes/fastbuild.tmLanguage.json index 35f9d7a..14fa93a 100644 --- a/syntaxes/fastbuild.tmLanguage.json +++ b/syntaxes/fastbuild.tmLanguage.json @@ -1,38 +1,38 @@ { - "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", + "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", "name": "FASTBuild", "foldingStartMarker": "/\\*\\*(?!\\*)|^(?![^{]*?//|[^{]*?/\\*(?!.*?\\*/.*?\\{)).*?\\{\\s*($|//|/\\*(?!.*?\\*/.*\\S))", "foldingStopMarker": "(? Date: Fri, 13 Jan 2023 13:27:19 +1030 Subject: [PATCH 2/3] Change category to 'Programming Languages' as suggested by vscode --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 66720a5..6d2ed4e 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "vscode": "^1.14.0" }, "categories": [ - "Languages" + "Programming Languages" ], "icon": "media/icon.png", "repository": { From 13655839775435ce2e33affacce9ac6fe68b7fa5 Mon Sep 17 00:00:00 2001 From: Nick Drabsch Date: Fri, 13 Jan 2023 14:52:46 +1030 Subject: [PATCH 3/3] Improve FASTBuild syntax matching --- syntaxes/fastbuild.tmLanguage.json | 88 +++++++++++++++++++++--------- 1 file changed, 62 insertions(+), 26 deletions(-) diff --git a/syntaxes/fastbuild.tmLanguage.json b/syntaxes/fastbuild.tmLanguage.json index 14fa93a..9030271 100644 --- a/syntaxes/fastbuild.tmLanguage.json +++ b/syntaxes/fastbuild.tmLanguage.json @@ -10,6 +10,9 @@ { "include": "#functions" }, + { + "include": "#constants" + }, { "include": "#strings_single" }, @@ -22,6 +25,12 @@ { "include": "#directives" }, + { + "include": "#directive_functions" + }, + { + "include": "#import_env_variable" + }, { "include": "#defined_variables" }, @@ -42,47 +51,69 @@ "keywords": { "patterns": [{ "name": "keyword.operator.fastbuild", - "match": "\\b(\\+\\-/\\*=)\\b" + "match": "[\\+\\-=]" }] }, "functions": { "patterns": [{ "name": "support.function.fastbuild", - "match": "\\b(Alias|Compiler|Copy|CopyDir|CSAssembly|DLL|Exec|Executable|ForEach|Library|ObjectList|Print|RemoveDir|Settings|Test|Unity|Using|VCXProject|VSSolution|XCodeProject)\\b" + "match": "\\b(Alias|Compiler|Copy|CopyDir|CSAssembly|DLL|Exec|Executable|ForEach|If|Library|ListDependencies|ObjectList|Print|RemoveDir|Settings|Test|TextFile|Unity|Using|VCXProject|VSProjectExternal|VSSolution|XCodeProject)\\b" + }] + }, + "constants": { + "patterns": [{ + "name": "constant.language.fastbuild", + "match": "\\b(true|false)\\b" }] }, "strings_single": { "name": "string.quoted.single.fastbuild", "begin": "'", "end": "'", - "patterns": [ - { - "include": "#string_highlight" - } - ] + "patterns": [{ + "include": "#string_highlight" + }] }, "strings_double": { "name": "string.quoted.double.fastbuild", "begin": "\"", "end": "\"", - "patterns": [ - { - "include": "#string_highlight" - } - ] + "patterns": [{ + "include": "#string_highlight" + }] }, "fastbuild_defines": { - "patterns": [ - { - "name": "variable.language.fastbuild", - "match": "__WINDOWS__|__OSX__|__LINUX__" - } - ] + "patterns": [{ + "name": "variable.language.fastbuild", + "match": "__WINDOWS__|__OSX__|__LINUX__|_CURRENT_BFF_DIR_|_FASTBUILD_VERSION_STRING_|_FASTBUILD_VERSION_|_WORKING_DIR_" + }] }, "directives": { "patterns": [{ "name": "keyword.other.fastbuild", - "match": "#(undef|if|else|endif|exists|import|include|once)" + "match": "(#)(undef|if|else|endif|include|once)", + "captures": { + "0": { + "name": "meta.preprocessor.fastbuild" + } + } + }] + }, + "directive_functions": { + "patterns": [{ + "name": "keyword.function.fastbuild", + "match": "\\b(exists|file_exists|in)\\b" + }] + }, + "import_env_variable": { + "patterns": [{ + "name": "keyword.other.fastbuild", + "match": "#import\\s+([\\w\\d]+)", + "captures": { + "1": { + "name": "meta.parameter.type.variable.fastbuild" + } + } }] }, "defined_variables": { @@ -98,7 +129,14 @@ }, "local_variables": { "patterns": [{ - "match": "[\\s^]\\.(['\"]?)([\\w\\d\\$]+)\\1?", + "match": "(\\b)?[\\.^]([\\w\\d\\$]+)\\b", + "captures": { + "2": { + "name": "variable.other.fastbuild" + } + } + }, { + "match": "(\\b)?[\\.^]['\"](.+)['\"]\\b", "captures": { "2": { "name": "variable.other.fastbuild" @@ -107,12 +145,10 @@ }] }, "comment": { - "patterns": [ - { - "name": "comment.line.double-slash.fastbuild", - "match": "(//|;).*" - } - ] + "patterns": [{ + "name": "comment.line.double-slash.fastbuild", + "match": "(//|;).*" + }] } }, "scopeName": "source.fastbuild"