- Node.js (version 16 or higher)
- npm (comes with Node.js)
- Visual Studio Code
Open a terminal in the extension directory and run:
cd "c:\Users\Joseph Ridder\Documents\SWG-Source\swg-stf-editor-extension"
npm installThis will install all required dependencies including TypeScript and VS Code extension types.
Compile the TypeScript code to JavaScript:
npm run compileOr to watch for changes and recompile automatically:
npm run watch- Open the extension folder in VS Code
- Press
F5to launch a new VS Code window with the extension loaded - In the new window, open any
.stffile to test the editor
Package and install the extension:
# Install the packaging tool
npm install -g @vscode/vsce
# Package the extension
vsce package
# Install the generated .vsix file
code --install-extension swg-stf-editor-1.0.0.vsix- Go to https://marketplace.visualstudio.com/
- Sign in with your Microsoft account
- Create a publisher profile
Edit package.json and change the publisher field to your publisher name:
"publisher": "your-publisher-name",- Go to https://dev.azure.com/
- Create a Personal Access Token with "Marketplace (Manage)" permissions
- Save the token securely
# Login to your publisher account
vsce login your-publisher-name
# Publish the extension
vsce publishYou can test the extension with STF files from your SWG installation or development environment. Sample locations:
client-assets-master/string/en/*.stf- Any
.stffiles in your SWG data folders
Run npm install to install dependencies.
Check that:
- The extension is compiled (
npm run compile) - The
.stffile has the correct extension - Check the Output panel (View > Output) for error messages
If the extension produces corrupted STF files:
- Keep a backup of your original files
- Check the text format for syntax errors
- Ensure IDs and CRCs are valid integers
- Set breakpoints in the TypeScript source files
- Press
F5to start debugging - Open an STF file in the debug window
- Breakpoints will be hit in the main VS Code window
- Edit the TypeScript source files in
src/ - Run
npm run compileor use watch mode - Reload the extension window (Ctrl+R in the debug window)
swg-stf-editor-extension/
├── src/
│ ├── extension.ts # Main entry point
│ ├── stfParser.ts # Binary STF file parser/writer
│ ├── stfEditorProvider.ts # Custom editor provider
│ └── stfFileSystem.ts # File system integration
├── out/ # Compiled JavaScript (generated)
├── package.json # Extension manifest
├── tsconfig.json # TypeScript configuration
└── README.md # User documentation