aboutsummaryrefslogtreecommitdiffstats
path: root/runtime/queries/usd
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2023-06-12 09:54:30 -0600
committerChristian Clason <c.clason@uni-graz.at>2025-05-12 18:43:40 +0200
commit692b051b09935653befdb8f7ba8afdb640adf17b (patch)
tree167162b6b129ae04f68c5735078521a72917c742 /runtime/queries/usd
parentfeat(c-family): inherit injections (diff)
downloadnvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.gz
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.bz2
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.lz
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.xz
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.zst
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.zip
feat!: drop modules, general refactor and cleanup
Diffstat (limited to 'runtime/queries/usd')
-rw-r--r--runtime/queries/usd/folds.scm1
-rw-r--r--runtime/queries/usd/highlights.scm154
-rw-r--r--runtime/queries/usd/indents.scm42
-rw-r--r--runtime/queries/usd/injections.scm2
-rw-r--r--runtime/queries/usd/locals.scm4
5 files changed, 203 insertions, 0 deletions
diff --git a/runtime/queries/usd/folds.scm b/runtime/queries/usd/folds.scm
new file mode 100644
index 000000000..fd7d23999
--- /dev/null
+++ b/runtime/queries/usd/folds.scm
@@ -0,0 +1 @@
+(block) @fold
diff --git a/runtime/queries/usd/highlights.scm b/runtime/queries/usd/highlights.scm
new file mode 100644
index 000000000..d6c2a3668
--- /dev/null
+++ b/runtime/queries/usd/highlights.scm
@@ -0,0 +1,154 @@
+(None) @constant.builtin
+
+(asset_path) @string.special.url
+
+(attribute_property) @property
+
+(bool) @boolean
+
+(comment) @comment @spell
+
+(custom) @function.builtin
+
+(float) @number.float
+
+(integer) @number
+
+(orderer) @function.call
+
+(prim_path) @string.special
+
+(relationship_type) @type
+
+(string) @string
+
+(uniform) @function.builtin
+
+(variant_set_definition) @keyword
+
+; Prefer namespace highlighting, if any.
+;
+; e.g. `rel fizz` - `fizz` uses `@identifier`
+; e.g. `rel foo:bar:fizz` - `foo` and `bar` use `@module` and `fizz` uses `@identifier`
+;
+(identifier) @variable
+
+(namespace_identifier) @module
+
+(namespace_identifier
+ (identifier) @module)
+
+[
+ "def"
+ "over"
+] @keyword.function
+
+"class" @keyword.type
+
+[
+ "("
+ ")"
+ "["
+ "]"
+ "{"
+ "}"
+] @punctuation.bracket
+
+[
+ ":"
+ ";"
+ "."
+] @punctuation.delimiter
+
+"=" @operator
+
+(attribute_type) @type
+
+((attribute_type) @type.builtin
+ ;format-ignore
+ (#any-of? @type.builtin
+ ;; Reference: https://openusd.org/release/api/sdf_page_front.html
+ ;; Scalar types
+ "asset" "asset[]"
+ "bool" "bool[]"
+ "double" "double[]"
+ "float" "float[]"
+ "half" "half[]"
+ "int" "int[]"
+ "int64" "int64[]"
+ "string" "string[]"
+ "timecode" "timecode[]"
+ "token" "token[]"
+ "uchar" "uchar[]"
+ "uint" "uint[]"
+ "uint64" "uint64[]"
+
+ ;; Dimensioned Types
+ "double2" "double2[]"
+ "double3" "double3[]"
+ "double4" "double4[]"
+ "float2" "float2[]"
+ "float3" "float3[]"
+ "float4" "float4[]"
+ "half2" "half2[]"
+ "half3" "half3[]"
+ "half4" "half4[]"
+ "int2" "int2[]"
+ "int3" "int3[]"
+ "int4" "int4[]"
+ "matrix2d" "matrix2d[]"
+ "matrix3d" "matrix3d[]"
+ "matrix4d" "matrix4d[]"
+ "quatd" "quatd[]"
+ "quatf" "quatf[]"
+ "quath" "quath[]"
+
+ ;; Extra Types
+ "color3f" "color3f[]"
+ "normal3f" "normal3f[]"
+ "point3f" "point3f[]"
+ "texCoord2f" "texCoord2f[]"
+ "vector3d" "vector3d[]"
+ "vector3f" "vector3f[]"
+ "vector3h" "vector3h[]"
+
+ "dictionary"
+
+ ;; Deprecated Types
+ "EdgeIndex" "EdgeIndex[]"
+ "FaceIndex" "FaceIndex[]"
+ "Matrix4d" "Matrix4d[]"
+ "PointIndex" "PointIndex[]"
+ "PointFloat" "PointFloat[]"
+ "Transform" "Transform[]"
+ "Vec3f" "Vec3f[]"))
+
+((identifier) @keyword
+ (#any-of? @keyword
+ ; Reference: https://openusd.org/release/api/sdf_page_front.html
+ ; LIVRPS names
+ "inherits" "payload" "references" "specializes" "variantSets" "variants"
+ ; assetInfo names
+ "assetInfo" "identifier" "name" "payloadAssetDependencies" "version"
+ ; clips names
+ "clips" "active" "assetPaths" "manifestAssetPath" "primPath" "templateAssetPath"
+ "templateEndTime" "templateStartTime" "templateStride" "times"
+ ; customData names
+ "customData" "apiSchemaAutoApplyTo" "apiSchemaOverridePropertyNames" "className" "extraPlugInfo"
+ "isUsdShadeContainer" "libraryName" "providesUsdShadeConnectableAPIBehavior"
+ "requiresUsdShadeEncapsulation" "skipCodeGeneration"
+ ; Layer metadata names
+ "colorConfiguration" "colorManagementSystem" "customLayerData" "defaultPrim" "doc" "endTimeCode"
+ "framesPerSecond" "owner" "startTimeCode" "subLayers"
+ ; Prim metadata
+ "instanceable"))
+
+; Common attribute metadata
+(layer_offset
+ (identifier) @keyword
+ (#any-of? @keyword "offset" "scale"))
+
+; Docstrings in USD
+(metadata
+ (comment)*
+ (string) @comment.documentation)
diff --git a/runtime/queries/usd/indents.scm b/runtime/queries/usd/indents.scm
new file mode 100644
index 000000000..217d12d3f
--- /dev/null
+++ b/runtime/queries/usd/indents.scm
@@ -0,0 +1,42 @@
+; format-ignore
+[
+ (block) ; The {}s in `def "foo" { ... Attributes / Prims here ... }`
+ (dictionary) ; The {}s in `dictionary foo = { string "foo" = "bar" }`
+ (list)
+ (list_proxy) ; [@foo.usda@, @bar.usda@]
+ (metadata) ; ( anything = "goes-here" )
+ (prim_paths) ; [</foo>, <../bar>]
+ (timeSamples) ; The {}s in `int value.timeSamples = { 0: 1, -10: 10, ... }`
+ (tuple)
+ (variant_set_definition) ; The {}s in `variantSet "foo" = { "vr1" { ... } "vr2" { ... } }`
+] @indent.begin
+
+(block
+ "}" @indent.end)
+
+(dictionary
+ "}" @indent.end)
+
+(list
+ "]" @indent.end)
+
+(list_proxy
+ "]" @indent.end)
+
+(metadata
+ ")" @indent.end)
+
+(timeSamples
+ "}" @indent.end)
+
+(tuple
+ ")" @indent.end)
+
+(variant_set_definition
+ "}" @indent.end)
+
+[
+ ")"
+ "]"
+ "}"
+] @indent.branch
diff --git a/runtime/queries/usd/injections.scm b/runtime/queries/usd/injections.scm
new file mode 100644
index 000000000..2f0e58eb6
--- /dev/null
+++ b/runtime/queries/usd/injections.scm
@@ -0,0 +1,2 @@
+((comment) @injection.content
+ (#set! injection.language "comment"))
diff --git a/runtime/queries/usd/locals.scm b/runtime/queries/usd/locals.scm
new file mode 100644
index 000000000..89eb171d1
--- /dev/null
+++ b/runtime/queries/usd/locals.scm
@@ -0,0 +1,4 @@
+[
+ (block)
+ (metadata)
+] @local.scope