A VSCode extension that automatically synchronizes changes in CSX files to JSON files in base64 format for VNext Workflow Engine projects.
- β
Dynamic Project Structure: Automatically reads project structure from
vnext.config.json - β Multi-Component Support: Tasks, Views, Functions, Extensions, Workflows, Schemas
- β
Recursive CSX Scanning: Supports CSX files in all subdirectories under
/src - β Automatic Synchronization: Automatically updates related JSON files when CSX files change
- β Base64 Conversion: Automatically converts CSX file content to base64
- β Smart Mapping: Automatically finds which CSX files are used in which JSON files
- β Debounce Support: Prevents unnecessary updates during rapid changes
- β Manual Sync: Manual synchronization available when needed
- β Base64 Code Preview: Hover over base64 encoded code in JSON files to see decoded C# code with syntax highlighting
- β
Required:
vnext.config.jsonfile must exist in project root - β
Structure: Component directories must have
/srcsubdirectories - β Format: VNext standard project structure
{
"domain": "core",
"paths": {
"componentsRoot": "core",
"tasks": "Tasks",
"views": "Views",
"functions": "Functions",
"extensions": "Extensions",
"workflows": "Workflows",
"schemas": "Schemas"
}
}project-root/
βββ vnext.config.json β Required configuration file
βββ core/ β componentsRoot
βββ Tasks/
β βββ task1.json
β βββ src/
β βββ main.csx β
Supported
β βββ helpers/
β β βββ validation.csx β
Supported
β βββ utils/
β βββ advanced/
β βββ complex.csx β
Supported
βββ Functions/
β βββ function1.json
β βββ src/
β βββ auth/
β β βββ login.csx β
Supported
β β βββ logout.csx β
Supported
β βββ data/
β βββ processing.csx β
Supported
βββ Workflows/
β βββ global-workflow.json
β βββ payments/ β Sub-directories supported
β βββ scheduled-payments-workflow.json β
Supported
β βββ src/
β βββ MainWorkflowDeactivatedRule.csx β
Supported
βββ Views/
βββ Extensions/
βββ Schemas/
- Download
csx-json-sync.vsixfile - In VS Code:
Ctrl+Shift+Pβ "Extensions: Install from VSIX..." - Select the VSIX file and install
- Copy extension files to
.vscode-extensions/csx-json-sync/directory - Navigate to extension directory in terminal:
cd .vscode-extensions/csx-json-sync - Install dependencies:
npm install
- Compile the extension:
npm run compile
- Press F5 in VSCode to run extension in debug mode
When the extension is active, changes made to CSX files in /src subdirectories of all component directories in the project structure are automatically synchronized to JSON files in the same component directory.
- Sync current file:
Ctrl+Shift+Pβ "Sync Current CSX File to JSON" - Sync all CSX files:
Ctrl+Shift+Pβ "Sync All CSX Files to JSON" - Right-click menu: Right-click on CSX file and select "Sync Current CSX File to JSON"
- Enable Auto Sync:
Ctrl+Shift+Pβ "Enable Auto Sync" - Disable Auto Sync:
Ctrl+Shift+Pβ "Disable Auto Sync"
- Hover Preview: Hover over base64 encoded values in
"code"fields in JSON files - Syntax Highlighting: Decoded C# code is displayed with proper syntax highlighting
- Quick Access: No need to manually decode base64 strings to read the code
- File Support: Works with all JSON files containing base64 encoded CSX code
You can configure the following settings in VSCode Settings:
{
"csxJsonSync.enabled": true, // Enable/disable auto-sync
"csxJsonSync.debounceMs": 500 // Change detection delay (ms)
}- Config Reading: Extension reads
vnext.config.jsonfile - Structure Discovery: Discovers project structure and finds component directories
- File Watcher: Monitors all
/src/**/*.csxfiles - Change Detection: When a CSX file change is detected, debounce timer starts
- Base64 Conversion: CSX file content is converted to base64 format
- JSON Search: Searches for references to this CSX file in JSON files in the same component directory
- Update: Updates
codefields in JSON files where references are found - Hover Provider: Provides instant preview of decoded C# code when hovering over base64 strings in JSON files
The extension works with the following format:
{
"location": "./src/auth/helpers/validation.csx",
"code": "dXNpbmcgU3lzdGVtLlRocmVhZGluZy5UYXNrczsK..."
}When you hover over the base64 string in the "code" field, the extension will:
- Detect that your cursor is over a base64 encoded value
- Automatically decode the base64 string to readable C# code
- Display the decoded code in a popup with syntax highlighting
- Show additional information like the base64 string length
Example:
{
"location": "./src/auth/login.csx",
"code": "dXNpbmcgU3lzdGVtOwo=" β Hover here to see: using System;
}To monitor the extension's operation:
- Go to
ViewβOutputand select "CSX-JSON Sync" channel - All synchronization operations and errors are displayed here
CSX-JSON Sync extension activated
VNext config loaded: domain=core, componentsRoot=core
Found 6 existing component directories:
- core/Tasks
- core/Views
- core/Functions
- core/Extensions
- core/Workflows
- core/Schemas
Auto-sync enabled for 6 component directories
File changed: core/Functions/src/auth/login.csx
Updated code for ./src/auth/login.csx in workflow.json
Auto-sync: Successfully updated 1 JSON file(s) for login.csx
- Ensure the extension is active (check Output channel)
- Ensure
vnext.config.jsonfile exists in project root - Verify the configuration file is in valid JSON format
ERROR: vnext.config.json not found or invalid. This extension requires vnext.config.json to work properly.
- Create
vnext.config.jsonfile in project root - Ensure the file is in valid JSON format
- Ensure CSX file is in
/srcdirectory under a component directory - Ensure JSON files contain correct
locationreferences - Verify auto-sync is enabled
- Check that the component directory is defined in
vnext.config.json
- Ensure CSX file is saved with UTF-8 encoding
- Check file permissions
For detailed development instructions, see CONTRIBUTING.md.
Quick start:
# Install dependencies
npm install
# Compile TypeScript
npm run compile
# Watch mode (automatic compilation)
npm run watch
# Run in debug mode
F5 (in VSCode)
# Create VSIX package
npx vsce package# Create package
npx vsce package
# Install package
code --install-extension csx-json-sync-1.1.0.vsixRun the test script to verify your project structure:
node test-extension.jsThe test script will:
- β
Check for
vnext.config.json - β Verify project structure
- β Find CSX and JSON files
- β Test CSX-JSON mappings
- β Verify base64 conversion
- β Check extension files
- β NEW: Base64 Code Preview on Hover
- β NEW: Syntax highlighting for decoded C# code in hover popup
- β NEW: Base64 string validation and length display
- β Enhanced user experience for viewing encoded CSX code in JSON files
- β
Dynamic project structure support (
vnext.config.json) - β Multi-component type support
- β Recursive CSX file scanning
- β Enhanced file watching
- β Smart relative path calculation
- β Automatic project structure discovery
We welcome contributions! Please see CONTRIBUTING.md for detailed guidelines on:
- π Development setup
- π Project structure
- π§ Development workflow
- π§ͺ Testing procedures
- π¦ Building and packaging
- π Submitting changes
This project is licensed under the MIT License.