PromptScript Language Support for VS Code

Full language support for PromptScript (.ps) files in Visual Studio Code.
Features
Syntax Highlighting
- Version declarations (
/ps2024-2.5.1)
- Function calls with 180+ built-in functions
- 200+ flags for fine-grained control
- Variable references (
{VARIABLE})
- Keywords, operators, and control flow
- Comments (line and block)
- Strings (single, double, template)
- Numbers (decimal, hex, binary, octal, float)
Error Checking & Validation
- Real-time syntax validation
- Missing version declaration detection
- Invalid function category detection
- Unclosed variable reference detection
- Invalid flag syntax warnings
- Unmatched parentheses detection
IntelliSense & Auto-completion
- Function category completion
- Flag completion with common flags
- Keyword completion
- Trigger characters:
*, ., -, {
Code Snippets
20+ snippets for common patterns:
psversion - Version declaration
funcadd - Addition function
funcprint - Print function
var - Variable assignment
if, while, for - Control flow
function, class - Declarations
- And more...
Themes
- PromptScript Dark - Optimized dark theme
- PromptScript Light - Optimized light theme
Commands
PromptScript: Compile File - Compile current file
PromptScript: Run File - Run current file
PromptScript: Validate Syntax - Validate syntax
Installation
From VS Code Marketplace
- Open VS Code
- Go to Extensions (Ctrl+Shift+X)
- Search for "PromptScript"
- Click Install
From VSIX
- Download the
.vsix file
- Open VS Code
- Go to Extensions (Ctrl+Shift+X)
- Click "..." menu → "Install from VSIX..."
- Select the downloaded file
Manual Installation
cp -r vscode/promptscript ~/.vscode/extensions/
Configuration
Settings
promptscript.validate.enable - Enable/disable syntax validation (default: true)
promptscript.validate.onType - Run validation on typing (default: true)
promptscript.compiler.path - Path to PromptScript compiler (default: "promptscript")
promptscript.trace.server - Language server trace level (default: "off")
Example settings.json
{
"promptscript.validate.enable": true,
"promptscript.validate.onType": true,
"promptscript.compiler.path": "/usr/local/bin/promptscript"
}
Usage
Basic Example
/ps2024-2.5.1
TOTAL = 100
PRICE = 25.50
*FUNCT.CALCU.MUL (TOTAL, PRICE) -NAME = 'RESULT'
*FUNCT.IO.PRINT ('Total: ', {RESULT}) -FORMAT = 'CURRENCY'
exit 0
Compile & Run
- Open a
.ps file
- Press
Ctrl+Shift+P (Cmd+Shift+P on Mac)
- Type "PromptScript: Compile File" or "PromptScript: Run File"
- Press Enter
Requirements
- Visual Studio Code 1.75.0 or higher
- PromptScript compiler (optional, for compilation)
Building from Source
cd vscode/promptscript
npm install
npm run compile
npm run package
This creates a .vsix file you can install.
Publishing
npm run publish
Requires a VS Code Marketplace publisher account.
Language Features
180+ Built-in Functions
- CALCU: Mathematical operations (ADD, SUB, MUL, DIV, etc.)
- STRING: String manipulation (CONCAT, UPPER, LOWER, etc.)
- ARRAY: Array operations (CREATE, PUSH, POP, etc.)
- DICT: Dictionary operations (CREATE, SET, GET, etc.)
- IO: File and console I/O (PRINT, READ, WRITE, etc.)
- TIME: Date and time operations (NOW, FORMAT, etc.)
- JSON: JSON parsing (PARSE, STRINGIFY, etc.)
- REGEX: Regular expressions (MATCH, REPLACE, etc.)
- CRYPTO: Cryptographic operations (SHA256, MD5, etc.)
- NET: HTTP requests (GET, POST, etc.)
- SYS: System operations (EXEC, ENV, etc.)
- PROMPT: User prompts (INPUT, CONFIRM, etc.)
- DEBUG: Debugging utilities (LOG, TRACE, etc.)
- LOGIC: Logical operations (AND, OR, NOT, etc.)
200+ Flags
Fine-grained control with flags like:
-NAME, -VALUE, -TYPE, -INDEX
-FORMAT, -MODE, -ENCODING
-SEPARATOR, -LEVEL, -STYLE
- And 190+ more...
Support
License
MIT License - See LICENSE file for details
Release Notes
1.0.0
- Initial release
- Syntax highlighting for all language features
- Real-time error checking and validation
- IntelliSense and auto-completion
- 20+ code snippets
- Custom themes (dark and light)
- Compile and run commands
| |