Unnamed repository; edit this file 'description' to name the repository.
feat(languages): specialize toml file-type for git-cliff config file (#14301)
| -rw-r--r-- | book/src/generated/lang-support.md | 1 | ||||
| -rw-r--r-- | languages.toml | 11 | ||||
| -rw-r--r-- | runtime/queries/git-cliff-config/highlights.scm | 1 | ||||
| -rw-r--r-- | runtime/queries/git-cliff-config/injections.scm | 53 | ||||
| -rw-r--r-- | runtime/queries/git-cliff-config/rainbows.scm | 1 | ||||
| -rw-r--r-- | runtime/queries/git-cliff-config/textobjects.scm | 1 |
6 files changed, 68 insertions, 0 deletions
diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index 7b3a56d8..f2e2fdb8 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -78,6 +78,7 @@ | gherkin | ✓ | | | | | | | ghostty | ✓ | | | | | | | git-attributes | ✓ | | | | | | +| git-cliff-config | ✓ | ✓ | | | ✓ | `taplo`, `tombi` | | git-commit | ✓ | ✓ | | | | | | git-config | ✓ | ✓ | | | | | | git-ignore | ✓ | | | | | | diff --git a/languages.toml b/languages.toml index 3b02dbd5..0646ed84 100644 --- a/languages.toml +++ b/languages.toml @@ -4696,3 +4696,14 @@ comment-token = "#" file-types = [{glob = "Cross.toml"}] language-servers = [ "taplo", "tombi" ] indent = { tab-width = 2, unit = " " } + +# https://git-cliff.org/docs/configuration/ +[[language]] +name = "git-cliff-config" +scope = "source.git-cliff-config" +injection-regex = "git-cliff(-config)" +grammar = "toml" +comment-token = "#" +file-types = [{ glob = "cliff.toml" }] +language-servers = ["taplo", "tombi"] +indent = { tab-width = 2, unit = " " } diff --git a/runtime/queries/git-cliff-config/highlights.scm b/runtime/queries/git-cliff-config/highlights.scm new file mode 100644 index 00000000..b55e36da --- /dev/null +++ b/runtime/queries/git-cliff-config/highlights.scm @@ -0,0 +1 @@ +; inherits: toml diff --git a/runtime/queries/git-cliff-config/injections.scm b/runtime/queries/git-cliff-config/injections.scm new file mode 100644 index 00000000..c0c38c4b --- /dev/null +++ b/runtime/queries/git-cliff-config/injections.scm @@ -0,0 +1,53 @@ +((comment) @injection.content + (#set! injection.language "comment")) + +; https://git-cliff.org/docs/configuration/changelog +(table + (bare_key) @_table (#eq? @_table "changelog") + (pair + (bare_key) @_key (#any-of? @_key "header" "body" "footer") + (string) @injection.content + (#set! injection.language "tera"))) + +; https://git-cliff.org/docs/configuration/git#commit_preprocessors +; https://git-cliff.org/docs/configuration/git/#link_parsers +; https://git-cliff.org/docs/configuration/changelog#postprocessors +; https://git-cliff.org/docs/configuration/git/#tag_pattern +; https://git-cliff.org/docs/configuration/git/#skip_tags +; https://git-cliff.org/docs/configuration/git/#ignore_tags +; https://git-cliff.org/docs/configuration/git/#count_tags +; https://git-cliff.org/docs/configuration/bump/#custom_major_increment_regex--custom_minor_increment_regex +(pair + (bare_key) @_key (#any-of? @_key + "pattern" + "tag_pattern" + "skip_tags" + "ignore_tags" + "count_tags" + "custom_major_increment_regex" + "custom_minor_increment_regex" + ) + (string) @injection.content + (#set! injection.language "regex")) + +; https://git-cliff.org/docs/configuration/git/#commit_preprocessors +; [[git.commit_preprocessors]] +; replace_command = "" +(pair + (bare_key) @_key (#eq? @_key "replace_command") + (string) @injection.content + (#set! injection.language "bash")) + +; https://git-cliff.org/docs/configuration/git/#commit_parsers +; [[git.commit_parsers]] +; message = "..." +(table + (bare_key) @_table (#eq? @_table "git") + (pair + (bare_key) @_key (#eq? @_key "commit_parsers") + (array + (inline_table + (pair + (bare_key) @_message (#any-of? @_message "message" "body") + (string) @injection.content)))) + (#set! injection.language "regex")) diff --git a/runtime/queries/git-cliff-config/rainbows.scm b/runtime/queries/git-cliff-config/rainbows.scm new file mode 100644 index 00000000..b55e36da --- /dev/null +++ b/runtime/queries/git-cliff-config/rainbows.scm @@ -0,0 +1 @@ +; inherits: toml diff --git a/runtime/queries/git-cliff-config/textobjects.scm b/runtime/queries/git-cliff-config/textobjects.scm new file mode 100644 index 00000000..b55e36da --- /dev/null +++ b/runtime/queries/git-cliff-config/textobjects.scm @@ -0,0 +1 @@ +; inherits: toml |