Note: This repository was almost entirely created using GenAI with some limited human supervision. It is regularly used and updated by human users of Engineering Sketch Pad.
A Visual Studio Code extension that provides comprehensive language support for CSM (Constructive Solid Modeling) files.
- Syntax Highlighting: Full syntax highlighting for CSM keywords, functions, comments, strings, and numbers
- Comment Toggle: Use
Cmd+/(Mac) orCtrl+/(Windows/Linux) to toggle line comments with# - Bracket Matching: Auto-closing and matching for parentheses, brackets, and braces
- String Support: Syntax highlighting for both single and double quoted strings
.csm- CSM (Constructive Solid Modeling) files
- Clone this repository
- Install dependencies:
npm install - Make your changes
- Test by running:
npm run dev(packages and installs locally) - Reload VS Code window (
Cmd+RorCtrl+R) to see changes
csm-language-support/
├── scripts/
│ └── generate-grammar.js # Grammar generation script with embedded keywords
├── syntaxes/
│ └── csm.tmLanguage.json # Generated TextMate grammar
├── language-configuration.json # Language configuration (comments, brackets)
└── package.json # Extension manifest
To add new keywords, edit the generate-grammar.js script directly and update the controlKeywords or functionKeywords arrays. Then, run the following command to regenerate the grammar:
npm run generate-grammarnpm run dev- Package and install locally for testing (quick development cycle)npm run generate-grammar- Generate TextMate grammar from embedded keywordsnpm run build- Build the extension (includes grammar generation)npm run package- Package the extension into a .vsix filenpm run install-local- Install the packaged extension into VS Codenpm run publish- Publish the extension (requires vsce setup)
# CSM Example - Airfoil Generation
CFGPMTR kulfan_LowerAmount 4
CFGPMTR kulfan_UpperAmount 4
dimension class 1 2 1
dimension ztail 1 2 1
dimension aupper 1 kulfan_UpperAmount 1
dimension alower 1 kulfan_UpperAmount 1
despmtr class "0.5; 1.0"
despmtr ztail "0.0005; -0.0005"
despmtr aupper "0.1; 0.15; 0.12; 0.1"
despmtr alower "-.08; -.015; -.03; 0.0012"
udparg kulfan class class
udparg kulfan ztail ztail
udparg kulfan aupper aupper
udprim kulfan alower alower
store airfoil
This repository ships with a pre-built .vsix file (csm-language-support-0.0.1.vsix) at the project root. Pick whichever method below is easiest for you.
No prerequisites required.
- Open VS Code.
- Open the Extensions view (
Cmd+Shift+Xon Mac,Ctrl+Shift+Xon Windows/Linux). - Click the
…menu in the top-right of the Extensions view and choose Install from VSIX…. - Navigate to this folder and select
csm-language-support-0.0.1.vsix. - When prompted, reload VS Code (or press
Cmd+R/Ctrl+R). - Open any
.csmfile to verify syntax highlighting works.
You need the code command available on your PATH. On macOS, if code is not found, you can either:
- In VS Code, run Shell Command: Install 'code' command in PATH from the command palette (
Cmd+Shift+P), or - Call the CLI directly:
"/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code" --install-extension /path/to/csm-language-support-0.0.1.vsix
With code on your PATH:
cd /path/to/csm_syntax
code --install-extension csm-language-support-0.0.1.vsixThen reload VS Code.
Use this if you've modified the grammar, keywords, or documentation and want to install your changes.
Prerequisites: Node.js (v14 or higher) and npm.
-
Open a terminal in this folder:
cd /path/to/csm_syntax -
Install dependencies:
npm install
-
Build, package, and install in one step:
npm run dev
This regenerates the grammar/docs, produces a fresh
.vsix, and installs it into VS Code.Or run the steps individually:
npm run package # produces csm-language-support-<version>.vsix npm run install-local # installs the produced .vsix into VS Code
-
Reload the VS Code window (
Cmd+RorCtrl+R).
- Open the Extensions view and search for CSM Language Support — it should appear as installed.
- Open any
.csmfile; keywords, comments (#), and strings should be color-highlighted. - Press
Cmd+/(Mac) orCtrl+/(Windows/Linux) on a line to toggle a#comment.
In the Extensions view, find CSM Language Support, click the gear icon, and choose Uninstall. Or from the command line:
code --uninstall-extension csm-language-team.csm-language-support- Fork the repository
- Clone your fork and create a new branch
- Make your changes
- Update the
generate-grammar.jsscript if adding new keywords - Test your changes using
npm run dev - Submit a pull request
Note: Before publishing, update the repository URL in package.json to match your GitHub repository.
This project is licensed under the MIT License - see the LICENSE file for details.
- Initial release
- Basic syntax highlighting for CSM files
- Comment toggling support with
# - Embedded keywords for grammar generation
- Support for 42+ control keywords and 64+ function keywords