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:
Colin Kennedy 2023-05-06 16:00:17 -07:00 committed by Christian Clason
parent 3b0c133c31
commit 4c35c0b75d
12 changed files with 399 additions and 0 deletions

View file

@ -0,0 +1,6 @@
#usda 1.0
def "foo" (
)
{
}

21
tests/indent/usd_spec.lua Normal file
View 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)

View 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
}
}

View 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

View file

@ -0,0 +1,9 @@
#usda 1.0
(
subLayers = [
# <- keyword
@./model_sub.usda@ (offset = 1)
# <- text.uri
# ^ keyword
]
)