mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
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
This commit is contained in:
parent
3b0c133c31
commit
4c35c0b75d
12 changed files with 399 additions and 0 deletions
6
tests/indent/usd/prim.usd
Normal file
6
tests/indent/usd/prim.usd
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
#usda 1.0
|
||||
|
||||
def "foo" (
|
||||
)
|
||||
{
|
||||
}
|
||||
21
tests/indent/usd_spec.lua
Normal file
21
tests/indent/usd_spec.lua
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
local Runner = require("tests.indent.common").Runner
|
||||
|
||||
local run = Runner:new(it, "tests/indent/usd", {
|
||||
tabstop = 4,
|
||||
shiftwidth = 4,
|
||||
softtabstop = 4,
|
||||
expandtab = true,
|
||||
})
|
||||
|
||||
describe("indent USD:", function()
|
||||
describe("whole file:", function()
|
||||
run:whole_file(".", {
|
||||
expected_failures = {},
|
||||
})
|
||||
end)
|
||||
|
||||
describe("new line:", function()
|
||||
run:new_line("prim.usd", { on_line = 3, text = "active = false", indent = 4 })
|
||||
run:new_line("prim.usd", { on_line = 5, text = "custom int foo = 10", indent = 4 })
|
||||
end)
|
||||
end)
|
||||
118
tests/query/highlights/usd/prims.usda
Normal file
118
tests/query/highlights/usd/prims.usda
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
def Xform "cube" (
|
||||
assetInfo = {
|
||||
# <- keyword
|
||||
asset[] payloadAssetDependencies = [@fizz.usd@, @buzz.usd@]
|
||||
# <- type
|
||||
# ^ keyword
|
||||
# ^ text.uri
|
||||
# ^ text.uri
|
||||
}
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
def "root" (
|
||||
add references = @foo.usda@</Model> (offset = 1; scale = 2.0)
|
||||
# <- text.uri
|
||||
# ^ string.special
|
||||
# ^ keyword
|
||||
# ^ number
|
||||
# ^ punctuation.delimiter
|
||||
# ^ keyword
|
||||
# ^ float
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
def "World"
|
||||
{
|
||||
over "points" (
|
||||
clips = {
|
||||
# <- keyword
|
||||
dictionary default = {
|
||||
# <- type
|
||||
# ^ variable
|
||||
double2[] times = [(101, 101), (102, 102)]
|
||||
# <- type
|
||||
# ^ keyword
|
||||
# ^ number
|
||||
}
|
||||
}
|
||||
)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
def Xform "torch_2" (
|
||||
payload = @./torch.usda@
|
||||
kind = "model"
|
||||
)
|
||||
{
|
||||
// Pre-published light list
|
||||
# <- comment
|
||||
rel lightList = [ <light> ] # inline comment
|
||||
# ^ comment
|
||||
token lightList:cacheBehavior = "consumeAndContinue"
|
||||
|
||||
double3 xformOp:translate = (1, 0, 0.5)
|
||||
uniform token[] xformOpOrder = ["xformOp:translate"]
|
||||
}
|
||||
|
||||
def "foo" (
|
||||
"some comment"
|
||||
# <- comment.documentation
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
def "foo" (
|
||||
# inline comment
|
||||
"actual in-description comment"
|
||||
# <- comment.documentation
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
def "foo" (
|
||||
add references = @foo.usda@
|
||||
# <- function.call
|
||||
append references = @foo.usda@
|
||||
# <- function.call
|
||||
delete references = @foo.usda@
|
||||
# <- function.call
|
||||
reorder references = [@foo.usda@]
|
||||
# <- function.call
|
||||
|
||||
references = [@foo.usda@] # explicit
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
over "Parent" (
|
||||
prepend references = [</InternalRef>, @./ref.usda@</RefParent>]
|
||||
# <- function.call
|
||||
# ^ keyword
|
||||
# ^ string.special
|
||||
# ^ text.uri
|
||||
# ^ string.special
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
def "foo"
|
||||
{
|
||||
float value.timeSamples = {
|
||||
# <- type
|
||||
# ^ variable
|
||||
# ^ property
|
||||
-414: 14.4
|
||||
# <- number
|
||||
# ^ float
|
||||
10: 201.0,
|
||||
# <- number
|
||||
# ^ float
|
||||
10.123: 201.0123,
|
||||
# <- float
|
||||
# ^ float
|
||||
}
|
||||
}
|
||||
21
tests/query/highlights/usd/properties.usda
Normal file
21
tests/query/highlights/usd/properties.usda
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
dictionary foo = {}
|
||||
# <- type
|
||||
half[] foo = [2, 1, 2]
|
||||
# <- type
|
||||
string foo = "something"
|
||||
# <- type
|
||||
timecode time = 1.0
|
||||
# <- type
|
||||
token[] purpose = ["default", "render"]
|
||||
# <- type
|
||||
|
||||
rel material:binding:collection:Erasers = None
|
||||
# <- type
|
||||
# ^ namespace
|
||||
# ^ punctuation.delimiter
|
||||
# ^ namespace
|
||||
# ^ punctuation.delimiter
|
||||
# ^ namespace
|
||||
# ^ punctuation.delimiter
|
||||
# ^ variable
|
||||
# ^ constant.builtin
|
||||
9
tests/query/highlights/usd/subLayers.usda
Normal file
9
tests/query/highlights/usd/subLayers.usda
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#usda 1.0
|
||||
(
|
||||
subLayers = [
|
||||
# <- keyword
|
||||
@./model_sub.usda@ (offset = 1)
|
||||
# <- text.uri
|
||||
# ^ keyword
|
||||
]
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue