Skip to content

Commit

Permalink
Added discard, swizzling and custom colors
Browse files Browse the repository at this point in the history
  • Loading branch information
sedyh committed Sep 1, 2022
1 parent 2d93d97 commit 26b37f1
Show file tree
Hide file tree
Showing 6 changed files with 296 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Ebitengine adopts an original shading language 'Kage'. This has a compatible syn

<a href="#features"><img src="https://user-images.githubusercontent.com/19890545/150034365-6561ab71-5cb4-466f-996c-ae4204ef7c12.png" alt="back" title="back" width="16px"/></a> This plugin provides basic Kage language support for Ebitengine. It includes keywords, types, literals and snippets.

![feature-syntax](https://user-images.githubusercontent.com/19890545/177754828-9ab585c9-56be-4304-92e5-dafa0b10ba97.png)
![feature-syntax](https://user-images.githubusercontent.com/19890545/187960786-0a9292f7-3143-414e-bf5f-e44db90f458c.png)

### Quick start

Expand Down
20 changes: 16 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"publisher": "sedyh",
"displayName": "ebitengine-kage",
"description": "Language for writing shaders on Ebitengine",
"version": "0.1.2",
"version": "0.1.3",
"repository": {
"type": "git",
"url": "https://github.com/sedyh/ebitengine-kage-support.git"
Expand All @@ -19,12 +19,12 @@
"contributes": {
"languages": [{
"id": "kage",
"aliases": ["kage", "kage"],
"aliases": ["Kage"],
"extensions": [".kage",".go.kage",".kage.go"],
"configuration": "./syntaxes/language-configuration.json",
"icon": {
"light": "kage-file-light-theme.png",
"dark": "kage-file-dark-theme.png"
"dark": "kage-file-dark-theme.png",
"light": "kage-file-light-theme.png"
}
}],
"grammars": [{
Expand All @@ -37,6 +37,18 @@
"language": "kage",
"path": "./syntaxes/snippets.json"
}
],
"themes": [
{
"label": "ebitengine-kage",
"uiTheme": "vs-dark",
"path": "./themes/kage-dark.json"
},
{
"label": "ebitengine-kage",
"uiTheme": "vs",
"path": "./themes/kage-light.json"
}
]
}
}
53 changes: 53 additions & 0 deletions syntaxes/kage.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
{ "include": "#builtins" },
{ "include": "#functions" },
{ "include": "#numbers" },
{ "include": "#swizzling" },
{ "include": "#comments" }
],
"repository": {
Expand Down Expand Up @@ -54,6 +55,58 @@
}
]
},
"swizzling": {
"patterns": [
{
"name": "support.other.r.kage",
"match": "(?<=\\.)r(?=([rgba][rgba][rgba][^rgbaxyzwstpq])?)|(?<=\\.[rgba])r(?=([rgba][rgba][^rgbaxyzwstpq])?)|(?<=\\.[rgba][rgba])r(?=([rgba][^rgbaxyzwstpq])?)|(?<=\\.[rgba][rgba][rgba])r(?=([^rgbaxyzwstpq])?)"
},
{
"name": "support.other.g.kage",
"match": "(?<=\\.)g(?=([rgba][rgba][rgba][^rgbaxyzwstpq])?)|(?<=\\.[rgba])g(?=([rgba][rgba][^rgbaxyzwstpq])?)|(?<=\\.[rgba][rgba])g(?=([rgba][^rgbaxyzwstpq])?)|(?<=\\.[rgba][rgba][rgba])g(?=([^rgbaxyzwstpq])?)"
},
{
"name": "support.other.b.kage",
"match": "(?<=\\.)b(?=([rgba][rgba][rgba][^rgbaxyzwstpq])?)|(?<=\\.[rgba])b(?=([rgba][rgba][^rgbaxyzwstpq])?)|(?<=\\.[rgba][rgba])b(?=([rgba][^rgbaxyzwstpq])?)|(?<=\\.[rgba][rgba][rgba])b(?=([^rgbaxyzwstpq])?)"
},
{
"name": "support.other.a.kage",
"match": "(?<=\\.)a(?=([rgba][rgba][rgba][^rgbaxyzwstpq])?)|(?<=\\.[rgba])a(?=([rgba][rgba][^rgbaxyzwstpq])?)|(?<=\\.[rgba][rgba])a(?=([rgba][^rgbaxyzwstpq])?)|(?<=\\.[rgba][rgba][rgba])a(?=([^rgbaxyzwstpq])?)"
},
{
"name": "support.other.x.kage",
"match": "(?<=\\.)x(?=([xyzw][xyzw][xyzw][^xyzwxyzwstpq])?)|(?<=\\.[xyzw])x(?=([xyzw][xyzw][^xyzwxyzwstpq])?)|(?<=\\.[xyzw][xyzw])x(?=([xyzw][^xyzwxyzwstpq])?)|(?<=\\.[xyzw][xyzw][xyzw])x(?=([^xyzwxyzwstpq])?)"
},
{
"name": "support.other.y.kage",
"match": "(?<=\\.)y(?=([xyzw][xyzw][xyzw][^xyzwxyzwstpq])?)|(?<=\\.[xyzw])y(?=([xyzw][xyzw][^xyzwxyzwstpq])?)|(?<=\\.[xyzw][xyzw])y(?=([xyzw][^xyzwxyzwstpq])?)|(?<=\\.[xyzw][xyzw][xyzw])y(?=([^xyzwxyzwstpq])?)"
},
{
"name": "support.other.z.kage",
"match": "(?<=\\.)z(?=([xyzw][xyzw][xyzw][^xyzwxyzwstpq])?)|(?<=\\.[xyzw])z(?=([xyzw][xyzw][^xyzwxyzwstpq])?)|(?<=\\.[xyzw][xyzw])z(?=([xyzw][^xyzwxyzwstpq])?)|(?<=\\.[xyzw][xyzw][xyzw])z(?=([^xyzwxyzwstpq])?)"
},
{
"name": "support.other.w.kage",
"match": "(?<=\\.)w(?=([xyzw][xyzw][xyzw][^xyzwxyzwstpq])?)|(?<=\\.[xyzw])w(?=([xyzw][xyzw][^xyzwxyzwstpq])?)|(?<=\\.[xyzw][xyzw])w(?=([xyzw][^xyzwxyzwstpq])?)|(?<=\\.[xyzw][xyzw][xyzw])w(?=([^xyzwxyzwstpq])?)"
},
{
"name": "support.other.s.kage",
"match": "(?<=\\.)s(?=([stpq][stpq][stpq][^stpqstpqstpq])?)|(?<=\\.[stpq])s(?=([stpq][stpq][^stpqstpqstpq])?)|(?<=\\.[stpq][stpq])s(?=([stpq][^stpqstpqstpq])?)|(?<=\\.[stpq][stpq][stpq])s(?=([^stpqstpqstpq])?)"
},
{
"name": "support.other.t.kage",
"match": "(?<=\\.)t(?=([stpq][stpq][stpq][^stpqstpqstpq])?)|(?<=\\.[stpq])t(?=([stpq][stpq][^stpqstpqstpq])?)|(?<=\\.[stpq][stpq])t(?=([stpq][^stpqstpqstpq])?)|(?<=\\.[stpq][stpq][stpq])t(?=([^stpqstpqstpq])?)"
},
{
"name": "support.other.p.kage",
"match": "(?<=\\.)p(?=([stpq][stpq][stpq][^stpqstpqstpq])?)|(?<=\\.[stpq])p(?=([stpq][stpq][^stpqstpqstpq])?)|(?<=\\.[stpq][stpq])p(?=([stpq][^stpqstpqstpq])?)|(?<=\\.[stpq][stpq][stpq])p(?=([^stpqstpqstpq])?)"
},
{
"name": "support.other.q.kage",
"match": "(?<=\\.)q(?=([stpq][stpq][stpq][^stpqstpqstpq])?)|(?<=\\.[stpq])q(?=([stpq][stpq][^stpqstpqstpq])?)|(?<=\\.[stpq][stpq])q(?=([stpq][^stpqstpqstpq])?)|(?<=\\.[stpq][stpq][stpq])q(?=([^stpqstpqstpq])?)"
}
]
},
"comments": {
"patterns": [
{
Expand Down
20 changes: 20 additions & 0 deletions syntaxes/snippets.json
Original file line number Diff line number Diff line change
Expand Up @@ -223,5 +223,25 @@
"prefix": ["fwidth", "kage"],
"body": ["fwidth($0)"],
"description": "Usage fwidth(x T)\n\nT is float or vec"
},
"discard": {
"prefix": ["discard", "kage"],
"body": ["discard()$0"],
"description": "Abandons the operation on the current fragment"
},
"swizzling-rgba": {
"prefix": [".rgba", "kage"],
"body": [".rgba$0"],
"description": "Read and write multiple vec components at the same time"
},
"swizzling-xyzw": {
"prefix": [".xyzw", "kage"],
"body": [".xyzw$0"],
"description": "Read and write multiple vec components at the same time"
},
"swizzling-stpq": {
"prefix": [".stpq", "kage"],
"body": [".stpq$0"],
"description": "Read and write multiple vec components at the same time"
}
}
103 changes: 103 additions & 0 deletions themes/kage-dark.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
{
"$schema": "vscode://schemas/color-theme",
"name": "Dark (Ebitengine Kage)",
"tokenColors": [
{
"name": "kage-keywords",
"scope": [
"keyword.control.kage",
],
"settings": {
"foreground": "#C586C0"
}
},
{
"name": "kage-types",
"scope": "constant.language.kage",
"settings": {
"foreground": "#569cd6"
}
},
{
"name": "kage-builtins",
"scope": [
"entity.name.tag.kage",
],
"settings": {
"foreground": "#569cd6"
}
},
{
"name": "kage-functions",
"scope": [
"entity.name.function.kage",
"support.function.kage",
],
"settings": {
"foreground": "#DCDCAA"
}
},
{
"name": "kage-numbers",
"scope": [
"constant.numeric.kage"
],
"settings": {
"foreground": "#b5cea8"
},
},
{
"name": "kage-swizzling-rxs",
"scope": [
"support.other.r.kage",
"support.other.x.kage",
"support.other.s.kage"
],
"settings": {
"foreground": "#a87171"
},
},
{
"name": "kage-swizzling-qyt",
"scope": [
"support.other.g.kage",
"support.other.y.kage",
"support.other.t.kage"
],
"settings": {
"foreground": "#75ac8a"
},
},
{
"name": "kage-swizzling-bzp",
"scope": [
"support.other.b.kage",
"support.other.z.kage",
"support.other.p.kage"
],
"settings": {
"foreground": "#717ea3"
},
},
{
"name": "kage-swizzling-awq",
"scope": [
"support.other.a.kage",
"support.other.w.kage",
"support.other.q.kage"
],
"settings": {
"foreground": "#a19b78"
},
},
{
"name": "kage-comment",
"scope": [
"comment",
],
"settings": {
"foreground": "#6A9955"
}
},
]
}
103 changes: 103 additions & 0 deletions themes/kage-light.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
{
"$schema": "vscode://schemas/color-theme",
"name": "Light (Ebitengine Kage)",
"tokenColors": [
{
"name": "kage-keywords",
"scope": [
"keyword.control.kage",
],
"settings": {
"foreground": "#AF00DB"
}
},
{
"name": "kage-types",
"scope": "constant.language.kage",
"settings": {
"foreground": "#0000ff"
}
},
{
"name": "kage-builtins",
"scope": [
"entity.name.tag.kage",
],
"settings": {
"foreground": "#800000"
}
},
{
"name": "kage-functions",
"scope": [
"entity.name.function.kage",
"support.function.kage",
],
"settings": {
"foreground": "#795E26"
}
},
{
"name": "kage-numbers",
"scope": [
"constant.numeric.kage"
],
"settings": {
"foreground": "#098658"
},
},
{
"name": "kage-swizzling-rxs",
"scope": [
"support.other.r.kage",
"support.other.x.kage",
"support.other.s.kage"
],
"settings": {
"foreground": "#a55252"
},
},
{
"name": "kage-swizzling-qyt",
"scope": [
"support.other.g.kage",
"support.other.y.kage",
"support.other.t.kage"
],
"settings": {
"foreground": "#50aa73"
},
},
{
"name": "kage-swizzling-bzp",
"scope": [
"support.other.b.kage",
"support.other.z.kage",
"support.other.p.kage"
],
"settings": {
"foreground": "#5267a1"
},
},
{
"name": "kage-swizzling-awq",
"scope": [
"support.other.a.kage",
"support.other.w.kage",
"support.other.q.kage"
],
"settings": {
"foreground": "#a19759"
},
},
{
"name": "kage-comment",
"scope": [
"comment",
],
"settings": {
"foreground": "#6A9955"
}
},
]
}

0 comments on commit 26b37f1

Please sign in to comment.