Xenon
Xenon is a small supporting script format for VS Code, provided by the Xenon extension. The name is for fun; Xenon is not intended to be a general-purpose programming language.
Features
- Syntax highlighting and automatic pairing for
.xe files
- Folding for
group (...), group 1 (or another number), and the Xenon start/end block
- Conditional output using
conditionally reacting, conditionally no-reaction, and or continue with?
- A Xenon: Show Output command that displays active
print statements in the Xenon Output panel
- A Xenon: Run command for executing Xenon statements, including
React-Box dialogs and repeated lines
- Ctrl+click file links using
server href
- Automatic and inline code suggestions are disabled for
.xe files; Xenon syntax errors appear as red squiggles
Run .xe files outside VS Code
The standalone PowerShell runner supports print statements, conditions, React-Box, repeated lines, and server href (which opens linked files in Notepad without executing them). Run a file directly with Windows PowerShell:
powershell.exe -NoProfile -STA -File .\xenon-run.ps1 .\example.xe
Add -Preview to print the actions without showing dialogs or opening linked files:
powershell.exe -NoProfile -File .\xenon-run.ps1 .\example.xe -Preview
To run .xe files by double-clicking, install the per-user Windows file association:
powershell.exe -NoProfile -File .\xenon-association.ps1 -Action Install
This changes the current user's .xe association and starts each file in a PowerShell window. Run the same command with -Action Uninstall to restore the previous per-user association when it has not been changed since installation. Windows may require choosing the Xenon handler in Settings > Apps > Default apps. The setup does not bypass PowerShell's execution policy.
Active code block
Xenon statements are active inside a start/end block:
xe:noble-gas [start]
print -- text < "Hello World" >
xe:reacted [end]
xe:noble-gases [start] is also accepted. Code inside an unmatched start block is active while you type; output is available before the end marker is added. A stray xe:reacted [end] is reported as an error. Code outside the block does not produce Xenon output.
Xenon reports malformed print, conditional, group, block-marker, and server href statements with editor diagnostics. An unfinished start block is allowed while you are typing. These diagnostics cover the syntax currently implemented by the extension; they are not a complete language type checker.
Conditions
Conditions use the bare values reacting and no-reaction. Indent each branch body beneath its condition:
xe:noble-gas [start]
conditionally reacting
print -- text < "Hello" >
or continue with?
print -- text < "Bye" >
xe:reacted [end]
React-Box dialogs
Use Xenon: Run to show a native VS Code modal dialog without installing or running VBScript or PowerShell:
xe:noble-gas [start]
React-Box("Continue?", vbYesNo + vbQuestion, "Confirm")
xe:reacted [end]
The optional arguments follow the VBScript MsgBox order: prompt, buttons, title, then a helpfile/context pair. Supported button groups are vbOKOnly, vbOKCancel, vbAbortRetryIgnore, vbYesNoCancel, vbYesNo, and vbRetryCancel. Icon options include vbCritical, vbQuestion, vbExclamation, and vbInformation; default-button options vbDefaultButton1 through vbDefaultButton4 are also supported. The selected button's VB-style return code is written to Xenon Output (for example, vbYes is 6, and vbNo is 7). Dismissing a dialog is reported as vbCancel (2).
When provided, helpfile must be a relative .html, .htm, or .md path beside the .xe file. The dialog's Help choice opens that file, using context as its URL fragment. This approximates VBScript's help topic behavior; VS Code does not support Windows system-modal dialogs or native .hlp context help.
Repeating a line
copy[slc(line-number)] by count runs a selected executable line repeatedly:
xe:noble-gas [start]
print -- text < "Hello" >
copy[slc(2)] by 3
xe:reacted [end]
Line numbers are 1-based physical line numbers in the .xe file. The selected line must be an active print or React-Box statement. The copy command runs it count times at that point; the original line still runs normally when reached. count must be a positive whole number. There is no configured repetition cap; cancel Xenon: Run from its progress notification to stop a long run.
Linking source files
New Minor Update: Use server href? <:: (relative/path.ext) ::> inside an active block:
xe:noble-gas [start]
server href? <:: (main.py) ::>
xe:reacted [end]
The path is relative to the .xe file. Ctrl+click the filename to open it in VS Code. You can also run Xenon: Open Linked File from the Command Palette. Links are supported for HTML, CSS, and the following source languages:
- Python (
.py)
- JavaScript (
.js, .jsx, .mjs, .cjs)
- TypeScript (
.ts, .tsx, .mts, .cts)
- Java (
.java)
- C# (
.cs)
- C++ (
.cpp, .cc, .cxx, .c++, .hpp, .hh, .hxx, .h++)
- C (
.c, .h)
- Go (
.go)
- Rust (
.rs)
- Swift (
.swift)
- Kotlin (
.kt, .kts)
- PHP (
.php)
- Ruby (
.rb)
- SQL (
.sql)
- R (
.r)
- Dart (
.dart)
- Scala (
.scala)
- Elixir (
.ex, .exs)
- Lua (
.lua)
- Bash (
.sh, .bash)
These are file links: Xenon opens the referenced file in VS Code but does not execute or import its code.
Packaging
Run vsce package to create a .vsix extension package. Packaging does not publish the extension.