diff --git a/README.md b/README.md index 10514ef..255dd93 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ Ebitengine adopts an original shading language 'Kage'. This has a compatible syn back 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 diff --git a/package.json b/package.json index 2365d37..a4248fd 100644 --- a/package.json +++ b/package.json @@ -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" @@ -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": [{ @@ -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" + } ] } } diff --git a/syntaxes/kage.tmLanguage.json b/syntaxes/kage.tmLanguage.json index 60b3309..845917d 100644 --- a/syntaxes/kage.tmLanguage.json +++ b/syntaxes/kage.tmLanguage.json @@ -7,6 +7,7 @@ { "include": "#builtins" }, { "include": "#functions" }, { "include": "#numbers" }, + { "include": "#swizzling" }, { "include": "#comments" } ], "repository": { @@ -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": [ { diff --git a/syntaxes/snippets.json b/syntaxes/snippets.json index 0544413..f5beafb 100644 --- a/syntaxes/snippets.json +++ b/syntaxes/snippets.json @@ -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" } } diff --git a/themes/kage-dark.json b/themes/kage-dark.json new file mode 100644 index 0000000..2864551 --- /dev/null +++ b/themes/kage-dark.json @@ -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" + } + }, + ] +} diff --git a/themes/kage-light.json b/themes/kage-light.json new file mode 100644 index 0000000..0e4682e --- /dev/null +++ b/themes/kage-light.json @@ -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" + } + }, + ] +}