Calcpad for VS Code
Language support for Calcpad (.cpd files) in Visual Studio Code.
Features
Syntax Highlighting - Full syntax highlighting for Calcpad files including:
- Keywords (#if, #else, #for, #while, #def, etc.)
- Methods ($Root, $Find, $Plot, $Integral, etc.)
- Built-in functions (sin, cos, sqrt, matrix, etc.)
- Numbers with units (10m, 5kg, 100Pa, etc.)
- Operators and special symbols
- Strings and comments
Auto-completion - IntelliSense completions for:
- All Calcpad keywords
- Built-in functions
- Units (SI and imperial)
- Special methods
Hover Documentation - Hover over functions to see descriptions
Run Files - Run Calcpad files directly from VS Code (Ctrl+Shift+B)
Color Theme - Includes a Monokai-based color theme optimized for Calcpad
Installation
From VSIX file
- Download the
.vsix file
- In VS Code, press
Ctrl+Shift+P and type "Install from VSIX"
- Select the downloaded
.vsix file
Manual Installation
- Copy the entire
https://github.com/Proektsoftbg/Calcpad/tree/main/Setup/Syntax-for-external-editors/calcpad-vscode folder to:
- Windows:
%USERPROFILE%\.vscode\extensions\
- macOS/Linux:
~/.vscode/extensions/
- Restart VS Code
From Source (Development)
- Clone/copy this folder from GitHub
- Run
npm install to install dependencies
- Run
npm run compile to build the extension
- Press F5 to launch a new VS Code window with the extension loaded
Building the VSIX Package
- Install vsce:
npm install -g @vscode/vsce
- Run:
vsce package
- This creates a
.vsix file you can share and install
Usage
- Open any
.cpd file - syntax highlighting is automatic
- Start typing to see auto-completions
- Hover over functions for documentation
- Press
Ctrl+Shift+B or right-click and select "Run Calcpad File" to execute
Color Theme
To use the included Calcpad Monokai theme:
- Press
Ctrl+K Ctrl+T to open the theme picker
- Select "Calcpad Monokai"
File Association
The extension automatically associates with .cpd files. To manually set the language:
- Click on the language indicator in the status bar (bottom right)
- Select "Calcpad"
Requirements
Known issues
- $Map do not display plots in preview when PlotSVG mode is set to nonzero.
Contributing
Contributions are welcome! Please feel free to submit issues and pull requests.
License
MIT
| |