From 64cf4c859b67c98042e2d66f26be0ce4a7afc6e0 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Mon, 27 Jun 2022 22:18:38 -0500 Subject: [PATCH] support Bazel languages (#2903) --- book/src/generated/lang-support.md | 1 + languages.toml | 12 +++++++++++- runtime/queries/starlark/highlights.scm | 1 + runtime/queries/starlark/injections.scm | 2 ++ runtime/queries/starlark/textobjects.scm | 1 + 5 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 runtime/queries/starlark/highlights.scm create mode 100644 runtime/queries/starlark/injections.scm create mode 100644 runtime/queries/starlark/textobjects.scm diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index 7d0ac2020..5ea18ae84 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -85,6 +85,7 @@ | solidity | ✓ | | | `solc` | | sql | ✓ | | | | | sshclientconfig | ✓ | | | | +| starlark | ✓ | ✓ | | | | svelte | ✓ | | ✓ | `svelteserver` | | swift | ✓ | | | `sourcekit-lsp` | | tablegen | ✓ | ✓ | ✓ | | diff --git a/languages.toml b/languages.toml index aba5fd44c..0e6cbb9cb 100644 --- a/languages.toml +++ b/languages.toml @@ -461,7 +461,7 @@ source = { git = "https://github.com/tree-sitter/tree-sitter-ruby", rev = "dfff6 name = "bash" scope = "source.bash" injection-regex = "bash" -file-types = ["sh", "bash", "zsh", ".bash_login", ".bash_logout", ".bash_profile", ".bashrc", ".profile", ".zshenv", ".zlogin", ".zlogout", ".zprofile", ".zshrc", "APKBUILD", "PKGBUILD", "eclass", "ebuild"] +file-types = ["sh", "bash", "zsh", ".bash_login", ".bash_logout", ".bash_profile", ".bashrc", ".profile", ".zshenv", ".zlogin", ".zlogout", ".zprofile", ".zshrc", "APKBUILD", "PKGBUILD", "eclass", "ebuild", "bazelrc"] shebangs = ["sh", "bash", "dash"] roots = [] comment-token = "#" @@ -1478,3 +1478,13 @@ indent = { tab-width = 2, unit = " " } [[grammar]] name = "clojure" source = { git = "https://github.com/sogaiu/tree-sitter-clojure", rev = "e57c569ae332ca365da623712ae1f50f84daeae2" } + +[[language]] +name = "starlark" +scope = "source.starlark" +injection-regex = "(starlark|bzl|bazel)" +file-types = ["bzl", "bazel", "BUILD"] +roots = [] +comment-token = "#" +indent = { tab-width = 4, unit = " " } +grammar = "python" diff --git a/runtime/queries/starlark/highlights.scm b/runtime/queries/starlark/highlights.scm new file mode 100644 index 000000000..0b920cbf9 --- /dev/null +++ b/runtime/queries/starlark/highlights.scm @@ -0,0 +1 @@ +; inherits: python diff --git a/runtime/queries/starlark/injections.scm b/runtime/queries/starlark/injections.scm new file mode 100644 index 000000000..321c90add --- /dev/null +++ b/runtime/queries/starlark/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/runtime/queries/starlark/textobjects.scm b/runtime/queries/starlark/textobjects.scm new file mode 100644 index 000000000..0b920cbf9 --- /dev/null +++ b/runtime/queries/starlark/textobjects.scm @@ -0,0 +1 @@ +; inherits: python