From a8b8124c44ff8ec0821b79ab9247308daab381a4 Mon Sep 17 00:00:00 2001 From: Jen-Chieh Shen <jcs090218@gmail.com> Date: Tue, 10 Oct 2023 11:22:15 -0700 Subject: [PATCH] feat: Add HLSL support (#219) --- .gitmodules | 6 ++++++ CHANGELOG.md | 1 + queries/hlsl/highlights.scm | 35 +++++++++++++++++++++++++++++++++++ repos/hlsl | 1 + tree-sitter-langs-build.el | 1 + tree-sitter-langs.el | 1 + 6 files changed, 45 insertions(+) create mode 100644 queries/hlsl/highlights.scm create mode 160000 repos/hlsl diff --git a/.gitmodules b/.gitmodules index d02ed76b..2a57864a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -454,3 +454,9 @@ branch = master update = none ignore = dirty +[submodule "repos/hlsl"] + path = repos/hlsl + url = https://github.com/theHamsta/tree-sitter-hlsl + branch = master + update = none + ignore = dirty diff --git a/CHANGELOG.md b/CHANGELOG.md index 39935bf4..4bfda2a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog ## Unreleased +- Add `HLSL` support ## 0.12.62 - 2023-10-10 - Add `GLSL` support diff --git a/queries/hlsl/highlights.scm b/queries/hlsl/highlights.scm new file mode 100644 index 00000000..68e9e44b --- /dev/null +++ b/queries/hlsl/highlights.scm @@ -0,0 +1,35 @@ +; inherits: cpp + +[ + "in" + "out" + "inout" + "uniform" + "shared" + "groupshared" + "discard" + "cbuffer" + "row_major" + "column_major" + "globallycoherent" + "centroid" + "noperspective" + "nointerpolation" + "sample" + "linear" + "snorm" + "unorm" + "point" + "line" + "triangleadj" + "lineadj" + "triangle" +] @type.qualifier + +( + (identifier) @variable.builtin + (#lua-match? @variable.builtin "^SV_") +) + +(hlsl_attribute) @attribute +(hlsl_attribute ["[" "]"] @attribute) diff --git a/repos/hlsl b/repos/hlsl new file mode 160000 index 00000000..45e60a69 --- /dev/null +++ b/repos/hlsl @@ -0,0 +1 @@ +Subproject commit 45e60a69b4dac922d81474b5d6fa88b4e5387b21 diff --git a/tree-sitter-langs-build.el b/tree-sitter-langs-build.el index 0b847cea..dc5a2080 100644 --- a/tree-sitter-langs-build.el +++ b/tree-sitter-langs-build.el @@ -248,6 +248,7 @@ infrequent (grammar-only changes). It is different from the version of (defconst tree-sitter-langs--langs-with-deps '( cpp + hlsl glsl typescript toml) diff --git a/tree-sitter-langs.el b/tree-sitter-langs.el index 111522ed..d6f1d3e0 100644 --- a/tree-sitter-langs.el +++ b/tree-sitter-langs.el @@ -135,6 +135,7 @@ See `tree-sitter-langs-repos'." (haskell-mode . haskell) (hcl-mode . hcl) (terraform-mode . hcl) + (hlsl-mode . hlsl) (html-mode . html) (markdown-mode . markdown) (mhtml-mode . html)