From 7b004a4824030e08ffd9d561c192fbe888a55ba6 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Wed, 25 May 2022 15:05:42 -0500 Subject: [PATCH] support Bazel languages --- languages.toml | 12 +++++++++++- runtime/queries/starlark/highlights.scm | 1 + runtime/queries/starlark/injections.scm | 2 ++ runtime/queries/starlark/textobjects.scm | 1 + 4 files changed, 15 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/languages.toml b/languages.toml index aba5fd44c29b9..0e6cbb9cbe31a 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 0000000000000..0b920cbf91caa --- /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 0000000000000..321c90add3710 --- /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 0000000000000..0b920cbf91caa --- /dev/null +++ b/runtime/queries/starlark/textobjects.scm @@ -0,0 +1 @@ +; inherits: python