Unnamed repository; edit this file 'description' to name the repository.
feat: add `shellcheckrc` language (#14202)
| -rw-r--r-- | book/src/generated/lang-support.md | 1 | ||||
| -rw-r--r-- | languages.toml | 11 | ||||
| -rw-r--r-- | runtime/queries/shellcheckrc/highlights.scm | 55 | ||||
| -rw-r--r-- | runtime/queries/shellcheckrc/injections.scm | 2 | ||||
| -rw-r--r-- | runtime/queries/shellcheckrc/textobjects.scm | 13 |
5 files changed, 82 insertions, 0 deletions
diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index f6b58c8e..50169cd4 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -227,6 +227,7 @@ | scala | ✓ | ✓ | ✓ | | | `metals` | | scheme | ✓ | | ✓ | | ✓ | | | scss | ✓ | | | | ✓ | `vscode-css-language-server` | +| shellcheckrc | ✓ | ✓ | | | | | | slang | ✓ | ✓ | ✓ | | | `slangd` | | slint | ✓ | ✓ | ✓ | | | `slint-lsp` | | smali | ✓ | | ✓ | | | | diff --git a/languages.toml b/languages.toml index 6cf2799a..a786ac9f 100644 --- a/languages.toml +++ b/languages.toml @@ -4722,3 +4722,14 @@ indent = { tab-width = 4, unit = " " } [[grammar]] name = "cython" source = { git = "https://github.com/b0o/tree-sitter-cython", rev = "62f44f5e7e41dde03c5f0a05f035e293bcf2bcf8" } + +[[language]] +name = "shellcheckrc" +scope = "source.shellcheckrc" +injection-regex = "shellcheck(rc)?" +file-types = [{glob = "shellcheckrc"}, {glob = ".shellcheckrc"}] +comment-token = "#" + +[[grammar]] +name = "shellcheckrc" +source = {git = "https://codeberg.org/kpbaks/tree-sitter-shellcheckrc", rev = "ad3da4e8f7fd72dcc5e93a6b89822c59a7cd10ff"} diff --git a/runtime/queries/shellcheckrc/highlights.scm b/runtime/queries/shellcheckrc/highlights.scm new file mode 100644 index 00000000..b7b0a748 --- /dev/null +++ b/runtime/queries/shellcheckrc/highlights.scm @@ -0,0 +1,55 @@ +(comment) @comment +(string) @string +(boolean) @constant.builtin.boolean +(integer) @constant.numeric.integer + +[ + "disable" + "enable" + "extended-analysis" + "external-sources" + "source" + "source-path" + "shell" +] @keyword + +"=" @operator + +[ + "," + "-" +] @punctuation.delimiter + +"SC" @special + +(shell) @type.enum.variant + +(all) @variable.builtin + +(identifier) @label + +(source_directive + (identifier) @string.special.path) + +(source_path_directive + (identifier) @string.special.path) + +(source_directive + (identifier) @variable.builtin (#eq? @variable.builtin "SCRIPTDIR")) + +(source_path_directive + (identifier) @variable.builtin (#eq? @variable.builtin "SCRIPTDIR")) + +(enable_directive + (identifier) @diagnostic.error + (#not-any-of? @diagnostic.error + "add-default-case" + "avoid-nullary-conditions" + "check-extra-masked-returns" + "check-set-e-suppressed" + "check-unassigned-uppercase" + "deprecate-which" + "quote-safe-variables" + "require-double-brackets" + "require-variable-braces" + )) diff --git a/runtime/queries/shellcheckrc/injections.scm b/runtime/queries/shellcheckrc/injections.scm new file mode 100644 index 00000000..2f0e58eb --- /dev/null +++ b/runtime/queries/shellcheckrc/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/runtime/queries/shellcheckrc/textobjects.scm b/runtime/queries/shellcheckrc/textobjects.scm new file mode 100644 index 00000000..8e61bc85 --- /dev/null +++ b/runtime/queries/shellcheckrc/textobjects.scm @@ -0,0 +1,13 @@ +(comment) @comment.inside +(comment)+ @comment.around + + +[ + (disable_directive) + (enable_directive) + (extended_analysis_directive) + (external_sources_directive) + (source_directive) + (source_path_directive) + (shell_directive) +] @entry.around |