From def036c80bf8667bb7f993f881bfefad76008760 Mon Sep 17 00:00:00 2001 From: Tamnac <49466795+Tamnac@users.noreply.github.com> Date: Sat, 7 Sep 2024 14:03:04 +0500 Subject: [PATCH 01/10] Add language_kdl --- plugins/language_kdl.lua | 84 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 plugins/language_kdl.lua diff --git a/plugins/language_kdl.lua b/plugins/language_kdl.lua new file mode 100644 index 00000000..a08a0bbe --- /dev/null +++ b/plugins/language_kdl.lua @@ -0,0 +1,84 @@ +-- mod-version:3 +local syntax = require "core.syntax" + +local identifier = "\"?[^%d%s\\/%(%){}<>;%[%]=,\"][^%s\\/%(%){}<>;%[%]=,\"]*\"?" + +syntax.add { + name = "KDL", + files = { "%.kdl" }, + space_handling = false, + comment = "//", + block_comment = {"/*", "*/"}, + patterns = { + { + pattern = "^%s*".. identifier .."%s*", + type = "keyword" + },-- + { pattern = "%s+", type = "normal" }, + { + pattern = "[{;]%s*()" .. identifier .. "%s*", + type = {"normal", "keyword"} + },-- + { pattern = { "r#+\"", "\"#+" }, type = "string" }, + { pattern = { '"', '"', '\\' }, type = "string" }, + { pattern = "[%-+]?0x[%x_]+", type = "number" }, + { pattern = "[%-+]?0b[01_]+", type = "number" }, + { pattern = "[%-+]?0o[0-7_]+", type = "number" }, + { + pattern = "[%-+]?[%d_]+%.[%d_]+e[%-+]?[%d_]+", + type = "number" + }, + { pattern = "[%-+]?[%d_]+%.[%d_]+", type = "number" }, + { pattern = "[%-+]?[%d_]+e[%-+]?[%d_]+", type = "number" }, + { pattern = "[%-+]?[%d_]+", type = "number" }, + { pattern = "/[%-/].-\n", type = "comment" }, + { pattern = {"/%*", "%*/"}, type = "comment" }, + { pattern = identifier, type = "keyword2" }, + { + pattern = "%(()" .. identifier .. "()%)", + type = {"normal", "function", "normal"} + }, + }, + symbols = { + ["null"] = "literal", + ["true"] = "literal", + ["false"] = "literal", + ["i8"] = "function", + ["i32"] = "function", + ["i16"] = "function", + ["i64"] = "function", + ["u8"] = "function", + ["u32"] = "function", + ["u16"] = "function", + ["u64"] = "function", + ["isize"] = "function", + ["usize"] = "function", + ["f32"] = "function", + ["f64"] = "function", + ["decimal64"] = "function", + ["decimal128"] = "function", + ["date-time"] = "function", + ["time"] = "function", + ["date"] = "function", + ["duration"] = "function", + ["decimal"] = "function", + ["currency"] = "function", + ["country-2"] = "function", + ["country-3"] = "function", + ["country-subdivision"] = "function", + ["email"] = "function", + ["idn-email"] = "function", + ["hostname"] = "function", + ["idn-hostname"] = "function", + ["ipv4"] = "function", + ["ipv6"] = "function", + ["url"] = "function", + ["url-reference"] = "function", + ["irl"] = "function", + ["irl-reference"] = "function", + ["url-template"] = "function", + ["uuid"] = "function", + ["regex"] = "function", + ["base64"] = "function", + }, +} From 428d5ae90bc462667fe6c30615a8ad5e71a1ba86 Mon Sep 17 00:00:00 2001 From: Github Actions <> Date: Sat, 7 Sep 2024 09:03:14 +0000 Subject: [PATCH 02/10] [CI] Updated README.md and manifest.json. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 6984ea4c..5a8149ef 100644 --- a/README.md +++ b/README.md @@ -119,6 +119,7 @@ to follow with `extra.follow_branch`.* | [`keyhud`](https://codeberg.org/Mandarancio/keyhud)* | Simple *key HUD* for Lite XL | | [`keymap_export`](plugins/keymap_export.lua?raw=1) | Exports the keymap to a JSON file. | | [`kinc-projects`](https://github.com/Kode-Community/kinc_plugin)* | Adds [Kinc](https://github.com/Kode/Kinc) Project generation with basic build commands(depends on [`console`](https://github.com/franko/console)) | +| [`language_kdl`](plugins/language_kdl.lua?raw=1) | | | [`lfautoinsert`](plugins/lfautoinsert.lua?raw=1) | Automatically inserts indentation and closing bracket/text after newline | | [`linenumbers`](plugins/linenumbers.lua?raw=1) | The ability to change the display of the line number *([screenshot](https://user-images.githubusercontent.com/5556081/129493788-6a4cbd7a-9074-4133-bab7-110ed55f18f7.png))* | | [`lintplus`](https://github.com/liquid600pgm/lintplus)* | Advanced linter with ErrorLens-like error reporting. Compatible with linters made for `linter` *([screenshot](https://raw.githubusercontent.com/liquid600pgm/lintplus/master/screenshots/1.png))* | From 2e47564ff47a46fdbcd7ac13674800a923015362 Mon Sep 17 00:00:00 2001 From: Tamnac <49466795+Tamnac@users.noreply.github.com> Date: Sat, 7 Sep 2024 14:06:47 +0500 Subject: [PATCH 03/10] Add language_kdl to manifest --- manifest.json | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/manifest.json b/manifest.json index 4fd7a35f..e95b1207 100644 --- a/manifest.json +++ b/manifest.json @@ -115,6 +115,7 @@ "language_json": {}, "language_jsx": {}, "language_julia": {}, + "language_kdl": {}, "language_kotlin": {}, "language_lilypond": {}, "language_liquid": {}, @@ -1191,6 +1192,16 @@ ], "version": "0.1" }, + { + "description": "Syntax for the [KDL](https://kdl.dev) document language", + "id": "language_kdl", + "mod_version": "3", + "path": "plugins/language_kdl.lua", + "tags": [ + "language" + ], + "version": "0.1" + }, { "description": "Syntax for the [Kotlin](https://kotlinlang.org/docs/home.html) programming language", "id": "language_kotlin", From 281f6be5c69c952bf0647d50040e966c5cc8ae99 Mon Sep 17 00:00:00 2001 From: Github Actions <> Date: Sat, 7 Sep 2024 09:07:03 +0000 Subject: [PATCH 04/10] [CI] Updated README.md and manifest.json. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5a8149ef..136ab5e0 100644 --- a/README.md +++ b/README.md @@ -119,7 +119,6 @@ to follow with `extra.follow_branch`.* | [`keyhud`](https://codeberg.org/Mandarancio/keyhud)* | Simple *key HUD* for Lite XL | | [`keymap_export`](plugins/keymap_export.lua?raw=1) | Exports the keymap to a JSON file. | | [`kinc-projects`](https://github.com/Kode-Community/kinc_plugin)* | Adds [Kinc](https://github.com/Kode/Kinc) Project generation with basic build commands(depends on [`console`](https://github.com/franko/console)) | -| [`language_kdl`](plugins/language_kdl.lua?raw=1) | | | [`lfautoinsert`](plugins/lfautoinsert.lua?raw=1) | Automatically inserts indentation and closing bracket/text after newline | | [`linenumbers`](plugins/linenumbers.lua?raw=1) | The ability to change the display of the line number *([screenshot](https://user-images.githubusercontent.com/5556081/129493788-6a4cbd7a-9074-4133-bab7-110ed55f18f7.png))* | | [`lintplus`](https://github.com/liquid600pgm/lintplus)* | Advanced linter with ErrorLens-like error reporting. Compatible with linters made for `linter` *([screenshot](https://raw.githubusercontent.com/liquid600pgm/lintplus/master/screenshots/1.png))* | @@ -258,6 +257,7 @@ to follow with `extra.follow_branch`.* | [`language_json`](plugins/language_json.lua?raw=1) | Syntax for the [JSON](https://www.json.org/json-en.html) language | | [`language_jsx`](plugins/language_jsx.lua?raw=1) | Syntax for the [JSX](https://reactjs.org/docs/introducing-jsx.html) language for the React framework in JavaScript | | [`language_julia`](plugins/language_julia.lua?raw=1) | Syntax for the [Julia](https://julialang.org/) programming language | +| [`language_kdl`](plugins/language_kdl.lua?raw=1) | Syntax for the [KDL](https://kdl.dev) document language | | [`language_kotlin`](plugins/language_kotlin.lua?raw=1) | Syntax for the [Kotlin](https://kotlinlang.org/docs/home.html) programming language | | [`language_ksy`](https://raw.githubusercontent.com/whiteh0le/lite-plugins/main/plugins/language_ksy.lua?raw=1)* | Syntax for [Kaitai](http://kaitai.io/) struct files | | [`language_lilypond`](plugins/language_lilypond.lua?raw=1) | Syntax for the [LilyPond](https://lilypond.org/) music typesetting language | From 8949a2896343704deaaa49b25bfd0c11fa4b2dfb Mon Sep 17 00:00:00 2001 From: Tamnac <49466795+Tamnac@users.noreply.github.com> Date: Tue, 10 Sep 2024 05:37:46 +0500 Subject: [PATCH 05/10] Bump meta plugin version --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index e95b1207..b6b347e4 100644 --- a/manifest.json +++ b/manifest.json @@ -11,7 +11,7 @@ "id": "meta_addons", "mod_version": "3", "type": "meta", - "version": "0.1" + "version": "0.2" }, { "dependencies": { From 5e6e8b6314207cdf4fde484de6848eb9637470ae Mon Sep 17 00:00:00 2001 From: Tamnac <49466795+Tamnac@users.noreply.github.com> Date: Tue, 10 Sep 2024 05:49:05 +0500 Subject: [PATCH 06/10] unbump meta plugin --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index b6b347e4..e95b1207 100644 --- a/manifest.json +++ b/manifest.json @@ -11,7 +11,7 @@ "id": "meta_addons", "mod_version": "3", "type": "meta", - "version": "0.2" + "version": "0.1" }, { "dependencies": { From d9b009a0b353521c37033a163d6303f000c31575 Mon Sep 17 00:00:00 2001 From: Tamnac <49466795+Tamnac@users.noreply.github.com> Date: Mon, 9 Sep 2024 17:53:12 -0700 Subject: [PATCH 07/10] fix formatting --- plugins/language_kdl.lua | 108 +++++++++++++++++++-------------------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/plugins/language_kdl.lua b/plugins/language_kdl.lua index a08a0bbe..5682de11 100644 --- a/plugins/language_kdl.lua +++ b/plugins/language_kdl.lua @@ -11,74 +11,74 @@ syntax.add { block_comment = {"/*", "*/"}, patterns = { { - pattern = "^%s*".. identifier .."%s*", - type = "keyword" - },-- + pattern = "^%s*".. identifier .."%s*", + type = "keyword" + }, { pattern = "%s+", type = "normal" }, { - pattern = "[{;]%s*()" .. identifier .. "%s*", - type = {"normal", "keyword"} - },-- + pattern = "[{;]%s*()" .. identifier .. "%s*", + type = {"normal", "keyword"} + }, { pattern = { "r#+\"", "\"#+" }, type = "string" }, { pattern = { '"', '"', '\\' }, type = "string" }, { pattern = "[%-+]?0x[%x_]+", type = "number" }, { pattern = "[%-+]?0b[01_]+", type = "number" }, { pattern = "[%-+]?0o[0-7_]+", type = "number" }, { - pattern = "[%-+]?[%d_]+%.[%d_]+e[%-+]?[%d_]+", - type = "number" - }, - { pattern = "[%-+]?[%d_]+%.[%d_]+", type = "number" }, + pattern = "[%-+]?[%d_]+%.[%d_]+e[%-+]?[%d_]+", + type = "number" + }, + { pattern = "[%-+]?[%d_]+%.[%d_]+", type = "number" }, { pattern = "[%-+]?[%d_]+e[%-+]?[%d_]+", type = "number" }, { pattern = "[%-+]?[%d_]+", type = "number" }, { pattern = "/[%-/].-\n", type = "comment" }, { pattern = {"/%*", "%*/"}, type = "comment" }, { pattern = identifier, type = "keyword2" }, - { - pattern = "%(()" .. identifier .. "()%)", - type = {"normal", "function", "normal"} - }, + { + pattern = "%(()" .. identifier .. "()%)", + type = {"normal", "function", "normal"} + }, }, symbols = { - ["null"] = "literal", - ["true"] = "literal", - ["false"] = "literal", - ["i8"] = "function", - ["i32"] = "function", - ["i16"] = "function", - ["i64"] = "function", - ["u8"] = "function", - ["u32"] = "function", - ["u16"] = "function", - ["u64"] = "function", - ["isize"] = "function", - ["usize"] = "function", - ["f32"] = "function", - ["f64"] = "function", - ["decimal64"] = "function", - ["decimal128"] = "function", - ["date-time"] = "function", - ["time"] = "function", - ["date"] = "function", - ["duration"] = "function", - ["decimal"] = "function", - ["currency"] = "function", - ["country-2"] = "function", - ["country-3"] = "function", - ["country-subdivision"] = "function", - ["email"] = "function", - ["idn-email"] = "function", - ["hostname"] = "function", - ["idn-hostname"] = "function", - ["ipv4"] = "function", - ["ipv6"] = "function", - ["url"] = "function", - ["url-reference"] = "function", - ["irl"] = "function", - ["irl-reference"] = "function", - ["url-template"] = "function", - ["uuid"] = "function", - ["regex"] = "function", - ["base64"] = "function", + ["null"] = "literal", + ["true"] = "literal", + ["false"] = "literal", + ["i8"] = "function", + ["i32"] = "function", + ["i16"] = "function", + ["i64"] = "function", + ["u8"] = "function", + ["u32"] = "function", + ["u16"] = "function", + ["u64"] = "function", + ["isize"] = "function", + ["usize"] = "function", + ["f32"] = "function", + ["f64"] = "function", + ["decimal64"] = "function", + ["decimal128"] = "function", + ["date-time"] = "function", + ["time"] = "function", + ["date"] = "function", + ["duration"] = "function", + ["decimal"] = "function", + ["currency"] = "function", + ["country-2"] = "function", + ["country-3"] = "function", + ["country-subdivision"] = "function", + ["email"] = "function", + ["idn-email"] = "function", + ["hostname"] = "function", + ["idn-hostname"] = "function", + ["ipv4"] = "function", + ["ipv6"] = "function", + ["url"] = "function", + ["url-reference"] = "function", + ["irl"] = "function", + ["irl-reference"] = "function", + ["url-template"] = "function", + ["uuid"] = "function", + ["regex"] = "function", + ["base64"] = "function", }, } From dad4fa1af8db9455c0f1bce889192a1f40683615 Mon Sep 17 00:00:00 2001 From: Tamnac <49466795+Tamnac@users.noreply.github.com> Date: Mon, 9 Sep 2024 17:55:31 -0700 Subject: [PATCH 08/10] improve file handling and one other --- plugins/language_kdl.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/language_kdl.lua b/plugins/language_kdl.lua index 5682de11..71915168 100644 --- a/plugins/language_kdl.lua +++ b/plugins/language_kdl.lua @@ -5,7 +5,7 @@ local identifier = "\"?[^%d%s\\/%(%){}<>;%[%]=,\"][^%s\\/%(%){}<>;%[%]=,\"]*\"?" syntax.add { name = "KDL", - files = { "%.kdl" }, + files = { "%.kdl$" }, space_handling = false, comment = "//", block_comment = {"/*", "*/"}, @@ -31,7 +31,7 @@ syntax.add { { pattern = "[%-+]?[%d_]+%.[%d_]+", type = "number" }, { pattern = "[%-+]?[%d_]+e[%-+]?[%d_]+", type = "number" }, { pattern = "[%-+]?[%d_]+", type = "number" }, - { pattern = "/[%-/].-\n", type = "comment" }, + { pattern = "/[%-/].*", type = "comment" }, { pattern = {"/%*", "%*/"}, type = "comment" }, { pattern = identifier, type = "keyword2" }, { From 3288c4a58b41c5e726d719b517c298c163bc080d Mon Sep 17 00:00:00 2001 From: Tamnac <49466795+Tamnac@users.noreply.github.com> Date: Mon, 9 Sep 2024 18:38:46 -0700 Subject: [PATCH 09/10] fix nested and node comments --- plugins/language_kdl.lua | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/plugins/language_kdl.lua b/plugins/language_kdl.lua index 71915168..a22b2d44 100644 --- a/plugins/language_kdl.lua +++ b/plugins/language_kdl.lua @@ -3,6 +3,18 @@ local syntax = require "core.syntax" local identifier = "\"?[^%d%s\\/%(%){}<>;%[%]=,\"][^%s\\/%(%){}<>;%[%]=,\"]*\"?" +local node_comment = { symbols = {} } +node_comment["patterns"] = { + { pattern = { "{", "}" }, type = "comment", syntax = node_comment }, + { pattern = "[^{}]+", type = "comment" } +} + +local nested_multiline = { symbols = {} } +nested_multiline["patterns"] = { + { pattern = { "/%*", "%*/" }, type = "comment", syntax = nested_multiline }, + { pattern = "[^/*]+", type = "comment" }, +} + syntax.add { name = "KDL", files = { "%.kdl$" }, @@ -31,8 +43,15 @@ syntax.add { { pattern = "[%-+]?[%d_]+%.[%d_]+", type = "number" }, { pattern = "[%-+]?[%d_]+e[%-+]?[%d_]+", type = "number" }, { pattern = "[%-+]?[%d_]+", type = "number" }, - { pattern = "/[%-/].*", type = "comment" }, - { pattern = {"/%*", "%*/"}, type = "comment" }, + { pattern = "//.*", type = "comment" }, + { + pattern = { "/%-.*{", "}" }, + type = "comment", syntax = node_comment + }, + { + pattern = {"/%*", "%*/"}, + type = "comment", syntax = nested_multiline + }, { pattern = identifier, type = "keyword2" }, { pattern = "%(()" .. identifier .. "()%)", From 122b882a19cf37e4175d8dd5cc60c53ca13e2d2b Mon Sep 17 00:00:00 2001 From: Tamnac <49466795+Tamnac@users.noreply.github.com> Date: Fri, 20 Sep 2024 10:15:22 +0500 Subject: [PATCH 10/10] Bump meta plugin --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index a7bddb41..3164c60e 100644 --- a/manifest.json +++ b/manifest.json @@ -168,7 +168,7 @@ "id": "meta_languages", "mod_version": "3", "type": "meta", - "version": "0.1.18" + "version": "0.1.19" }, { "description": "Align multiple carets and selections *([clip](https://user-images.githubusercontent.com/2798487/165631951-532f8d24-d596-4dd0-9d21-ff53c71ed32f.mp4))*",