mirror of
https://github.com/tiennm99/serena.git
synced 2026-10-13 22:16:23 +00:00
Add CUE language support via cue lsp (#1474)
This commit is contained in:
1 parent
cbfe68a4cd
commit
ffd5dfd3e7
14 files changed
+483
-1
No files matched your search
@@ -0,0 +1,2 @@
|
||||
cue.mod/gen/
|
||||
cue.mod/pkg/
|
||||
@@ -0,0 +1,4 @@
|
||||
module: "example.com/testrepo"
|
||||
language: {
|
||||
version: "v0.16.0"
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package testrepo
|
||||
|
||||
// #BuildGreeting is a template/closure: given a #Person under `for_`, it produces a #Greeting
|
||||
// under `result`. Used by main.cue to build the canonical greeting.
|
||||
#BuildGreeting: {
|
||||
for_: #Person
|
||||
result: #Greeting & {
|
||||
recipient: for_
|
||||
message: "Hello, \(for_.name)!"
|
||||
}
|
||||
}
|
||||
|
||||
// locales enumerates the locales the greeter supports; defaultLocale (schema.cue) must be one of them.
|
||||
locales: [...string] & [
|
||||
"en-US",
|
||||
"en-GB",
|
||||
"de-DE",
|
||||
]
|
||||
@@ -0,0 +1,14 @@
|
||||
package testrepo
|
||||
|
||||
// alice is a concrete #Person value; used to build the canonical greeting below.
|
||||
alice: #Person & {
|
||||
name: "Alice"
|
||||
age: 30
|
||||
email: "alice@example.com"
|
||||
}
|
||||
|
||||
// greetingForAlice references both #Greeting (from schema.cue) and #BuildGreeting (from lib.cue).
|
||||
greetingForAlice: (#BuildGreeting & {for_: alice}).result
|
||||
|
||||
// locale pins the output locale; validated against locales defined in lib.cue.
|
||||
locale: defaultLocale
|
||||
@@ -0,0 +1,17 @@
|
||||
package testrepo
|
||||
|
||||
// #Person is the schema for a person record used by main.cue and lib.cue.
|
||||
#Person: {
|
||||
name!: string
|
||||
age?: int & >=0
|
||||
email: string
|
||||
}
|
||||
|
||||
// #Greeting describes a greeting message addressed to a #Person.
|
||||
#Greeting: {
|
||||
recipient: #Person
|
||||
message: string
|
||||
}
|
||||
|
||||
// defaultLocale is the fallback locale used when no locale is set on a greeting.
|
||||
defaultLocale: "en-US"
|
||||
Reference in new issue
Block a user