VS Code Extension¶
SolScript provides a VS Code extension for an enhanced development experience.
Installation¶
From Marketplace¶
- Open VS Code
- Go to Extensions (Ctrl+Shift+X)
- Search for "SolScript"
- Click Install
From VSIX¶
# Download the extension
curl -L -o solscript.vsix https://github.com/cryptuon/solscript/releases/latest/download/solscript.vsix
# Install
code --install-extension solscript.vsix
Features¶
Syntax Highlighting¶
Full syntax highlighting for SolScript files (.sol):
- Keywords and operators
- Types and functions
- Comments and strings
- Contract and interface names
Code Completion¶
Intelligent code completion for:
- Contract members
- Function parameters
- Type names
- Built-in functions
Error Diagnostics¶
Real-time error checking:
- Syntax errors
- Type mismatches
- Undefined variables
- Missing imports
Hover Information¶
Hover over any symbol to see:
- Type information
- Function signatures
- Documentation
Go to Definition¶
Navigate to definitions with:
- Ctrl+Click on symbols
- F12 key
- Right-click → Go to Definition
Find References¶
Find all usages of:
- Functions
- Variables
- Types
- Contracts
Code Formatting¶
Format your code with:
- Shift+Alt+F (Format Document)
- Right-click → Format Document
Configuration¶
Settings¶
Open Settings (Ctrl+,) and search for "SolScript":
{
"solscript.format.tabSize": 4,
"solscript.format.useTabs": false,
"solscript.lint.enable": true,
"solscript.trace.server": "off"
}
Recommended Settings¶
{
"editor.formatOnSave": true,
"[solscript]": {
"editor.defaultFormatter": "solscript.solscript"
}
}
Commands¶
Access commands via Command Palette (Ctrl+Shift+P):
| Command | Description |
|---|---|
SolScript: Build | Build current file |
SolScript: Check | Type-check current file |
SolScript: Format Document | Format current file |
SolScript: Restart Language Server | Restart LSP |
Keyboard Shortcuts¶
| Shortcut | Action |
|---|---|
| Ctrl+Shift+B | Build |
| F12 | Go to Definition |
| Shift+F12 | Find References |
| Shift+Alt+F | Format |
| Ctrl+Space | Trigger Completion |
Snippets¶
Built-in snippets for common patterns:
Contract¶
Type contract + Tab:
Function¶
Type function + Tab:
Modifier¶
Type modifier + Tab:
Event¶
Type event + Tab:
Mapping¶
Type mapping + Tab:
Troubleshooting¶
Extension Not Working¶
-
Check that SolScript CLI is installed:
-
Restart the language server:
-
Command Palette → "SolScript: Restart Language Server"
-
Check the Output panel:
- View → Output
- Select "SolScript" from dropdown
Slow Performance¶
- Check file size and complexity
- Try disabling other extensions
- Increase VS Code memory limit
Formatting Issues¶
- Check format settings
- Ensure file is valid SolScript
- Try reformatting after fixing errors