VSCode Extension
The Grapa VSCode extension provides comprehensive language support for Grapa programming, making it easy to write, run, and debug Grapa code directly in Visual Studio Code.
Installation
From Visual Studio Marketplace
- Open VSCode
- Go to Extensions (Ctrl+Shift+X)
- Search for "Grapa Programming Language"
- Click Install
Prerequisites
- Grapa executable must be installed on your system
- See Installation Guide for Grapa setup instructions
Features
Syntax Highlighting
- Color-coded Grapa code for
.grc
files - Proper highlighting for Grapa-specific syntax
- Support for strings, numbers, comments, operators, and system types
IntelliSense & Autocomplete
- Smart code completion for Grapa types and methods
- Context-aware suggestions based on current code
- Hover information with detailed documentation
Code Snippets
Over 40 pre-built snippets for common Grapa patterns:
Control Flow
if
- If statementifelse
- If-else statementwhile
- While loopfor
- For loop
File Operations
read
- File readingwrite
- File writingexists
- File existence checkls
- Directory listingcd
- Change directory
Cryptography
rsa
- RSA key generationsign
- RSA signingverify
- RSA verificationec
- EC key generationdh
- DH key generationhash
- Hash encoding
Data Structures
array
- Array creationjson
- JSON objectvector
- Vector creationfunction
- Function definition
Error Handling
iferr
- Error handling with fallbackifnull
- Null value handling
Interactive Execution
Two modes for running Grapa code:
Interactive Terminal
- Fully interactive - Type commands directly
- Real-time execution - See results immediately
- Variable persistence - Variables persist between commands
Code Selection Execution
- Run selected code - Execute highlighted code
- Variable persistence - Variables persist between runs
- Multi-line support - Execute complex code blocks
Error Detection
- Syntax validation - Real-time error checking
- Error highlighting - Visual error indicators
- Debug information - Detailed error messages
Quick Start
1. Open a Grapa File
# Create a new .grc file
touch hello.grc
2. Write Some Code
'Hello, Grapa!'.echo();
10.range().echo();
3. Run the Code
- Press Ctrl+Shift+S to run selected code
- Press Ctrl+Shift+R to run the entire file
- Use Ctrl+Shift+P → "Grapa: Start Interactive Terminal" for REPL mode
Commands
Available Commands
- Grapa: Run File - Execute current
.grc
file - Grapa: Run Selection - Run selected code
- Grapa: Run Command - Execute custom command
- Grapa: Start Interactive Terminal - Open interactive terminal
- Grapa: Start Interactive Session - Start session for code selections
- Grapa: Restart Session - Restart interactive session
- Grapa: Interrupt Session - Stop current execution
- Grapa: Debug File - Run with debug mode
Keyboard Shortcuts
- Ctrl+Shift+R - Run current file
- Ctrl+Shift+S - Run selected code
- Ctrl+Shift+I - Interrupt current command
Configuration
Extension Settings
Configure the extension behavior in VSCode settings:
{
"grapa.executablePath": "./grapa",
"grapa.debugMode": false,
"grapa.autoRunOnSave": false,
"grapa.preferInteractiveMode": true,
"grapa.sessionTimeout": 30000,
"grapa.autoEscapeLineFeeds": true,
"grapa.showInteractiveOutput": true
}
Setting Descriptions
executablePath
- Path to Grapa executabledebugMode
- Enable debug outputautoRunOnSave
- Automatically run files when savedpreferInteractiveMode
- Use interactive mode for selectionssessionTimeout
- Timeout for interactive commandsautoEscapeLineFeeds
- Auto-escape line feeds in multi-line codeshowInteractiveOutput
- Show output in interactive mode
Usage Examples
Basic Syntax Highlighting
/* This is a comment */
'Hello, Grapa!'.echo();
/* File operations */
$file().setfield("data.txt", "Hello World");
content = $file().getfield("data.txt");
content.echo();
Using Snippets
- Type snippet prefix (e.g.,
rsa
) - Press Tab to expand
- Fill in placeholders as needed
Example with RSA snippet:
// Type 'rsa' + Tab
rsa = "rsa".genkeys(2048);
signature = 'Hello'.sign(rsa);
'Hello'.verify(rsa, signature).echo();
Interactive Mode
// Start interactive terminal
grapa: /> 'Hello, Grapa!'.echo();
Hello, Grapa!
grapa: /> 10.range();
[0,1,2,3,4,5,6,7,8,9]
grapa: /> x = 5;
grapa: /> x * 2;
10
Multi-line Code Execution
// Select this block and press Ctrl+Shift+S
if (true) {
'This is a multi-line block'.echo();
'It will execute as a single unit'.echo();
}
Troubleshooting
Common Issues
Extension Not Loading
- Check VSCode developer console for errors
- Verify
.grc
files are recognized as Grapa files - Restart VSCode after installation
Grapa Executable Not Found
- Verify Grapa is installed and in PATH
- Check
grapa.executablePath
setting - Test
grapa --version
in terminal
Interactive Mode Not Working
- Use "Grapa: Start Interactive Terminal" for manual typing
- Use "Grapa: Start Interactive Session" for code selections
- Check executable path configuration
Snippets Not Working
- Type snippet prefix and press Tab
- Check for syntax errors in snippet definitions
- Verify snippet file is properly loaded
Debug Mode
Enable debug mode for detailed logging:
{
"grapa.debugMode": true
}
Check the Output panel (View → Output → Grapa) for debug information.
Integration with Other Tools
Git Integration
- Version control for
.grc
files - Diff highlighting for Grapa syntax
- Blame information for code history
Terminal Integration
- Integrated terminal with Grapa support
- Command execution directly from VSCode
- Output capture and display
Debugging
- Breakpoint support for Grapa code
- Variable inspection during execution
- Call stack and error tracking
Best Practices
Code Organization
- Use
.grc
extension for Grapa files - Organize code in logical functions
- Add comments for complex logic
Interactive Development
- Use interactive terminal for experimentation
- Use code selection for testing specific parts
- Leverage snippets for common patterns
Error Handling
- Use
iferr()
for error handling - Use
ifnull()
for null value handling - Enable debug mode for troubleshooting
Support
Getting Help
- GitHub Issues - Report bugs and request features
- Documentation - Complete Grapa language reference
- Community - Grapa discussions and support
Resources
- Grapa Language Documentation - Complete language reference
- Installation Guide - Setup instructions
- Examples - Code examples and patterns
- API Reference - Built-in functions and types
Extension Version: 0.1.0
Publisher: Chris Matichuk
Marketplace: Grapa Programming Language