From 8fe609fe4d0770f719c25b2803569b1716c65f47 Mon Sep 17 00:00:00 2001
From: Sainan <63328889+Sainan@users.noreply.github.com>
Date: Sun, 24 Aug 2025 06:38:08 +0200
Subject: [PATCH] Highlight compile-time conditionals
---
Pluto.tmbundle/Syntaxes/Pluto.tmLanguage | 6 ++++++
test.js | 15 +++++++++++++++
2 files changed, 21 insertions(+)
diff --git a/Pluto.tmbundle/Syntaxes/Pluto.tmLanguage b/Pluto.tmbundle/Syntaxes/Pluto.tmLanguage
index 201b630..691e3eb 100644
--- a/Pluto.tmbundle/Syntaxes/Pluto.tmLanguage
+++ b/Pluto.tmbundle/Syntaxes/Pluto.tmLanguage
@@ -725,6 +725,12 @@
name
meta.classoperator.pluto
+
+ match
+ \$(?:if|elseif|else|end)\b
+ name
+ keyword.control.pluto
+
match
\b(?<![.:])(break|continue|do|else|for|if|elseif|goto|return|switch|pluto_switch|then|repeat|while|until|end|in|as|case|default|begin|pluto_use|pluto_try|pluto_catch|try|catch)\b
diff --git a/test.js b/test.js
index 2bcf9c2..b0ad9ed 100644
--- a/test.js
+++ b/test.js
@@ -313,6 +313,21 @@ async function main()
` ------ storage.type.primitive.pluto`
);
+ checkClassification(
+ `$if true then`,
+ `--- keyword.control.pluto`,
+ ` ---- constant.language.pluto`,
+ ` ---- keyword.control.pluto`
+ );
+ checkClassification(
+ `$else`,
+ `----- keyword.control.pluto`
+ );
+ checkClassification(
+ `$end`,
+ `---- keyword.control.pluto`
+ );
+
const langConfig = JSON.parse(
fs.readFileSync(path.join(__dirname, "language-config.json"), "utf8").replace(/\/\/.*$/gm, "")
);