CodeSwing Playground (DSI)
A local CodePen-like development environment for VS Code, powered by a locally built version of CodeSwing (originally by lostintangent) and the custom DSI Swing Navigator extension.
Important
Automatic Extension Installation: Opening this workspace will automatically build and install two essential extensions (
CodeSwingandDSI Swing Navigator) to your current VS Code profile. To avoid cluttering your main environment, it is highly recommended to use a dedicated VS Code profile for this project.
How to use a dedicated Profile:
- CLI: Run
code --profile "CodeSwing" .to open the project in a new or existing profile named "CodeSwing". - VS Code UI: Click the Manage gear icon (bottom left) -> Profiles -> Create Profile... -> Name it "CodeSwing" and select it before opening the workspace.
Tip
Navigator Placement: You can move the Swings Navigator (Library icon) to the top of your sidebar by simply clicking and dragging it to your preferred position in the VS Code Activity Bar.
Features
- Automated Workflow: Bootstrap script handles environment setup, including packaging and installing BOTH required extensions from local source.
- Native TypeScript & SCSS Support: CodeSwing natively handles compilation of
script.tsandstyle.scsswithin each swing. No external build step required. - Live Preview: Real-time updates as you code with built-in preview support for TS/SCSS.
- Swing Navigator: A dedicated VS Code sidebar for browsing, creating, and opening playgrounds with integrated search and context menus.
Project Structure
swings/: Contains all your playground projects._template/: The blueprint for new swings.
shared/: Shared TypeScript definitions and global resources.extensions/:codeswing/: Source code for the modified CodeSwing extension.swing-navigator/: Source code for the custom Navigator sidebar extension.
scripts/: Automation scripts for building, environment management, and utilities.
Getting Started
1. Bootstrap the Environment
Run the bootstrap command to build and install the extensions:
npm run bootstrap
Note: This script detects your VS Code profile and installs the extensions specifically for that profile.
2. Create a New Swing
Use the Navigator sidebar (+) button or run:
npm run new-swing my-cool-idea
3. Open a Swing
In the Swings Navigator sidebar (Library icon), double-click on any swing to open it.
Development Workflow
- Code directly: Edit
script.ts,style.scss, andindex.htmlin the swing's root directory. - Live Preview: CodeSwing automatically compiles and reloads the preview as you save your source files.
- Bootstrap/Shared: Use
shared/ts/global.d.tsfor global type definitions if needed.