Merge branch 'ColinKennedy-add_usd_support'

This commit is contained in:
Steven Arcangeli 2023-05-17 01:02:10 -07:00
commit b07a0ea183
5 changed files with 158 additions and 0 deletions

View file

@ -163,6 +163,7 @@ In addition, you will need to have either Treesitter or a working LSP client. Yo
- teal
- tsx
- typescript
- usd
- vim
- vimdoc
- yaml

37
queries/usd/aerial.scm Normal file
View file

@ -0,0 +1,37 @@
(prim_definition
(string) @name
(#offset! @name 0 1 0 -1)
(#set! "kind" "Class")
) @type
(attribute_assignment
[(identifier) (qualified_identifier)] @name
(#set! "kind" "Property")
) @type
(attribute_declaration
[(identifier) (qualified_identifier)] @name
(#set! "kind" "Property")
) @type
(relationship_assignment
[(identifier) (qualified_identifier)] @name
(#set! "kind" "Property")
) @type
(relationship_declaration
[(identifier) (qualified_identifier)] @name
(#set! "kind" "Property")
) @type
(variant_set_definition
(string) @name
(#offset! @name 0 1 0 -1)
(#set! "kind" "Enum")
) @type
(variant
(string) @name
(#offset! @name 0 1 0 -1)
(#set! "kind" "EnumMember")
) @type

View file

@ -7,6 +7,8 @@ vim.bo.swapfile = false
vim.filetype.add({
extension = {
norg = "norg", -- Neovim doesn't have built-in norg filetype detection
usd = "usd", -- Neovim doesn't have built-in USD filetype detection
usda = "usd", -- Neovim doesn't have built-in USD filetype detection
},
})

View file

@ -0,0 +1,97 @@
local util = require("tests.test_util")
describe("treesitter USD", function()
it("parses all symbols correctly", function()
util.test_file_symbols("treesitter", "./tests/treesitter/usd_test.usd", {
{
kind = "Class",
name = "something",
level = 0,
lnum = 3,
col = 0,
end_lnum = 21,
end_col = 1,
children = {
{
kind = "Class",
name = "child",
level = 1,
lnum = 7,
col = 4,
end_lnum = 20,
end_col = 5,
children = {
{
kind = "Property",
name = "foo:xformOp:rotateXYZ",
level = 2,
lnum = 9,
col = 8,
end_lnum = 9,
end_col = 58,
},
{
kind = "Property",
name = "translate",
level = 2,
lnum = 10,
col = 8,
end_lnum = 10,
end_col = 48,
},
{
kind = "Property",
name = "thing",
level = 2,
lnum = 11,
col = 8,
end_lnum = 11,
end_col = 32,
},
{
kind = "Enum",
name = "variants",
level = 2,
lnum = 13,
col = 8,
end_lnum = 19,
end_col = 9,
children = {
{
kind = "EnumMember",
name = "default",
level = 3,
lnum = 14,
col = 12,
end_lnum = 15,
end_col = 13,
},
{
kind = "EnumMember",
name = "one",
level = 3,
lnum = 16,
col = 12,
end_lnum = 18,
end_col = 13,
children = {
{
kind = "Property",
name = "xformOp:translate",
level = 4,
lnum = 17,
col = 16,
end_lnum = 17,
end_col = 56,
},
},
},
},
},
},
},
},
},
})
end)
end)

View file

@ -0,0 +1,21 @@
#usda 1.0
def Xform "something" (
kind = "component"
)
{
def Xform "child"
{
float3 foo:xformOp:rotateXYZ = (-15.7, -55.8, 0.3)
double3 translate = (153.2, 119.3, 24.7)
rel thing = </something>
variantSet "variants" = {
"default" {
}
"one" {
double3 xformOp:translate = (10, 10, 10)
}
}
}
}