diff options
| author | Colin Kennedy <colinvfx@gmail.com> | 2023-05-06 16:00:17 -0700 |
|---|---|---|
| committer | Christian Clason <c.clason@uni-graz.at> | 2023-05-15 09:28:11 +0200 |
| commit | 4c35c0b75d678d3f901d8dd37428ae834c4bd689 (patch) | |
| tree | 2234ece53a504cb4026252e59077f1e93c16a695 /queries/usd | |
| parent | Update parsers: dart, query (diff) | |
| download | nvim-treesitter-4c35c0b75d678d3f901d8dd37428ae834c4bd689.tar nvim-treesitter-4c35c0b75d678d3f901d8dd37428ae834c4bd689.tar.gz nvim-treesitter-4c35c0b75d678d3f901d8dd37428ae834c4bd689.tar.bz2 nvim-treesitter-4c35c0b75d678d3f901d8dd37428ae834c4bd689.tar.lz nvim-treesitter-4c35c0b75d678d3f901d8dd37428ae834c4bd689.tar.xz nvim-treesitter-4c35c0b75d678d3f901d8dd37428ae834c4bd689.tar.zst nvim-treesitter-4c35c0b75d678d3f901d8dd37428ae834c4bd689.zip | |
Added USD as a language + some queries
Added USD highlight unittests
Added USD indentation
Added USD indents.scm file
Added USD indent rules
Simplified USD highlight groups
Added explicit highlight groups
Added newline
Removed after/ftdetect/usda.lua
usd/indents.scm - Added inline comments explaining the nodes
Fixed USD highlight group unittests
Added indentation unittests
Simplified USD `@identifier` highlighting
Added USD documentation highlight group tests
Simplified USD highlight groups
Moved USD `@identifier` and `@namespace` highlights into one place
Removed and simplified tests/query/highlights/usd
Simplified tests/query/highlights/usd more
Removed trailing newline
Combined USD test files
Added `set filetype=usd` to minimal_init.lua
Diffstat (limited to 'queries/usd')
| -rw-r--r-- | queries/usd/folds.scm | 3 | ||||
| -rw-r--r-- | queries/usd/highlights.scm | 181 | ||||
| -rw-r--r-- | queries/usd/indents.scm | 26 | ||||
| -rw-r--r-- | queries/usd/locals.scm | 4 |
4 files changed, 214 insertions, 0 deletions
diff --git a/queries/usd/folds.scm b/queries/usd/folds.scm new file mode 100644 index 000000000..c4815bd07 --- /dev/null +++ b/queries/usd/folds.scm @@ -0,0 +1,3 @@ +[ + (block) +] @fold diff --git a/queries/usd/highlights.scm b/queries/usd/highlights.scm new file mode 100644 index 000000000..73968a647 --- /dev/null +++ b/queries/usd/highlights.scm @@ -0,0 +1,181 @@ +(None) @constant.builtin +(asset_path) @text.uri +(attribute_property) @property +(bool) @boolean +(comment) @comment @spell +(custom) @function.builtin +(float) @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 `@namespace` and `fizz` uses `@identifier` +;; +(identifier) @variable +(namespace_identifier) @namespace +(namespace_identifier + (identifier) @namespace +) + +[ + "class" + "def" + "over" +] @keyword.function + +["(" ")" "[" "]" "{" "}"] @punctuation.bracket +[":" ";" "."] @punctuation.delimiter + +[ + "=" +] @operator + +(attribute_type) @type +( + ;; Reference: https://openusd.org/release/api/sdf_page_front.html + (attribute_type) @type.builtin + (#any-of? @type.builtin + ;; 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/queries/usd/indents.scm b/queries/usd/indents.scm new file mode 100644 index 000000000..4af153034 --- /dev/null +++ b/queries/usd/indents.scm @@ -0,0 +1,26 @@ +[ + (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/queries/usd/locals.scm b/queries/usd/locals.scm new file mode 100644 index 000000000..4e7e97b5f --- /dev/null +++ b/queries/usd/locals.scm @@ -0,0 +1,4 @@ +[ + (block) + (metadata) +] @scope |
