diff --git a/.github/workflows/markdownlint.yml b/.github/workflows/markdownlint.yml new file mode 100644 index 00000000..9450021a --- /dev/null +++ b/.github/workflows/markdownlint.yml @@ -0,0 +1,35 @@ +name: markdownlint + +on: + pull_request: + types: [opened, synchronize, reopened] + paths: + - "**.md" + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref }} + cancel-in-progress: true + +jobs: + markdownlint: + runs-on: ubuntu-latest + + steps: + - name: Setup node + uses: actions/setup-node@v3 + with: + node-version: latest + + - name: Checkout + uses: actions/checkout@v4 + + - name: Install dependencies + run: | + yarn install --immutable --immutable-cache --check-cache + + - name: Check + run: | + yarn run markdownlint:check diff --git a/.github/workflows/prettier.yml b/.github/workflows/prettier.yml index 7c75a247..92cc5479 100644 --- a/.github/workflows/prettier.yml +++ b/.github/workflows/prettier.yml @@ -3,6 +3,11 @@ name: Prettier on: pull_request: types: [opened, synchronize, reopened] + paths: + - "**.md" + - "**.ts" + - "**.yml" + - "**.json" permissions: contents: read diff --git a/CHANGELOG.md b/CHANGELOG.md index 3759c4bd..c3ebcdde 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## next +- Update TextMate grammar + ## 1.15.0 - Allow using Swift-MesonLSP on Apple Silicon @@ -67,7 +69,7 @@ - Generate `/meson-vscode.env` to be used in `launch.json`'s `envFile` to run programs using Meson's developper environment. See - https://mesonbuild.com/Commands.html#devenv + [meson devenv](https://mesonbuild.com/Commands.html#devenv). ## 1.7.1 diff --git a/LICENSE.md b/LICENSE similarity index 100% rename from LICENSE.md rename to LICENSE diff --git a/README.md b/README.md index 50ea8950..a2a8a338 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,15 @@ -# Meson for VisualStudio Code +# Meson for Visual Studio Code This extension provides support for [Meson](http://mesonbuild.com/) in -[Visual Studio Code](https://code.visualstudio.com/). This is entirely based on -the grammar found in the +[Visual Studio Code](https://code.visualstudio.com/). This language grammar was +based on the grammar found in the [atom extension](https://github.com/TingPing/language-meson) from -[Patrick Griffis](https://github.com/TingPing). +[Patrick Griffis](https://github.com/TingPing), but has since been added onto to +support more features, including code from the VSCode +[grammar](https://github.com/microsoft/vscode/blob/main/extensions/python/syntaxes/MagicPython.tmLanguage.json) +for Python. -Meson logo by @jpakkane, +Meson logo by [Jussi Pakkanen](https://github.com/jpakkane), [licensed for use by this project](http://mesonbuild.com/legal.html). Icons from the [Material Design Icons](https://materialdesignicons.com/) project. @@ -15,17 +18,24 @@ the [Material Design Icons](https://materialdesignicons.com/) project. - Syntax Highlighting - Automatic Task Provider - Code Snippets -- Linting\* -- Formatting\* +- Linting[^0] +- Formatting[^1] - Generate environment file to be used in launch.json: `"envFile": "${workspaceFolder}/${config:mesonbuild.buildFolder}/meson-vscode.env"` See [Meson devenv](https://mesonbuild.com/Commands.html#devenv) -- Configure Intellisense to use `compile_commands.json` generated by Meson +- Configure Intellisense to use the `compile_commands.json` generated by Meson \* - requires an installation of [muon](https://muon.build). -# New extension ID +## New Extension ID If you come from a previous installation, please make sure you are on the **mesonbuild.mesonbuild** extension. There are 3 variants/versions of this extension on the store, and only that one is released from this repository. + +[^0]: + Requires an installation of + [Swift-MesonLSP](https://github.com/JCWasmx86/Swift-MesonLSP) or + [muon](https://muon.build). + +[^1]: Requires an installation of muon. diff --git a/package.json b/package.json index 2ef99537..e039b0b6 100644 --- a/package.json +++ b/package.json @@ -416,6 +416,7 @@ }, "scripts": { "compile": "tsc -p ./", + "markdownlint:check": "markdownlint-cli2 **.md", "postinstall": "husky install", "prettier:check": "prettier --check **.md **.ts **.yml **.json", "vscode:prepublish": "npm run compile", @@ -428,8 +429,10 @@ "@types/which": "^3.0.0", "husky": "^8.0.3", "lint-staged": "^14.0.1", + "markdownlint-cli2": "^0.10.0", "prettier": "^3.0.3", - "typescript": "^5.2.2" + "typescript": "^5.2.2", + "vscode-textmate": "^9.0.0" }, "dependencies": { "adm-zip": "^0.5.10", diff --git a/syntaxes/meson.tmLanguage.json b/syntaxes/meson.tmLanguage.json index 8427369f..29caa808 100644 --- a/syntaxes/meson.tmLanguage.json +++ b/syntaxes/meson.tmLanguage.json @@ -1,49 +1,30 @@ { "name": "Meson", "scopeName": "source.meson", - "author": "Patrick Griffis", "fileTypes": ["meson.build", "meson_options.txt", "meson.options"], - "uuid": "b3713e1e-4289-4e0c-88af-79e8876e5adb", "patterns": [ { - "match": "\\#.*$", - "name": "comment.line.meson" + "begin": "(\\#)", + "beginCaptures": { + "1": { + "name": "punctuation.definition.comment.meson" + } + }, + "end": "$", + "name": "comment.line.number-sign.meson" }, { - "include": "#string_quoted_single" + "match": "\\\\$", + "name": "punctuation.separator.continuation.line.meson" }, { - "match": "\\b(if|else|elif|endif|foreach|endforeach|break|continue)\\b", + "match": "\\b(if|else|elif|endif|foreach|endforeach|break|continue|testcase|endtestcase)\\b", "name": "keyword.control.flow.meson" }, { "match": "\\b(and|not|or|in)\\b", "name": "keyword.operator.logical.meson" }, - { - "match": "\\b(true|false)\\b", - "name": "constant.language.meson" - }, - { - "match": "\\b([1-9]+[0-9]*\\.[0-9]*)", - "name": "constant.numeric.float.meson" - }, - { - "match": "\\b(?i:(0x[0-9a-f]+))", - "name": "constant.numeric.integer.hexadecimal.meson" - }, - { - "match": "\\b([1-9]+[0-9]*|0)", - "name": "constant.numeric.integer.decimal.meson" - }, - { - "match": "\\b(build_machine|host_machine|meson|target_machine)\\b", - "name": "support.constant.meson variable.language.meson" - }, - { - "match": "\\b([\\w_]+)\\s*(?=:)", - "name": "variable.parameter.function.keyword.meson" - }, { "match": "<\\=|>\\=|\\=\\=|<|>|\\!\\=", "name": "keyword.operator.comparison.meson" @@ -61,16 +42,96 @@ "name": "keyword.operator.arithmetic.meson" }, { - "match": "(?x)\\b(add_global_arguments|add_global_link_arguments|add_languages|add_project_arguments|add_project_dependencies|add_project_link_arguments|add_test_setup|alias_target|assert|benchmark|both_libraries|build_target|configuration_data|configure_file|custom_target|debug|declare_dependency|dependency|disabler|environment|error|executable|files|find_program|generator|get_option|get_variable|import|include_directories|install_data|install_emptydir|install_headers|install_man|install_subdir|install_symlink|is_disabler|is_variable|jar|join_paths|library|message|project|range|run_command|run_target|set_variable|shared_library|shared_module|static_library|structured_sources|subdir|subdir_done|subproject|summary|test|unset_variable|vcs_tag|warning\n)\\b\\s*(?=\\()", - "name": "support.function.builtin.meson" + "include": "#expression" } ], "repository": { - "constant_placeholder": { - "match": "(?i:(%(\\([a-z_]+\\))?#?0?\\-?[ ]?\\+?([0-9]*|\\*)(\\.([0-9]*|\\*))?([hL][a-z]|[a-z%]))|(\\{([!\\[\\].:\\w ]+)?\\}))", - "name": "constant.other.placeholder.meson" + "array_literal": { + "begin": "(\\[)", + "beginCaptures": { + "1": { + "name": "punctuation.definition.array.begin.meson" + } + }, + "end": "(\\])", + "endCaptures": { + "1": { + "name": "punctuation.definition.array.end.meson" + } + }, + "patterns": [ + { + "include": "#expression" + } + ], + "name": "meta.array.meson" }, - "escaped_character": { + "binary_literal": { + "match": "\\b(0b)[01]+", + "captures": { + "1": { + "name": "storage.type.number.meson" + } + }, + "name": "constant.numeric.integer.binary.meson" + }, + "boolean_literal": { + "match": "\\b(true|false)\\b", + "name": "constant.language.meson" + }, + "builtin_literal": { + "match": "\\b(build_machine|host_machine|meson|target_machine)\\b", + "name": "support.constant.meson variable.language.meson" + }, + "conditional_expression": { + "begin": "(\\?)", + "beginCaptures": { + "1": { + "name": "keyword.operator.ternary.meson" + } + }, + "end": "(:)", + "endCaptures": { + "1": { + "name": "keyword.operator.ternary.meson" + } + }, + "patterns": [ + { + "include": "#expression" + } + ] + }, + "decimal_literal": { + "match": "\\b([1-9][0-9]*|0)", + "name": "constant.numeric.integer.decimal.meson" + }, + "dictionary_literal": { + "begin": "\\{", + "beginCaptures": { + "0": { + "name": "punctuation.definition.dictionary.begin.meson" + } + }, + "end": "\\}", + "endCaptures": { + "0": { + "name": "punctuation.definition.dictionary.end.meson" + } + }, + "patterns": [ + { + "name": "punctuation.separator.dictionary.meson", + "match": ":" + }, + { + "include": "#expression" + } + ], + "name": "meta.dictionary.meson" + }, + "escaped-character": { + "match": "((\\\\\\n)|(\\\\\\\\)|(\\\\')|(\\\\n)|(\\\\r)|(\\\\t))", "captures": { "1": { "name": "constant.character.escape.newline.meson" @@ -90,79 +151,329 @@ "6": { "name": "constant.character.escape.tab.meson" } + } + }, + "expression": { + "patterns": [ + { + "include": "#subscript" + }, + { + "include": "#dictionary_literal" + }, + { + "include": "#array_literal" + }, + { + "include": "#literal" + }, + { + "include": "#conditional_expression" + }, + { + "include": "#odd_function_expression" + }, + { + "include": "#function_expression" + }, + { + "include": "#punctuation" + } + ] + }, + "float_literal": { + "match": "\\b[1-9][0-9]*|0\\.[0-9]+", + "name": "constant.numeric.float.meson" + }, + "format-placeholder": { + "begin": "(@)", + "beginCaptures": { + "1": { + "name": "constant.character.format.placeholder.begin.meson punctuation.definition.placeholder.begin.meson" + } }, - "match": "((\\\\\\n)|(\\\\\\\\)|(\\\\')|(\\\\n)|(\\\\r)|(\\\\t))" + "end": "(@)", + "endCaptures": { + "1": { + "name": "constant.character.format.placeholder.end.meson punctuation.definition.placeholder.begin.meson" + } + }, + "patterns": [ + { + "include": "#decimal_literal" + }, + { + "match": "[[:alpha:]_]+", + "name": "variable.parameter.interpolated.meson" + } + ] + }, + "function_expression": { + "name": "meta.function-call.meson", + "comment": "Regular function call of the type \"name(args)\"", + "begin": "(?x)\n \\b(?=\n ([[:alpha:]_]\\w*) \\s* (\\()\n )\n", + "end": "(\\))", + "endCaptures": { + "1": { + "name": "punctuation.definition.arguments.end.meson" + } + }, + "patterns": [ + { + "include": "#function_name" + }, + { + "include": "#function_arguments" + } + ] }, - "string_quoted_single": { + "function_name": { + "comment": "Some color schemas support meta.function-call.generic scope", + "name": "meta.function-call.generic.meson entity.name.function.meson", + "match": "(?x)\n \\b ([[:alpha:]_]\\w*) \\b\n" + }, + "function_arguments": { + "begin": "(\\()", + "end": "(?=\\))(?!\\)\\s*\\()", + "beginCaptures": { + "1": { + "name": "punctuation.definition.arguments.begin.meson" + } + }, + "contentName": "meta.function-call.arguments.meson", "patterns": [ { + "name": "punctuation.separator.arguments.meson", + "match": "(,)" + }, + { + "match": "\\b([[:alpha:]_]\\w*)\\s*(:)(?!:)", "captures": { "1": { - "name": "punctuation.definition.string.begin.meson" + "name": "variable.parameter.function-call.meson" }, "2": { - "name": "punctuation.definition.string.end.meson" - }, - "3": { - "name": "meta.empty-string.single.meson" + "name": "keyword.operator.assignment.meson" } - }, - "match": "(?